public class CompatibleMarshallingDecoder extends ReplayingDecoder<Void>
ReplayingDecoder which use an Unmarshaller to read the Object out of the ByteBuf.
If you can you should use MarshallingDecoder.| Modifier and Type | Field and Description |
|---|---|
protected int |
maxObjectSize |
protected UnmarshallerProvider |
provider |
| Constructor and Description |
|---|
CompatibleMarshallingDecoder(UnmarshallerProvider provider,
int maxObjectSize)
Create a new instance of
CompatibleMarshallingDecoder. |
| Modifier and Type | Method and Description |
|---|---|
protected Object |
decode(io.netty.channel.ChannelHandlerContext ctx,
io.netty.buffer.ByteBuf buffer)
Decode the from one
ByteBuf to an other. |
protected Object |
decodeLast(io.netty.channel.ChannelHandlerContext ctx,
io.netty.buffer.ByteBuf buffer)
Is called one last time when the
ChannelHandlerContext goes in-active. |
void |
exceptionCaught(io.netty.channel.ChannelHandlerContext ctx,
Throwable cause) |
actualReadableBytes, callDecode, channelInactive, channelReadSuspended, checkpoint, checkpoint, discardInboundReadBytes, discardInboundReadBytes0, internalBuffer, newInboundBuffer, newInboundBuffer0, state, stateinboundBufferUpdated, isSingleDecode, setSingleDecodefreeInboundBuffer, inboundBufferUpdatedchannelActive, channelRegistered, channelUnregisteredafterAdd, afterRemove, beforeAdd, beforeRemove, userEventTriggeredclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitprotected final UnmarshallerProvider provider
protected final int maxObjectSize
public CompatibleMarshallingDecoder(UnmarshallerProvider provider, int maxObjectSize)
CompatibleMarshallingDecoder.provider - the UnmarshallerProvider which is used to obtain the Unmarshaller
for the ChannelmaxObjectSize - the maximal size (in bytes) of the Object to unmarshal. Once the size is
exceeded the Channel will get closed. Use a a maxObjectSize of
Integer.MAX_VALUE to disable this. You should only do this if you are sure
that the received Objects will never be big and the sending side are trusted, as this
opens the possibility for a DOS-Attack due an OutOfMemoryError.protected Object decode(io.netty.channel.ChannelHandlerContext ctx, io.netty.buffer.ByteBuf buffer) throws Exception
ByteToMessageDecoderByteBuf to an other. This method will be called till either the input
ByteBuf has nothing to read anymore, till nothing was read from the input ByteBuf or till
this method returns null.decode in class ByteToMessageDecoderctx - the ChannelHandlerContext which this ByteToByteDecoder belongs tobuffer - the ByteBuf from which to read dataByteBuf was decoded, or null if
there was not enough data left in the ByteBuf to decode.Exception - is thrown if an error accourprotected Object decodeLast(io.netty.channel.ChannelHandlerContext ctx, io.netty.buffer.ByteBuf buffer) throws Exception
ByteToMessageDecoderChannelHandlerContext goes in-active. Which means the
ByteToMessageDecoder.channelInactive(ChannelHandlerContext) was triggered.
By default this will just call ByteToMessageDecoder.decode(ChannelHandlerContext, ByteBuf) but sub-classes may
override this for some special cleanup operation.decodeLast in class ByteToMessageDecoderExceptionCopyright © 2008-2013 The Netty Project. All Rights Reserved.