Home / Function/ decode() — netty Function Reference

decode() — netty Function Reference

Architecture documentation for the decode() function in Http3FrameCodec.java from the netty codebase.

Function java Buffer Allocators calls 4 called by 1

Entity Profile

Dependency Diagram

graph TD
  a9991e7a_1e1e_f455_19bd_4771a0c28625["decode()"]
  57499e74_1040_f300_12bb_215179e108be["Http3FrameCodec"]
  a9991e7a_1e1e_f455_19bd_4771a0c28625 -->|defined in| 57499e74_1040_f300_12bb_215179e108be
  83ad0216_00d7_4331_dd41_48405f09786c["decodeHeaders()"]
  83ad0216_00d7_4331_dd41_48405f09786c -->|calls| a9991e7a_1e1e_f455_19bd_4771a0c28625
  c751e13f_6797_7f70_b084_d0fd5fbd468f["isSuspended()"]
  a9991e7a_1e1e_f455_19bd_4771a0c28625 -->|calls| c751e13f_6797_7f70_b084_d0fd5fbd468f
  d0f8d7ea_8076_8153_91a0_088e231e99a1["skipBytes()"]
  a9991e7a_1e1e_f455_19bd_4771a0c28625 -->|calls| d0f8d7ea_8076_8153_91a0_088e231e99a1
  bc9d9e09_417f_cc2b_50ed_b48f93b8395c["connectionError()"]
  a9991e7a_1e1e_f455_19bd_4771a0c28625 -->|calls| bc9d9e09_417f_cc2b_50ed_b48f93b8395c
  8b0697bd_1098_91ad_7558_7e1c678364c7["decodeFrame()"]
  a9991e7a_1e1e_f455_19bd_4771a0c28625 -->|calls| 8b0697bd_1098_91ad_7558_7e1c678364c7
  style a9991e7a_1e1e_f455_19bd_4771a0c28625 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

codec-http3/src/main/java/io/netty/handler/codec/http3/Http3FrameCodec.java lines 155–213

    @Override
    protected void decode(ChannelHandlerContext ctx, ByteBuf in, List<Object> out) {
        assert readResumptionListener != null;
        if (!in.isReadable() || readResumptionListener.isSuspended()) {
            return;
        }
        if (error) {
            in.skipBytes(in.readableBytes());
            return;
        }
        if (type == -1) {
            int typeLen = numBytesForVariableLengthInteger(in.getByte(in.readerIndex()));
            if (in.readableBytes() < typeLen) {
                return;
            }
            long localType = readVariableLengthInteger(in, typeLen);
            if (Http3CodecUtils.isReservedHttp2FrameType(localType)) {
                // See https://tools.ietf.org/html/draft-ietf-quic-http-32#section-7.2.8
                connectionError(ctx, Http3ErrorCode.H3_FRAME_UNEXPECTED,
                        "Reserved type for HTTP/2 received.", true);
                return;
            }
            try {
                // Validate if the type is valid for the current stream first.
                validator.validate(localType, firstFrame);
            } catch (Http3Exception e) {
                connectionError(ctx, e, true);
                return;
            }
            type = localType;
            firstFrame = false;
            if (!in.isReadable()) {
                return;
            }
        }
        if (payLoadLength == -1) {
            int payloadLen = numBytesForVariableLengthInteger(in.getByte(in.readerIndex()));
            assert payloadLen <= 8;
            if (in.readableBytes() < payloadLen) {
                return;
            }
            long len = readVariableLengthInteger(in, payloadLen);
            if (len > Integer.MAX_VALUE) {
                connectionError(ctx, Http3ErrorCode.H3_EXCESSIVE_LOAD,
                        "Received an invalid frame len.", true);
                return;
            }
            payLoadLength = (int) len;
        }
        int read = decodeFrame(ctx, type, payLoadLength, in, out);
        if (read >= 0) {
            if (read == payLoadLength) {
                type = -1;
                payLoadLength = -1;
            } else {
                payLoadLength -= read;
            }
        }
    }

Domain

Subdomains

Called By

Frequently Asked Questions

What does decode() do?
decode() is a function in the netty codebase, defined in codec-http3/src/main/java/io/netty/handler/codec/http3/Http3FrameCodec.java.
Where is decode() defined?
decode() is defined in codec-http3/src/main/java/io/netty/handler/codec/http3/Http3FrameCodec.java at line 155.
What does decode() call?
decode() calls 4 function(s): connectionError, decodeFrame, isSuspended, skipBytes.
What calls decode()?
decode() is called by 1 function(s): decodeHeaders.

Analyze Your Own Codebase

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

Try Supermodel Free