public class FastLzFrameEncoder extends MessageToByteEncoder<ByteBuf>
ByteBuf
using the FastLZ algorithm.
See FastLZ format.ChannelHandler.Sharable
Constructor and Description |
---|
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,
Checksum checksum)
Creates a FastLZ encoder with specified compression level and checksum calculator.
|
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 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, 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 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–2024 The Netty Project. All rights reserved.