Class ByteArrayDecoder

All Implemented Interfaces:
ChannelHandler, ChannelInboundHandler

public class ByteArrayDecoder extends MessageToMessageDecoder<ByteBuf>
Decodes a received ByteBuf into an array of bytes. A typical setup for TCP/IP would be:
ChannelPipeline pipeline = ...;

// Decoders
pipeline.addLast("frameDecoder",
                 new LengthFieldBasedFrameDecoder(1048576, 0, 4, 0, 4));
pipeline.addLast("bytesDecoder",
                 new ByteArrayDecoder());

// Encoder
pipeline.addLast("frameEncoder", new LengthFieldPrepender(4));
pipeline.addLast("bytesEncoder", new ByteArrayEncoder());
and then you can use an array of bytes instead of a ByteBuf as a message:
void channelRead(ChannelHandlerContext ctx, byte[] bytes) {
    ...
}