public class CompatibleObjectEncoder extends OneToOneEncoder
ChannelBuffer
(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 |
---|---|
protected Object |
encode(ChannelHandlerContext context,
Channel channel,
Object msg)
Transforms the specified message into another message and return the
transformed message.
|
protected ObjectOutputStream |
newObjectOutputStream(OutputStream out)
Creates a new
ObjectOutputStream which wraps the specified
OutputStream . |
doEncode, handleDownstream
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 Object encode(ChannelHandlerContext context, Channel channel, Object msg) throws Exception
OneToOneEncoder
null
, unlike
you can in OneToOneDecoder.decode(ChannelHandlerContext, Channel, Object)
;
you must return something, at least ChannelBuffers.EMPTY_BUFFER
.encode
in class OneToOneEncoder
Exception
Copyright © 2008-2013 The Netty Project. All Rights Reserved.