public class LzfEncoder extends MessageToByteEncoder<ByteBuf>
ByteBuf 。
请参阅原始LZF package和LZF format以获取完整说明。
ChannelHandler.Sharable| Constructor and Description |
|---|
LzfEncoder()
创建一个新的LZF编码器,其中包含用于底层数据访问的最佳可用方法。
|
LzfEncoder(boolean safeInstance)
用指定的编码实例创建一个新的LZF编码器。
|
LzfEncoder(boolean safeInstance, int totalLength)
用指定的设置创建一个新的LZF编码器。
|
LzfEncoder(int totalLength)
创建具有指定编码块总长度的新LZF编码器。
|
| Modifier and Type | Method and Description |
|---|---|
protected void |
encode(ChannelHandlerContext ctx, ByteBuf in, ByteBuf out)
将消息编码成 ByteBuf 。
|
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 LzfEncoder()
LzfEncoder(boolean)与true PARAM。
public LzfEncoder(boolean safeInstance)
safeInstance - 如果true编码器将使用仅使用标准JDK访问方法的ChunkEncoder ,并且应在所有Java平台和JVM上工作。
否则编码器将尝试使用高度优化的ChunkEncoder实现,该实现使用Sun JDK的Unsafe类(其他JDK也可能包含该类)。
public LzfEncoder(int totalLength)
totalLength - 预计要压缩的内容的总长度;
只对传出的消息小于最大块大小(64k),以优化编码散列表。
public LzfEncoder(boolean safeInstance,
int totalLength)
safeInstance - 如果true编码器将使用仅使用标准JDK访问方法的ChunkEncoder ,并且应在所有Java平台和JVM上工作。
否则,编码器将尝试使用高度优化的ChunkEncoder实现,该实现使用Sun JDK的Unsafe类(其他JDK也可能包含该类)。
totalLength - 预计要压缩的内容的总长度;
只对传出的消息小于最大块大小(64k),以优化编码散列表。
protected void encode(ChannelHandlerContext ctx, ByteBuf in, ByteBuf out) throws java.lang.Exception
MessageToByteEncoder
ByteBuf 。
这个方法将被编码器处理的每个书面信息调用。
encode在课堂上
MessageToByteEncoder<ByteBuf>
ctx - MessageToByteEncoder所属的ChannelHandlerContext
in - 要编码的消息
out - 编码消息将写入其中的ByteBuf
java.lang.Exception - 发生错误时抛出
Copyright © 2008–2018 The Netty Project. All rights reserved.