Home / Function/ channelRead0() — netty Function Reference

channelRead0() — netty Function Reference

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

Entity Profile

Dependency Diagram

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

Relationship Graph

Source Code

testsuite/src/main/java/io/netty/testsuite/transport/socket/SocketFixedLengthEchoTest.java lines 162–181

        @Override
        public void channelRead0(ChannelHandlerContext ctx, ByteBuf msg) throws Exception {
            assertEquals(1024, msg.readableBytes());

            byte[] actual = new byte[msg.readableBytes()];
            msg.getBytes(msg.readerIndex(), 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(msg.retain());
            }
        }

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

Analyze Your Own Codebase

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

Try Supermodel Free