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

public Class MarshallingDecoder

extends LengthFieldBasedFrameDecoder
Class Inheritance
Imports
io.netty.buffer.ByteBuf, io.netty.channel.ChannelHandlerContext, io.netty.handler.codec.LengthFieldBasedFrameDecoder, .TooLongFrameException, org.jboss.marshalling.ByteInput, .Unmarshaller, java.io.StreamCorruptedException

Decoder which MUST be used with MarshallingEncoder. A LengthFieldBasedFrameDecoder which use an Unmarshaller to read the Object out of the ByteBuf.

Field Summary

Modifier and TypeField and Description
private final UnmarshallerProvider

Constructor Summary

AccessConstructor and Description
public
MarshallingDecoder(UnmarshallerProvider provider)

Creates a new decoder whose maximum object size is 1048576 bytes.

public
MarshallingDecoder(UnmarshallerProvider provider, int
the maximum byte length of the serialized object. if the length of the received object is greater than this value, TooLongFrameException will be raised.
maxObjectSize
)

Creates a new decoder with the specified maximum object size.

Method Summary

Modifier and TypeMethod and Description
protected Object
decode(ChannelHandlerContext ctx, ByteBuf
the ByteBuf from which to read data
in
)

Overrides io.netty.handler.codec.LengthFieldBasedFrameDecoder.decode.

Create a frame out of the ByteBuf and return it.
protected ByteBuf
extractFrame(ChannelHandlerContext ctx, ByteBuf buffer, int index, int length)

Overrides io.netty.handler.codec.LengthFieldBasedFrameDecoder.extractFrame.

Extract the sub-region of the specified buffer.
Inherited from io.netty.handler.codec.LengthFieldBasedFrameDecoder:
decodegetUnadjustedFrameLength

Field Detail

providerback to summary
private final UnmarshallerProvider provider

Constructor Detail

MarshallingDecoderback to summary
public MarshallingDecoder(UnmarshallerProvider provider)

Creates a new decoder whose maximum object size is 1048576 bytes. If the size of the received object is greater than 1048576 bytes, a StreamCorruptedException will be raised.

MarshallingDecoderback to summary
public MarshallingDecoder(UnmarshallerProvider provider, int maxObjectSize)

Creates a new decoder with the specified maximum object size.

Parameters
maxObjectSize:int

the maximum byte length of the serialized object. if the length of the received object is greater than this value, TooLongFrameException will be raised.

Method Detail

decodeback to summary
protected Object decode(ChannelHandlerContext ctx, ByteBuf in) throws Exception

Overrides io.netty.handler.codec.LengthFieldBasedFrameDecoder.decode.

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

Create a frame out of the ByteBuf and return it.

Parameters
ctx:ChannelHandlerContext

the ChannelHandlerContext which this ByteToMessageDecoder belongs to

in:ByteBuf

the ByteBuf from which to read data

Returns:Object

frame the ByteBuf which represent the frame or null if no frame could be created.

Annotations
@Override
extractFrameback to summary
protected ByteBuf extractFrame(ChannelHandlerContext ctx, ByteBuf buffer, int index, int length)

Overrides io.netty.handler.codec.LengthFieldBasedFrameDecoder.extractFrame.

Doc from io.netty.handler.codec.LengthFieldBasedFrameDecoder.extractFrame.

Extract the sub-region of the specified buffer.

Annotations
@Override