Package org.drasyl.handler.codec
Class MaxLengthFrameEncoder
- java.lang.Object
-
- io.netty.channel.ChannelHandlerAdapter
-
- io.netty.channel.ChannelOutboundHandlerAdapter
-
- io.netty.handler.codec.MessageToMessageEncoder<io.netty.buffer.ByteBuf>
-
- org.drasyl.handler.codec.MaxLengthFrameEncoder
-
- All Implemented Interfaces:
io.netty.channel.ChannelHandler
,io.netty.channel.ChannelOutboundHandler
public class MaxLengthFrameEncoder extends io.netty.handler.codec.MessageToMessageEncoder<io.netty.buffer.ByteBuf>
An encoder that splits receivedByteBuf
s into frames not larger thenmaxFrameLength
. For example, if you received the following four fragmented packets:+---+----+-----+----+ | A | BC | DEF | GH | +---+----+-----+----+
AMaxLengthFrameEncoder
(2)
will encode them into the following three packets with the fixed length:+---+----+----+---+----+ | A | BC | DE | F | GH | +---+----+----+---+----+
-
-
Constructor Summary
Constructors Constructor Description MaxLengthFrameEncoder(int maxFrameLength)
Creates a new instance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
encode(io.netty.channel.ChannelHandlerContext ctx, io.netty.buffer.ByteBuf in, List<Object> out)
-
Methods inherited from class io.netty.handler.codec.MessageToMessageEncoder
acceptOutboundMessage, write
-
Methods inherited from class io.netty.channel.ChannelOutboundHandlerAdapter
bind, close, connect, deregister, disconnect, flush, read
-
Methods inherited from class io.netty.channel.ChannelHandlerAdapter
ensureNotSharable, exceptionCaught, handlerAdded, handlerRemoved, isSharable
-
-