Home / Function/ channelRead0() — netty Function Reference

channelRead0() — netty Function Reference

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

Entity Profile

Dependency Diagram

graph TD
  25d1201e_2f24_0096_c709_2fe3d9d74eaf["channelRead0()"]
  3749a47f_5fb1_e195_228f_ad68473b86f5["EchoHandler"]
  25d1201e_2f24_0096_c709_2fe3d9d74eaf -->|defined in| 3749a47f_5fb1_e195_228f_ad68473b86f5
  style 25d1201e_2f24_0096_c709_2fe3d9d74eaf fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

testsuite/src/main/java/io/netty/testsuite/transport/socket/SocketEchoTest.java lines 273–290

        @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.write(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/socket/SocketEchoTest.java.
Where is channelRead0() defined?
channelRead0() is defined in testsuite/src/main/java/io/netty/testsuite/transport/socket/SocketEchoTest.java at line 273.

Analyze Your Own Codebase

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

Try Supermodel Free