public class MarshallingDecoder extends LengthFieldBasedFrameDecoder
MarshallingEncoder.
A LengthFieldBasedFrameDecoder which use an Unmarshaller to read the Object out
of the ByteBuf.ByteToMessageDecoder.CumulatorChannelHandler.SharableCOMPOSITE_CUMULATOR, MERGE_CUMULATOR| 构造器和说明 |
|---|
MarshallingDecoder(UnmarshallerProvider provider)
Creates a new decoder whose maximum object size is
1048576
bytes. |
MarshallingDecoder(UnmarshallerProvider provider,
int maxObjectSize)
Creates a new decoder with the specified maximum object size.
|
| 限定符和类型 | 方法和说明 |
|---|---|
protected java.lang.Object |
decode(ChannelHandlerContext ctx,
ByteBuf in)
Create a frame out of the
ByteBuf and return it. |
protected ByteBuf |
extractFrame(ChannelHandlerContext ctx,
ByteBuf buffer,
int index,
int length)
Extract the sub-region of the specified buffer.
|
decode, getUnadjustedFrameLengthactualReadableBytes, callDecode, channelInactive, channelRead, channelReadComplete, decodeLast, discardSomeReadBytes, handlerRemoved, handlerRemoved0, internalBuffer, isSingleDecode, setCumulator, setDiscardAfterReads, setSingleDecode, userEventTriggeredchannelActive, channelRegistered, channelUnregistered, channelWritabilityChanged, exceptionCaughtensureNotSharable, handlerAdded, isSharableclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waithandlerAddedpublic MarshallingDecoder(UnmarshallerProvider provider)
1048576
bytes. If the size of the received object is greater than
1048576 bytes, a StreamCorruptedException will be
raised.public MarshallingDecoder(UnmarshallerProvider provider, int maxObjectSize)
maxObjectSize - the maximum byte length of the serialized object.
if the length of the received object is greater
than this value, TooLongFrameException
will be raised.protected java.lang.Object decode(ChannelHandlerContext ctx, ByteBuf in) throws java.lang.Exception
LengthFieldBasedFrameDecoderByteBuf and return it.decode 在类中 LengthFieldBasedFrameDecoderctx - the ChannelHandlerContext which this ByteToMessageDecoder belongs toin - the ByteBuf from which to read dataByteBuf which represent the frame or null if no frame could
be created.java.lang.Exceptionprotected ByteBuf extractFrame(ChannelHandlerContext ctx, ByteBuf buffer, int index, int length)
LengthFieldBasedFrameDecoder