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| 构造器和说明 |
|---|
CompatibleObjectEncoder()
Creates a new instance with the reset interval of
16. |
CompatibleObjectEncoder(int resetInterval)
Creates a new instance.
|
| 限定符和类型 | 方法和说明 |
|---|---|
protected java.lang.Object |
encode(ChannelHandlerContext context,
Channel channel,
java.lang.Object msg)
Transforms the specified message into another message and return the
transformed message.
|
protected java.io.ObjectOutputStream |
newObjectOutputStream(java.io.OutputStream out)
Creates a new
ObjectOutputStream which wraps the specified
OutputStream. |
doEncode, handleDownstreampublic 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 java.io.ObjectOutputStream newObjectOutputStream(java.io.OutputStream out)
throws java.lang.Exception
ObjectOutputStream which wraps the specified
OutputStream. Override this method to use a subclass of the
ObjectOutputStream.java.lang.Exceptionprotected java.lang.Object encode(ChannelHandlerContext context, Channel channel, java.lang.Object msg) throws java.lang.Exception
OneToOneEncodernull, unlike
you can in OneToOneDecoder.decode(ChannelHandlerContext, Channel, Object);
you must return something, at least ChannelBuffers.EMPTY_BUFFER.encode 在类中 OneToOneEncoderjava.lang.Exception