public class ByteArrayEncoder
extends io.netty.channel.ChannelOutboundMessageHandlerAdapter<byte[]>
ByteBuf.
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 messageReceived(ChannelHandlerContext ctx, byte[] bytes) {
...
}
| Constructor and Description |
|---|
ByteArrayEncoder(io.netty.buffer.BufType nextBufferType) |
| Modifier and Type | Method and Description |
|---|---|
protected void |
flush(io.netty.channel.ChannelHandlerContext ctx,
byte[] msg) |
acceptOutboundMessage, beginFlush, endFlush, flush, freeOutboundBuffer, isCloseOnFailedFlush, newOutboundBuffer, setCloseOnFailedFlushbind, close, connect, deregister, disconnect, read, sendFileafterAdd, afterRemove, beforeAdd, beforeRemove, exceptionCaught, userEventTriggeredclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitCopyright © 2008-2013 The Netty Project. All Rights Reserved.