public class FastLzFrameEncoder extends MessageToByteEncoder<ByteBuf>
ByteBuf
using the FastLZ algorithm.
See FastLZ format.ChannelHandler.Sharable
构造器和说明 |
---|
FastLzFrameEncoder()
Creates a FastLZ encoder without checksum calculator and with auto detection of compression level.
|
FastLzFrameEncoder(boolean validateChecksums)
Creates a FastLZ encoder with auto detection of compression
level and calculation of checksums as specified.
|
FastLzFrameEncoder(int level)
Creates a FastLZ encoder with specified compression level and without checksum calculator.
|
FastLzFrameEncoder(int level,
java.util.zip.Checksum checksum)
Creates a FastLZ encoder with specified compression level and checksum calculator.
|
限定符和类型 | 方法和说明 |
---|---|
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 FastLzFrameEncoder()
public FastLzFrameEncoder(int level)
level
- supports only these values:
0 - Encoder will choose level automatically depending on the length of the input buffer.
1 - Level 1 is the fastest compression and generally useful for short data.
2 - Level 2 is slightly slower but it gives better compression ratio.public FastLzFrameEncoder(boolean validateChecksums)
validateChecksums
- If true, the checksum of each block will be calculated and this value
will be added to the header of block.
By default FastLzFrameEncoder
uses Adler32
for checksum calculation.public FastLzFrameEncoder(int level, java.util.zip.Checksum checksum)
level
- supports only these values:
0 - Encoder will choose level automatically depending on the length of the input buffer.
1 - Level 1 is the fastest compression and generally useful for short data.
2 - Level 2 is slightly slower but it gives better compression ratio.checksum
- the Checksum
instance to use to check data for integrity.
You may set null
if you don't want to validate checksum of each block.protected void encode(ChannelHandlerContext ctx, ByteBuf in, ByteBuf out) throws java.lang.Exception
MessageToByteEncoder
ByteBuf
. 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 occurs