public class ObjectDecoder
extends io.netty.handler.codec.LengthFieldBasedFrameDecoder
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.
Unless there's a requirement for the interoperability with the standard
object streams, it is recommended to use ObjectEncoder
and
ObjectDecoder
rather than CompatibleObjectEncoder
.
Modifier and Type | Field and Description |
---|---|
static long |
MAX_LOB_SIZE |
Constructor and Description |
---|
ObjectDecoder(int maxObjectSize,
long maxLobSize,
ClassLoader classLoader,
StorageManager storageManager)
Creates a new decoder with the specified maximum object size.
|
Modifier and Type | Method and Description |
---|---|
protected Object |
decode(io.netty.channel.ChannelHandlerContext ctx,
io.netty.buffer.ByteBuf buffer) |
protected io.netty.buffer.ByteBuf |
extractFrame(io.netty.channel.ChannelHandlerContext ctx,
io.netty.buffer.ByteBuf buffer,
int index,
int length) |
decode, getUnadjustedFrameLength
actualReadableBytes, callDecode, channelInactive, channelRead, channelReadComplete, decodeLast, discardSomeReadBytes, handlerRemoved, handlerRemoved0, internalBuffer, isSingleDecode, setCumulator, setDiscardAfterReads, setSingleDecode, userEventTriggered
channelActive, channelRegistered, channelUnregistered, channelWritabilityChanged, exceptionCaught
ensureNotSharable, handlerAdded, isSharable
public static final long MAX_LOB_SIZE
public ObjectDecoder(int maxObjectSize, long maxLobSize, ClassLoader classLoader, StorageManager storageManager)
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.classLoader
- the ClassLoader
which will load the class
of the serialized objectprotected Object decode(io.netty.channel.ChannelHandlerContext ctx, io.netty.buffer.ByteBuf buffer) throws Exception
decode
in class io.netty.handler.codec.LengthFieldBasedFrameDecoder
Exception
protected io.netty.buffer.ByteBuf extractFrame(io.netty.channel.ChannelHandlerContext ctx, io.netty.buffer.ByteBuf buffer, int index, int length)
extractFrame
in class io.netty.handler.codec.LengthFieldBasedFrameDecoder
Copyright © 2020. All rights reserved.