Home / Function/ ByteBuf() — netty Function Reference

ByteBuf() — netty Function Reference

Architecture documentation for the ByteBuf() function in HAProxyMessageDecoder.java from the netty codebase.

Entity Profile

Dependency Diagram

graph TD
  fd4a5643_1cab_48d9_d711_3a4745d987c7["ByteBuf()"]
  c5b93e38_c667_01b8_5fff_e0aa6b922c3e["HeaderExtractor"]
  fd4a5643_1cab_48d9_d711_3a4745d987c7 -->|defined in| c5b93e38_c667_01b8_5fff_e0aa6b922c3e
  23921ca9_0bcc_4691_cc52_b64c6b92259c["failOverLimit()"]
  fd4a5643_1cab_48d9_d711_3a4745d987c7 -->|calls| 23921ca9_0bcc_4691_cc52_b64c6b92259c
  4b0096b8_57a1_aeae_bcda_4ec0c392485e["delimiterLength()"]
  fd4a5643_1cab_48d9_d711_3a4745d987c7 -->|calls| 4b0096b8_57a1_aeae_bcda_4ec0c392485e
  2701fd82_7385_de5f_edfc_2719ce6fc531["findEndOfHeader()"]
  fd4a5643_1cab_48d9_d711_3a4745d987c7 -->|calls| 2701fd82_7385_de5f_edfc_2719ce6fc531
  style fd4a5643_1cab_48d9_d711_3a4745d987c7 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

codec-haproxy/src/main/java/io/netty/handler/codec/haproxy/HAProxyMessageDecoder.java lines 369–409

        public ByteBuf extract(ChannelHandlerContext ctx, ByteBuf buffer) throws Exception {
            final int eoh = findEndOfHeader(buffer);
            if (!discarding) {
                if (eoh >= 0) {
                    final int length = eoh - buffer.readerIndex();
                    if (length > maxHeaderSize) {
                        buffer.readerIndex(eoh + delimiterLength(buffer, eoh));
                        failOverLimit(ctx, length);
                        return null;
                    }
                    ByteBuf frame = buffer.readSlice(length);
                    buffer.skipBytes(delimiterLength(buffer, eoh));
                    return frame;
                } else {
                    final int length = buffer.readableBytes();
                    if (length > maxHeaderSize) {
                        discardedBytes = length;
                        buffer.skipBytes(length);
                        discarding = true;
                        if (failFast) {
                            failOverLimit(ctx, "over " + discardedBytes);
                        }
                    }
                    return null;
                }
            } else {
                if (eoh >= 0) {
                    final int length = discardedBytes + eoh - buffer.readerIndex();
                    buffer.readerIndex(eoh + delimiterLength(buffer, eoh));
                    discardedBytes = 0;
                    discarding = false;
                    if (!failFast) {
                        failOverLimit(ctx, "over " + length);
                    }
                } else {
                    discardedBytes += buffer.readableBytes();
                    buffer.skipBytes(buffer.readableBytes());
                }
                return null;
            }
        }

Domain

Subdomains

Frequently Asked Questions

What does ByteBuf() do?
ByteBuf() is a function in the netty codebase, defined in codec-haproxy/src/main/java/io/netty/handler/codec/haproxy/HAProxyMessageDecoder.java.
Where is ByteBuf() defined?
ByteBuf() is defined in codec-haproxy/src/main/java/io/netty/handler/codec/haproxy/HAProxyMessageDecoder.java at line 369.
What does ByteBuf() call?
ByteBuf() calls 3 function(s): delimiterLength, failOverLimit, findEndOfHeader.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free