@Deprecated public class CompatibleObjectEncoder extends MessageToByteEncoder<Serializable>
ByteBuf
(interoperability version).
This encoder is interoperable with the standard Java object streams such as
ObjectInputStream
and ObjectOutputStream
.
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.
ChannelHandler.Sharable
Constructor and Description |
---|
CompatibleObjectEncoder()
Deprecated.
Creates a new instance with the reset interval of
16 . |
CompatibleObjectEncoder(int resetInterval)
Deprecated.
Creates a new instance.
|
Modifier and Type | Method and Description |
---|---|
protected void |
encode(ChannelHandlerContext ctx,
Serializable msg,
ByteBuf out)
Deprecated.
Encode a message into a
ByteBuf . |
protected ObjectOutputStream |
newObjectOutputStream(OutputStream out)
Deprecated.
Creates a new
ObjectOutputStream which wraps the specified
OutputStream . |
acceptOutboundMessage, allocateBuffer, isPreferDirect, write
bind, close, connect, deregister, disconnect, flush, read
ensureNotSharable, exceptionCaught, handlerAdded, handlerRemoved, isSharable
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
exceptionCaught, handlerAdded, handlerRemoved
public CompatibleObjectEncoder()
16
.public CompatibleObjectEncoder(int resetInterval)
resetInterval
- the number of objects between ObjectOutputStream.reset()
.
0
will disable resetting the stream, but the remote
peer will be at the risk of getting OutOfMemoryError
in
the long term.protected ObjectOutputStream newObjectOutputStream(OutputStream out) throws Exception
ObjectOutputStream
which wraps the specified
OutputStream
. Override this method to use a subclass of the
ObjectOutputStream
.Exception
protected void encode(ChannelHandlerContext ctx, Serializable msg, ByteBuf out) throws Exception
MessageToByteEncoder
ByteBuf
. This method will be called for each written message that can be handled
by this encoder.encode
in class MessageToByteEncoder<Serializable>
ctx
- the ChannelHandlerContext
which this MessageToByteEncoder
belongs tomsg
- the message to encodeout
- the ByteBuf
into which the encoded message will be writtenException
- is thrown if an error occursCopyright © 2008–2024 The Netty Project. All rights reserved.