public class CompatibleObjectEncoder extends MessageToByteEncoder<Object>
ByteBuf
(interoperability version).
This encoder is interoperable with the standard Java object streams such as
ObjectInputStream
and ObjectOutputStream
.
Constructor and Description |
---|
CompatibleObjectEncoder()
Creates a new instance with the reset interval of
16 . |
CompatibleObjectEncoder(int resetInterval)
Creates a new instance.
|
Modifier and Type | Method and Description |
---|---|
void |
encode(io.netty.channel.ChannelHandlerContext ctx,
Object msg,
io.netty.buffer.ByteBuf out) |
boolean |
isEncodable(Object msg)
Returns
true if and only if the specified message can be encoded by this encoder. |
protected ObjectOutputStream |
newObjectOutputStream(OutputStream out)
Creates a new
ObjectOutputStream which wraps the specified
OutputStream . |
flush
newOutboundBuffer
afterAdd, afterRemove, beforeAdd, beforeRemove, bind, close, connect, deregister, disconnect, exceptionCaught, userEventTriggered
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
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
public boolean isEncodable(Object msg) throws Exception
MessageToByteEncoder
true
if and only if the specified message can be encoded by this encoder.isEncodable
in class MessageToByteEncoder<Object>
msg
- the messageException
Copyright © 2008-2012 The Netty Project. All Rights Reserved.