public class LzfEncoder extends MessageToByteEncoder<ByteBuf>
ByteBuf using the LZF format.
See original LZF package and LZF format for full description.
ChannelHandler.Sharable| 构造器和说明 |
|---|
LzfEncoder()
Creates a new LZF encoder with the most optimal available methods for underlying data access.
|
LzfEncoder(boolean safeInstance)
Creates a new LZF encoder with specified encoding instance.
|
LzfEncoder(boolean safeInstance,
int totalLength)
Creates a new LZF encoder with specified encoding instance and compressThreshold.
|
LzfEncoder(boolean safeInstance,
int totalLength,
int compressThreshold)
Creates a new LZF encoder with specified settings.
|
LzfEncoder(int totalLength)
Creates a new LZF encoder with specified total length of encoded chunk.
|
| 限定符和类型 | 方法和说明 |
|---|---|
protected void |
encode(ChannelHandlerContext ctx,
ByteBuf in,
ByteBuf out)
Encode a message into a
ByteBuf. |
void |
handlerRemoved(ChannelHandlerContext ctx)
Do nothing by default, sub-classes may override this method.
|
acceptOutboundMessage, allocateBuffer, isPreferDirect, writebind, close, connect, deregister, disconnect, flush, readensureNotSharable, exceptionCaught, handlerAdded, isSharableclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitexceptionCaught, handlerAddedpublic LzfEncoder()
LzfEncoder(boolean) with true param.public LzfEncoder(boolean safeInstance)
safeInstance - If true encoder will use ChunkEncoder that only uses
standard JDK access methods, and should work on all Java platforms and JVMs.
Otherwise encoder will try to use highly optimized ChunkEncoder
implementation that uses Sun JDK's Unsafe
class (which may be included by other JDK's as well).public LzfEncoder(boolean safeInstance,
int totalLength)
safeInstance - If true encoder will use ChunkEncoder that only uses standard
JDK access methods, and should work on all Java platforms and JVMs.
Otherwise encoder will try to use highly optimized ChunkEncoder
implementation that uses Sun JDK's Unsafe
class (which may be included by other JDK's as well).totalLength - Expected total length of content to compress; only matters for outgoing messages
that is smaller than maximum chunk size (64k), to optimize encoding hash tables.public LzfEncoder(int totalLength)
totalLength - Expected total length of content to compress;
only matters for outgoing messages that is smaller than maximum chunk size (64k),
to optimize encoding hash tables.public LzfEncoder(boolean safeInstance,
int totalLength,
int compressThreshold)
safeInstance - If true encoder will use ChunkEncoder that only uses standard JDK
access methods, and should work on all Java platforms and JVMs.
Otherwise encoder will try to use highly optimized ChunkEncoder
implementation that uses Sun JDK's Unsafe
class (which may be included by other JDK's as well).totalLength - Expected total length of content to compress; only matters for outgoing messages
that is smaller than maximum chunk size (64k), to optimize encoding hash tables.compressThreshold - Compress threshold for LZF format. When the amount of input data is less than
compressThreshold, we will construct an uncompressed output according
to the LZF format.protected void encode(ChannelHandlerContext ctx, ByteBuf in, ByteBuf out) throws java.lang.Exception
MessageToByteEncoderByteBuf. This method will be called for each written message that can be handled
by this encoder.encode 在类中 MessageToByteEncoder<ByteBuf>ctx - the ChannelHandlerContext which this MessageToByteEncoder belongs toin - the message to encodeout - the ByteBuf into which the encoded message will be writtenjava.lang.Exception - is thrown if an error occurspublic void handlerRemoved(ChannelHandlerContext ctx) throws java.lang.Exception
ChannelHandlerAdapterhandlerRemoved 在接口中 ChannelHandlerhandlerRemoved 在类中 ChannelHandlerAdapterjava.lang.Exception