@Deprecated public class ObjectDecoder extends LengthFieldBasedFrameDecoder
ByteBuf
s into Java
objects.
Please note that the serialized form this decoder expects is not
compatible with the standard ObjectOutputStream
. Please use
ObjectEncoder
or ObjectEncoderOutputStream
to ensure the
interoperability with this decoder.
Security: serialization can be a security liability, and should not be used without defining a list of classes that are allowed to be desirialized. Such a list can be specified with the jdk.serialFilter system property, for instance. See the serialization filtering article for more information.
ByteToMessageDecoder.Cumulator
ChannelHandler.Sharable
COMPOSITE_CUMULATOR, MERGE_CUMULATOR
构造器和说明 |
---|
ObjectDecoder(ClassResolver classResolver)
已过时。
Creates a new decoder whose maximum object size is
1048576
bytes. |
ObjectDecoder(int maxObjectSize,
ClassResolver classResolver)
已过时。
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. |
decode, extractFrame, getUnadjustedFrameLength
actualReadableBytes, callDecode, channelInactive, channelRead, channelReadComplete, decodeLast, discardSomeReadBytes, handlerRemoved, handlerRemoved0, internalBuffer, isSingleDecode, setCumulator, setDiscardAfterReads, setSingleDecode, userEventTriggered
channelActive, channelRegistered, channelUnregistered, channelWritabilityChanged, exceptionCaught
ensureNotSharable, handlerAdded, isSharable
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
handlerAdded
public ObjectDecoder(ClassResolver classResolver)
1048576
bytes. If the size of the received object is greater than
1048576
bytes, a StreamCorruptedException
will be
raised.classResolver
- the ClassResolver
to use for this decoderpublic ObjectDecoder(int maxObjectSize, ClassResolver classResolver)
maxObjectSize
- the maximum byte length of the serialized object.
if the length of the received object is greater
than this value, StreamCorruptedException
will be raised.classResolver
- the ClassResolver
which will load the class
of the serialized objectprotected java.lang.Object decode(ChannelHandlerContext ctx, ByteBuf in) throws java.lang.Exception
LengthFieldBasedFrameDecoder
ByteBuf
and return it.decode
在类中 LengthFieldBasedFrameDecoder
ctx
- 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.Exception