I'm extending ChannelInboundHandlerAdapter and would like to read the exact number of bytes.
public class Reader extends ChannelInboundHandlerAdapter{ @Override public void channelRead(ChannelHandlerContext ctx, Object msg){ ByteBuf b = (ByteBuf) msg; byte size = b.readByte(); //Now I want to read exactly size bytes from the channel //and then again read the number of bytes and read the bytes... } } The issue is it may happen that we read less then required bytes from ByteBuf. How to read more from the Channel?