ByteBuf into an array of bytes.
A typical setup for TCP/IP would be:
and then you can use an array of bytes instead of aChannelPipelinepipeline = ...; // Decoders pipeline.addLast("frameDecoder", newLengthFieldBasedFrameDecoder(1048576, 0, 4, 0, 4)); pipeline.addLast("bytesDecoder", newByteArrayDecoder()); // Encoder pipeline.addLast("frameEncoder", newLengthFieldPrepender(4)); pipeline.addLast("bytesEncoder", newByteArrayEncoder());
ByteBuf
as a message:
void channelRead(ChannelHandlerContext ctx, byte[] bytes) {
...
}
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| protected void | decode(ChannelHandlerContext
the ctx, ByteBuf ChannelHandlerContext which this MessageToMessageDecoder belongs tothe message to decode to an other one msg, List<Object> the out)List to which decoded messages should be addedImplements abstract io. |
| ByteArrayDecoder | back to summary |
|---|---|
| public ByteArrayDecoder() | |
| decode | back to summary |
|---|---|
| protected void decode(ChannelHandlerContext ctx, ByteBuf msg, List<Object> out) throws Exception Implements abstract io. Doc from io. Decode from one message to an other. This method will be called for each written message that can be handled by this decoder.
| |