Home / Function/ channelRead0() — netty Function Reference

channelRead0() — netty Function Reference

Architecture documentation for the channelRead0() function in SctpEchoTest.java from the netty codebase.

Entity Profile

Dependency Diagram

graph TD
  4efdecc1_37b1_7a22_5b06_a28327dcd4d2["channelRead0()"]
  11e0fb23_27b6_3742_38d9_f1300b3170cc["EchoHandler"]
  4efdecc1_37b1_7a22_5b06_a28327dcd4d2 -->|defined in| 11e0fb23_27b6_3742_38d9_f1300b3170cc
  style 4efdecc1_37b1_7a22_5b06_a28327dcd4d2 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

testsuite/src/main/java/io/netty/testsuite/transport/sctp/SctpEchoTest.java lines 165–182

        @Override
        public void channelRead0(ChannelHandlerContext ctx, ByteBuf in) throws Exception {
            byte[] actual = new byte[in.readableBytes()];
            in.readBytes(actual);

            int lastIdx = counter;
            for (int i = 0; i < actual.length; i++) {
                assertEquals(data[i + lastIdx], actual[i]);
            }

            // Update the counter before calling write(...) as write could in theory trigger another channelRead(...)
            // which then would use the wrong lastIdx.
            counter += actual.length;

            if (channel.parent() != null) {
                channel.writeAndFlush(randomBufferType(channel.alloc(), actual, 0, actual.length));
            }
        }

Domain

Subdomains

Frequently Asked Questions

What does channelRead0() do?
channelRead0() is a function in the netty codebase, defined in testsuite/src/main/java/io/netty/testsuite/transport/sctp/SctpEchoTest.java.
Where is channelRead0() defined?
channelRead0() is defined in testsuite/src/main/java/io/netty/testsuite/transport/sctp/SctpEchoTest.java at line 165.

Analyze Your Own Codebase

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

Try Supermodel Free