Home / Function/ callDecode() — netty Function Reference

callDecode() — netty Function Reference

Architecture documentation for the callDecode() function in ReplayingDecoder.java from the netty codebase.

Function java Buffer Allocators calls 1 called by 1

Entity Profile

Dependency Diagram

graph TD
  7a42f676_96b8_04a7_cf0b_eebac0c66323["callDecode()"]
  acf0308a_b3b3_8956_f20c_c96385b17313["ReplayingDecoder"]
  7a42f676_96b8_04a7_cf0b_eebac0c66323 -->|defined in| acf0308a_b3b3_8956_f20c_c96385b17313
  b8aef1bf_3001_84ff_42a1_fff6ca05d0a5["channelInputClosed()"]
  b8aef1bf_3001_84ff_42a1_fff6ca05d0a5 -->|calls| 7a42f676_96b8_04a7_cf0b_eebac0c66323
  269d1be6_3bb8_27dd_4d77_4a89ee02cca4["checkpoint()"]
  7a42f676_96b8_04a7_cf0b_eebac0c66323 -->|calls| 269d1be6_3bb8_27dd_4d77_4a89ee02cca4
  style 7a42f676_96b8_04a7_cf0b_eebac0c66323 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

codec-base/src/main/java/io/netty/handler/codec/ReplayingDecoder.java lines 340–423

    @Override
    protected void callDecode(ChannelHandlerContext ctx, ByteBuf in, List<Object> out) {
        replayable.setCumulation(in);
        try {
            while (in.isReadable()) {
                int oldReaderIndex = checkpoint = in.readerIndex();
                int outSize = out.size();

                if (outSize > 0) {
                    fireChannelRead(ctx, out, outSize);
                    out.clear();

                    // Check if this handler was removed before continuing with decoding.
                    // If it was removed, it is not safe to continue to operate on the buffer.
                    //
                    // See:
                    // - https://github.com/netty/netty/issues/4635
                    if (ctx.isRemoved()) {
                        break;
                    }
                    outSize = 0;
                }

                S oldState = state;
                int oldInputLength = in.readableBytes();
                try {
                    decodeRemovalReentryProtection(ctx, replayable, out);

                    // Check if this handler was removed before continuing the loop.
                    // If it was removed, it is not safe to continue to operate on the buffer.
                    //
                    // See https://github.com/netty/netty/issues/1664
                    if (ctx.isRemoved()) {
                        break;
                    }

                    if (outSize == out.size()) {
                        if (oldInputLength == in.readableBytes() && oldState == state) {
                            throw new DecoderException(
                                    StringUtil.simpleClassName(getClass()) + ".decode() must consume the inbound " +
                                    "data or change its state if it did not decode anything.");
                        } else {
                            // Previous data has been discarded or caused state transition.
                            // Probably it is reading on.
                            continue;
                        }
                    }
                } catch (Signal replay) {
                    replay.expect(REPLAY);

                    // Check if this handler was removed before continuing the loop.
                    // If it was removed, it is not safe to continue to operate on the buffer.
                    //
                    // See https://github.com/netty/netty/issues/1664
                    if (ctx.isRemoved()) {
                        break;
                    }

                    // Return to the checkpoint (or oldPosition) and retry.
                    int checkpoint = this.checkpoint;
                    if (checkpoint >= 0) {
                        in.readerIndex(checkpoint);
                    } else {
                        // Called by cleanup() - no need to maintain the readerIndex
                        // anymore because the buffer has been released already.
                    }
                    break;
                }

                if (oldReaderIndex == in.readerIndex() && oldState == state) {
                    throw new DecoderException(
                           StringUtil.simpleClassName(getClass()) + ".decode() method must consume the inbound data " +
                           "or change its state if it decoded something.");
                }
                if (isSingleDecode()) {
                    break;
                }
            }
        } catch (DecoderException e) {
            throw e;
        } catch (Exception cause) {

Domain

Subdomains

Calls

Frequently Asked Questions

What does callDecode() do?
callDecode() is a function in the netty codebase, defined in codec-base/src/main/java/io/netty/handler/codec/ReplayingDecoder.java.
Where is callDecode() defined?
callDecode() is defined in codec-base/src/main/java/io/netty/handler/codec/ReplayingDecoder.java at line 340.
What does callDecode() call?
callDecode() calls 1 function(s): checkpoint.
What calls callDecode()?
callDecode() is called by 1 function(s): channelInputClosed.

Analyze Your Own Codebase

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

Try Supermodel Free