public class LzfEncoder extends MessageToByteEncoder<ByteBuf>
ByteBuf
using the LZF format.
See original LZF package
and LZF format for full description.ChannelHandler.Sharable
Constructor and Description |
---|
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 settings.
|
LzfEncoder(int totalLength)
Creates a new LZF encoder with specified total length of encoded chunk.
|
Modifier and Type | Method and Description |
---|---|
protected void |
encode(ChannelHandlerContext ctx,
ByteBuf in,
ByteBuf out)
Encode a message into a
ByteBuf . |
acceptOutboundMessage, allocateBuffer, isPreferDirect, write
bind, close, connect, deregister, disconnect, flush, read
ensureNotSharable, exceptionCaught, handlerAdded, handlerRemoved, isSharable
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
exceptionCaught, handlerAdded, handlerRemoved
public 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(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)
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.protected void encode(ChannelHandlerContext ctx, ByteBuf in, ByteBuf out) throws Exception
MessageToByteEncoder
ByteBuf
. This method will be called for each written message that can be handled
by this encoder.encode
in class MessageToByteEncoder<ByteBuf>
ctx
- the ChannelHandlerContext
which this MessageToByteEncoder
belongs toin
- the message to encodeout
- the ByteBuf
into which the encoded message will be writtenException
- is thrown if an error occursCopyright © 2008–2017 The Netty Project. All rights reserved.