Top Description Fields Constructors Methods
io.netty.handler.codec.marshalling

public Class CompatibleMarshallingDecoder

extends ReplayingDecoder<Void>
Class Inheritance
Imports
io.netty.buffer.ByteBuf, io.netty.channel.Channel, .ChannelHandlerContext, io.netty.handler.codec.ReplayingDecoder, .TooLongFrameException, org.jboss.marshalling.ByteInput, .Unmarshaller, java.io.ObjectStreamConstants, java.util.List

ReplayingDecoder which use an Unmarshaller to read the Object out of the ByteBuf. If you can you should use MarshallingDecoder.

Field Summary

Modifier and TypeField and Description
private boolean
protected final int
protected final UnmarshallerProvider

Constructor Summary

AccessConstructor and Description
public
CompatibleMarshallingDecoder(UnmarshallerProvider
the UnmarshallerProvider which is used to obtain the Unmarshaller for the Channel
provider
,
int
the maximal size (in bytes) of the Object to unmarshal. Once the size is exceeded the Channel will get closed. Use 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.
maxObjectSize
)

Create a new instance of CompatibleMarshallingDecoder.

Method Summary

Modifier and TypeMethod and Description
protected void
decode(ChannelHandlerContext ctx, ByteBuf
the ByteBuf from which to read data
buffer
,
List<Object>
the List to which decoded messages should be added
out
)

Implements abstract io.netty.handler.codec.ByteToMessageDecoder.decode.

Decode the from one ByteBuf to an other.
protected void
decodeLast(ChannelHandlerContext ctx, ByteBuf buffer, List<Object> out)

Overrides io.netty.handler.codec.ByteToMessageDecoder.decodeLast.

Is called one last time when the ChannelHandlerContext goes in-active.
public void
Inherited from io.netty.handler.codec.ReplayingDecoder:
callDecodecheckpointcheckpointstatestate

Field Detail

discardingTooLongFrameback to summary
private boolean discardingTooLongFrame
maxObjectSizeback to summary
protected final int maxObjectSize
providerback to summary
protected final UnmarshallerProvider provider

Constructor Detail

CompatibleMarshallingDecoderback to summary
public CompatibleMarshallingDecoder(UnmarshallerProvider provider, int maxObjectSize)

Create a new instance of CompatibleMarshallingDecoder.

Parameters
provider:UnmarshallerProvider

the UnmarshallerProvider which is used to obtain the Unmarshaller for the Channel

maxObjectSize:int

the maximal size (in bytes) of the Object to unmarshal. Once the size is exceeded the Channel will get closed. Use 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.

Method Detail

decodeback to summary
protected void decode(ChannelHandlerContext ctx, ByteBuf buffer, List<Object> out) throws Exception

Implements abstract io.netty.handler.codec.ByteToMessageDecoder.decode.

Doc from io.netty.handler.codec.ByteToMessageDecoder.decode.

Decode the from one ByteBuf to an other. This method will be called till either the input ByteBuf has nothing to read when return from this method or till nothing was read from the input ByteBuf.

Parameters
ctx:ChannelHandlerContext

the ChannelHandlerContext which this ByteToMessageDecoder belongs to

buffer:ByteBuf

the ByteBuf from which to read data

out:List<Object>

the List to which decoded messages should be added

Annotations
@Override
Exceptions
Exception:
is thrown if an error occurs
decodeLastback to summary
protected void decodeLast(ChannelHandlerContext ctx, ByteBuf buffer, List<Object> out) throws Exception

Overrides io.netty.handler.codec.ByteToMessageDecoder.decodeLast.

Doc from io.netty.handler.codec.ByteToMessageDecoder.decodeLast.

Is called one last time when the ChannelHandlerContext goes in-active. Which means the channelInactive(ChannelHandlerContext) was triggered. By default, this will just call decode(ChannelHandlerContext, ByteBuf, List) but sub-classes may override this for some special cleanup operation.

Annotations
@Override
exceptionCaughtback to summary
public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) throws Exception

Overrides io.netty.channel.ChannelInboundHandlerAdapter.exceptionCaught.

Implements io.netty.channel.ChannelInboundHandler.exceptionCaught, io.netty.channel.ChannelHandler.exceptionCaught.

Doc from io.netty.channel.ChannelInboundHandlerAdapter.exceptionCaught.

Calls ChannelHandlerContext#fireExceptionCaught(Throwable) to forward to the next ChannelHandler in the ChannelPipeline. Sub-classes may override this method to change behavior.

Annotations
@Override