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)
Deprecated.
Use the constructor without the
safeInstance parameter. |
LzfEncoder(boolean safeInstance,
int totalLength)
Deprecated.
Use the constructor without the
safeInstance parameter. |
LzfEncoder(boolean safeInstance,
int totalLength,
int compressThreshold)
Deprecated.
Use the constructor without the
safeInstance parameter. |
LzfEncoder(int totalLength)
Creates a new LZF encoder with specified total length of encoded chunk.
|
LzfEncoder(int totalLength,
int compressThreshold)
Creates a new LZF encoder with specified settings.
|
Modifier and Type | Method and Description |
---|---|
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, write
bind, close, connect, deregister, disconnect, flush, read
ensureNotSharable, exceptionCaught, handlerAdded, isSharable
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
exceptionCaught, handlerAdded
public LzfEncoder()
LzfEncoder(boolean)
with true
param.@Deprecated public LzfEncoder(boolean safeInstance)
safeInstance
parameter.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).@Deprecated public LzfEncoder(boolean safeInstance, int totalLength)
safeInstance
parameter.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(int totalLength, int compressThreshold)
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.@Deprecated public LzfEncoder(boolean safeInstance, int totalLength, int compressThreshold)
safeInstance
parameter.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 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 occurspublic void handlerRemoved(ChannelHandlerContext ctx) throws Exception
ChannelHandlerAdapter
handlerRemoved
in interface ChannelHandler
handlerRemoved
in class ChannelHandlerAdapter
Exception
Copyright © 2008–2024 The Netty Project. All rights reserved.