public class CompatibleObjectEncoder extends MessageToByteEncoder<java.io.Serializable>
ByteBuf (互操作性版本)的编码器。
该编码器可与标准Java对象流(如ObjectInputStream和ObjectOutputStream )互操作。
ChannelHandler.Sharable| Constructor and Description |
|---|
CompatibleObjectEncoder()
创建一个重置间隔为
16的新实例。
|
CompatibleObjectEncoder(int resetInterval)
创建一个新的实例。
|
| Modifier and Type | Method and Description |
|---|---|
protected void |
encode(ChannelHandlerContext ctx, java.io.Serializable msg, ByteBuf out)
将消息编码成 ByteBuf 。
|
protected java.io.ObjectOutputStream |
newObjectOutputStream(java.io.OutputStream out)
创建一个新
ObjectOutputStream它包装指定的
OutputStream 。
|
acceptOutboundMessage, allocateBuffer, isPreferDirect, writebind, close, connect, deregister, disconnect, flush, readensureNotSharable, exceptionCaught, handlerAdded, handlerRemoved, isSharableclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitexceptionCaught, handlerAdded, handlerRemovedpublic CompatibleObjectEncoder()
16的新实例。
public CompatibleObjectEncoder(int resetInterval)
resetInterval - ObjectOutputStream.reset()之间的对象ObjectOutputStream.reset() 。
0将禁用重置流,但远程对等体长期处于OutOfMemoryError的风险。
protected java.io.ObjectOutputStream newObjectOutputStream(java.io.OutputStream out)
throws java.lang.Exception
ObjectOutputStream它包装指定的OutputStream 。
重写此方法以使用ObjectOutputStream的子类。
java.lang.Exception
protected void encode(ChannelHandlerContext ctx, java.io.Serializable msg, ByteBuf out) throws java.lang.Exception
MessageToByteEncoder
ByteBuf 。
这个方法将被编码器处理的每个书面信息调用。
encode在课堂上
MessageToByteEncoder<java.io.Serializable>
ctx - MessageToByteEncoder所属的ChannelHandlerContext
msg - 要编码的消息
out - 将编写消息写入其中的ByteBuf
java.lang.Exception - 发生错误时抛出
Copyright © 2008–2018 The Netty Project. All rights reserved.