public class CompatibleMarshallingDecoder extends ReplayingDecoder<VoidEnum>
ReplayingDecoder which use an Unmarshaller to read the Object out of the ChannelBuffer.
If you can you should use MarshallingDecoder.ChannelHandler.Sharable| 限定符和类型 | 字段和说明 |
|---|---|
protected int |
maxObjectSize |
protected UnmarshallerProvider |
provider |
cumulation, DEFAULT_MAX_COMPOSITEBUFFER_COMPONENTS| 构造器和说明 |
|---|
CompatibleMarshallingDecoder(UnmarshallerProvider provider,
int maxObjectSize)
Create a new instance of
CompatibleMarshallingDecoder. |
| 限定符和类型 | 方法和说明 |
|---|---|
protected java.lang.Object |
decode(ChannelHandlerContext ctx,
Channel channel,
ChannelBuffer buffer,
VoidEnum state)
Decodes the received packets so far into a frame.
|
protected java.lang.Object |
decodeLast(ChannelHandlerContext ctx,
Channel channel,
ChannelBuffer buffer,
VoidEnum state)
Decodes the received data so far into a frame when the channel is
disconnected.
|
void |
exceptionCaught(ChannelHandlerContext ctx,
ExceptionEvent e)
Calls
Channel.close() if a TooLongFrameException was thrown |
checkpoint, checkpoint, cleanup, decode, decodeLast, getState, internalBuffer, messageReceived, setStateactualReadableBytes, afterAdd, afterRemove, appendToCumulation, beforeAdd, beforeRemove, channelClosed, channelDisconnected, extractFrame, getMaxCumulationBufferCapacity, getMaxCumulationBufferComponents, isUnfold, newCumulationBuffer, replace, setMaxCumulationBufferCapacity, setMaxCumulationBufferComponents, setUnfold, unfoldAndFireMessageReceived, updateCumulationchannelBound, channelConnected, channelInterestChanged, channelOpen, channelUnbound, childChannelClosed, childChannelOpen, handleUpstream, writeCompleteprotected 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 java.lang.Object decode(ChannelHandlerContext ctx, Channel channel, ChannelBuffer buffer, VoidEnum state) throws java.lang.Exception
ReplayingDecoderdecode 在类中 ReplayingDecoder<VoidEnum>ctx - the context of this handlerchannel - the current channelbuffer - the cumulative buffer of received packets so far.
Note that the buffer might be empty, which means you
should not make an assumption that the buffer contains
at least one byte in your decoder implementation.state - the current decoder state (null if unused)java.lang.Exceptionprotected java.lang.Object decodeLast(ChannelHandlerContext ctx, Channel channel, ChannelBuffer buffer, VoidEnum state) throws java.lang.Exception
ReplayingDecoderdecodeLast 在类中 ReplayingDecoder<VoidEnum>ctx - the context of this handlerchannel - the current channelbuffer - the cumulative buffer of received packets so far.
Note that the buffer might be empty, which means you
should not make an assumption that the buffer contains
at least one byte in your decoder implementation.state - the current decoder state (null if unused)java.lang.Exceptionpublic void exceptionCaught(ChannelHandlerContext ctx, ExceptionEvent e) throws java.lang.Exception
Channel.close() if a TooLongFrameException was thrownexceptionCaught 在类中 FrameDecoderjava.lang.Exception