Buffer 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());
Buffer
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, Buffer ChannelHandlerContext which this MessageToMessageDecoder belongs tothe message to decode to another one msg)Overrides io. |
| ByteArrayDecoder | back to summary |
|---|---|
| public ByteArrayDecoder() | |
| decode | back to summary |
|---|---|
| protected void decode(ChannelHandlerContext ctx, Buffer msg) throws Exception Overrides io. Doc from io. Decode from one message to another. This method will be called for each written message that can be handled by this decoder. The message will be disposed of after this call.
Subclasses that wish to sometimes pass messages through, should instead override the
| |