Home / Function/ decode() — netty Function Reference

decode() — netty Function Reference

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

Entity Profile

Dependency Diagram

graph TD
  c1590bf2_98a5_65af_00fb_ead73b9ba31d["decode()"]
  f7621757_c495_a067_dbd2_54254d637829["ProtobufVarint32FrameDecoder"]
  c1590bf2_98a5_65af_00fb_ead73b9ba31d -->|defined in| f7621757_c495_a067_dbd2_54254d637829
  bf8c8c02_e669_17c5_7fe4_cb9b825ddb69["readRawVarint32()"]
  c1590bf2_98a5_65af_00fb_ead73b9ba31d -->|calls| bf8c8c02_e669_17c5_7fe4_cb9b825ddb69
  style c1590bf2_98a5_65af_00fb_ead73b9ba31d fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

codec-protobuf/src/main/java/io/netty/handler/codec/protobuf/ProtobufVarint32FrameDecoder.java lines 48–66

    @Override
    protected void decode(ChannelHandlerContext ctx, ByteBuf in, List<Object> out)
            throws Exception {
        in.markReaderIndex();
        int preIndex = in.readerIndex();
        int length = readRawVarint32(in);
        if (preIndex == in.readerIndex()) {
            return;
        }
        if (length < 0) {
            throw new CorruptedFrameException("negative length: " + length);
        }

        if (in.readableBytes() < length) {
            in.resetReaderIndex();
        } else {
            out.add(in.readRetainedSlice(length));
        }
    }

Domain

Subdomains

Frequently Asked Questions

What does decode() do?
decode() is a function in the netty codebase, defined in codec-protobuf/src/main/java/io/netty/handler/codec/protobuf/ProtobufVarint32FrameDecoder.java.
Where is decode() defined?
decode() is defined in codec-protobuf/src/main/java/io/netty/handler/codec/protobuf/ProtobufVarint32FrameDecoder.java at line 48.
What does decode() call?
decode() calls 1 function(s): readRawVarint32.

Analyze Your Own Codebase

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

Try Supermodel Free