channelRead0() — netty Function Reference
Architecture documentation for the channelRead0() function in TelnetServerHandler.java from the netty codebase.
Entity Profile
Dependency Diagram
graph TD d52d2ef4_bfda_64ad_afd6_81e209bad741["channelRead0()"] c0c87d15_7147_c286_6c43_c97fe9168b6f["TelnetServerHandler"] d52d2ef4_bfda_64ad_afd6_81e209bad741 -->|defined in| c0c87d15_7147_c286_6c43_c97fe9168b6f style d52d2ef4_bfda_64ad_afd6_81e209bad741 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
example/src/main/java/io/netty/example/telnet/TelnetServerHandler.java lines 41–64
@Override
public void channelRead0(ChannelHandlerContext ctx, String request) throws Exception {
// Generate and write a response.
String response;
boolean close = false;
if (request.isEmpty()) {
response = "Please type something.\r\n";
} else if ("bye".equals(request.toLowerCase())) {
response = "Have a good day!\r\n";
close = true;
} else {
response = "Did you say '" + request + "'?\r\n";
}
// We do not need to write a ChannelBuffer here.
// We know the encoder inserted at TelnetPipelineFactory will do the conversion.
ChannelFuture future = ctx.write(response);
// Close the connection after sending 'Have a good day!'
// if the client has sent 'bye'.
if (close) {
future.addListener(ChannelFutureListener.CLOSE);
}
}
Domain
Subdomains
Source
Frequently Asked Questions
What does channelRead0() do?
channelRead0() is a function in the netty codebase, defined in example/src/main/java/io/netty/example/telnet/TelnetServerHandler.java.
Where is channelRead0() defined?
channelRead0() is defined in example/src/main/java/io/netty/example/telnet/TelnetServerHandler.java at line 41.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free