nettynetty4

Why does ChannelOutboundHandlerAdapter have a read method if it s means for outbound IO operations


As far as I understand, in Netty ChannelOutboundHandlerAdapter is meant for outbound IO operations: that is writes, but a class implementing ChannelOutboundHandlerAdapter can also implement a read method, which seems incorrect to me, why should a component meant for writing have a read method.

The opposite component, that is ChannelInboundHandlerAdapter which is meant for inbound IO operations, ie reads, does not have a write method. This sounds correct.

Why does ChannelOutboundHandlerAdapter makes it possible to implement a read method if it is supposed to push data out of the pipeline?


Solution

  • read() signals the willingness to read something from the socket as soon as there is something that can be read. It basically tells netty that we should do a read at some point.