Home / Function/ ByteBuf() — netty Function Reference

ByteBuf() — netty Function Reference

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

Entity Profile

Dependency Diagram

graph TD
  fbf09cb6_ae4a_ee95_991f_3d2e9054cfca["ByteBuf()"]
  14c61705_9541_276a_37fa_eaab6f15ec5a["HttpObjectEncoder"]
  fbf09cb6_ae4a_ee95_991f_3d2e9054cfca -->|defined in| 14c61705_9541_276a_37fa_eaab6f15ec5a
  b43fe221_202b_29ad_16a6_78e27c3b8866["encodeInitialLine()"]
  fbf09cb6_ae4a_ee95_991f_3d2e9054cfca -->|calls| b43fe221_202b_29ad_16a6_78e27c3b8866
  4b97ef27_f6d0_bfb2_f13b_e90cabf9295e["isContentAlwaysEmpty()"]
  fbf09cb6_ae4a_ee95_991f_3d2e9054cfca -->|calls| 4b97ef27_f6d0_bfb2_f13b_e90cabf9295e
  8dfd04e1_69f2_a8a4_5337_494907eb60a3["sanitizeHeadersBeforeEncode()"]
  fbf09cb6_ae4a_ee95_991f_3d2e9054cfca -->|calls| 8dfd04e1_69f2_a8a4_5337_494907eb60a3
  b3b89c92_5298_f5c5_d6a1_4c89ee133142["encodeHeaders()"]
  fbf09cb6_ae4a_ee95_991f_3d2e9054cfca -->|calls| b3b89c92_5298_f5c5_d6a1_4c89ee133142
  c9b839f5_b11e_076e_2e87_574417154e52["padSizeForAccumulation()"]
  fbf09cb6_ae4a_ee95_991f_3d2e9054cfca -->|calls| c9b839f5_b11e_076e_2e87_574417154e52
  style fbf09cb6_ae4a_ee95_991f_3d2e9054cfca fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

codec-http/src/main/java/io/netty/handler/codec/http/HttpObjectEncoder.java lines 520–537

    private ByteBuf encodeInitHttpMessage(ChannelHandlerContext ctx, H m) throws Exception {
        assert state == ST_INIT;

        ByteBuf buf = ctx.alloc().buffer((int) headersEncodedSizeAccumulator);
        // Encode the message.
        encodeInitialLine(buf, m);
        state = isContentAlwaysEmpty(m) ? ST_CONTENT_ALWAYS_EMPTY :
                HttpUtil.isTransferEncodingChunked(m) ? ST_CONTENT_CHUNK : ST_CONTENT_NON_CHUNK;

        sanitizeHeadersBeforeEncode(m, state == ST_CONTENT_ALWAYS_EMPTY);

        encodeHeaders(m.headers(), buf);
        ByteBufUtil.writeShortBE(buf, CRLF_SHORT);

        headersEncodedSizeAccumulator = HEADERS_WEIGHT_NEW * padSizeForAccumulation(buf.readableBytes()) +
                HEADERS_WEIGHT_HISTORICAL * headersEncodedSizeAccumulator;
        return buf;
    }

Subdomains

Frequently Asked Questions

What does ByteBuf() do?
ByteBuf() is a function in the netty codebase, defined in codec-http/src/main/java/io/netty/handler/codec/http/HttpObjectEncoder.java.
Where is ByteBuf() defined?
ByteBuf() is defined in codec-http/src/main/java/io/netty/handler/codec/http/HttpObjectEncoder.java at line 520.
What does ByteBuf() call?
ByteBuf() calls 5 function(s): encodeHeaders, encodeInitialLine, isContentAlwaysEmpty, padSizeForAccumulation, sanitizeHeadersBeforeEncode.

Analyze Your Own Codebase

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

Try Supermodel Free