Home / Function/ addFragment() — netty Function Reference

addFragment() — netty Function Reference

Architecture documentation for the addFragment() function in DefaultHttp2FrameReader.java from the netty codebase.

Function java Buffer Allocators calls 1 called by 2

Entity Profile

Dependency Diagram

graph TD
  d3cf3714_2259_6a41_c730_30d5c2dc9945["addFragment()"]
  23bfb7ca_b352_2c9b_8f62_2e588930d870["HeadersBlockBuilder"]
  d3cf3714_2259_6a41_c730_30d5c2dc9945 -->|defined in| 23bfb7ca_b352_2c9b_8f62_2e588930d870
  7359663e_1255_5053_ca98_1c1b54534bc2["readHeadersFrame()"]
  7359663e_1255_5053_ca98_1c1b54534bc2 -->|calls| d3cf3714_2259_6a41_c730_30d5c2dc9945
  996fd454_25d0_9db7_efcf_42958509cd2a["readPushPromiseFrame()"]
  996fd454_25d0_9db7_efcf_42958509cd2a -->|calls| d3cf3714_2259_6a41_c730_30d5c2dc9945
  f866bb17_c663_fdde_f411_f633c41c3908["headerSizeExceeded()"]
  d3cf3714_2259_6a41_c730_30d5c2dc9945 -->|calls| f866bb17_c663_fdde_f411_f633c41c3908
  style d3cf3714_2259_6a41_c730_30d5c2dc9945 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

codec-http2/src/main/java/io/netty/handler/codec/http2/DefaultHttp2FrameReader.java lines 695–724

        final void addFragment(ByteBuf fragment, int len, ByteBufAllocator alloc,
                boolean endOfHeaders) throws Http2Exception {
            if (headerBlock == null) {
                if (len > headersDecoder.configuration().maxHeaderListSizeGoAway()) {
                    headerSizeExceeded();
                }
                if (endOfHeaders) {
                    // Optimization - don't bother copying, just use the buffer as-is. Need
                    // to retain since we release when the header block is built.
                    headerBlock = fragment.readRetainedSlice(len);
                } else {
                    headerBlock = alloc.buffer(len).writeBytes(fragment, len);
                }
                return;
            }
            if (headersDecoder.configuration().maxHeaderListSizeGoAway() - len <
                    headerBlock.readableBytes()) {
                headerSizeExceeded();
            }
            if (headerBlock.isWritable(len)) {
                // The buffer can hold the requested bytes, just write it directly.
                headerBlock.writeBytes(fragment, len);
            } else {
                // Allocate a new buffer that is big enough to hold the entire header block so far.
                ByteBuf buf = alloc.buffer(headerBlock.readableBytes() + len);
                buf.writeBytes(headerBlock).writeBytes(fragment, len);
                headerBlock.release();
                headerBlock = buf;
            }
        }

Domain

Subdomains

Frequently Asked Questions

What does addFragment() do?
addFragment() is a function in the netty codebase, defined in codec-http2/src/main/java/io/netty/handler/codec/http2/DefaultHttp2FrameReader.java.
Where is addFragment() defined?
addFragment() is defined in codec-http2/src/main/java/io/netty/handler/codec/http2/DefaultHttp2FrameReader.java at line 695.
What does addFragment() call?
addFragment() calls 1 function(s): headerSizeExceeded.
What calls addFragment()?
addFragment() is called by 2 function(s): readHeadersFrame, readPushPromiseFrame.

Analyze Your Own Codebase

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

Try Supermodel Free