public class CompatibleObjectEncoder extends MessageToByteEncoder<Object>
ByteBuf
(interoperability version).
This encoder is interoperable with the standard Java object streams such as
ObjectInputStream and ObjectOutputStream.
ChannelHandler.Sharable| 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(ChannelHandlerContext ctx,
Object msg,
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. |
flushnewOutboundBufferafterAdd, afterRemove, beforeAdd, beforeRemove, bind, close, connect, deregister, disconnect, exceptionCaught, userEventTriggeredclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitbind, close, connect, deregister, disconnectafterAdd, afterRemove, beforeAdd, beforeRemove, exceptionCaught, userEventTriggeredpublic 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.Exceptionpublic boolean isEncodable(Object msg) throws Exception
MessageToByteEncodertrue if and only if the specified message can be encoded by this encoder.isEncodable in class MessageToByteEncoder<Object>msg - the messageExceptionpublic void encode(ChannelHandlerContext ctx, Object msg, ByteBuf out) throws Exception
encode in class MessageToByteEncoder<Object>ExceptionCopyright © 2008-2012 The Netty Project. All Rights Reserved.