GeezerVison is showing netty.io — Lz4FrameDecoder (Netty API Reference (4.1.141.Final))
Class Lz4FrameDecoder
- All Implemented Interfaces:
ChannelHandler, ChannelInboundHandler
Uncompresses a ByteBuf encoded with the LZ4 format.
See original LZ4 Github project
and LZ4 block format
for full description.
Since the original LZ4 block format does not contains size of compressed block and size of original data
this encoder uses format like LZ4 Java library
written by Adrien Grand and approved by Yann Collet (author of original LZ4 library).
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Magic * Token * Compressed * Decompressed * Checksum * + * LZ4 compressed *
* * * length * length * * * block *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
-
-
-
Constructor Summary
Constructors
Constructor
Description
Creates the fastest LZ4 decoder.
Creates a LZ4 decoder with fastest decoder instance available on your machine.
Creates a LZ4 decoder with fastest decoder instance available on your machine.
Lz4FrameDecoder(net.jpountz.lz4.LZ4Factory factory,
boolean validateChecksums)
Creates a new LZ4 decoder with customizable implementation.
Creates a new customizable LZ4 decoder.
Creates a new customizable LZ4 decoder.
-
Method Summary
Modifier and Type
Method
Description
protected void
Decode the from one ByteBuf to an other.
boolean
Returns true if and only if the end of the compressed stream
has been reached.
actualReadableBytes, callDecode, channelInactive, channelRead, channelReadComplete, decodeLast, discardSomeReadBytes, handlerRemoved, handlerRemoved0, internalBuffer, isSingleDecode, setCumulator, setDiscardAfterReads, setSingleDecode, userEventTriggered
Modifier and Type
Method
Description
protected int
Returns the actual number of readable bytes in the internal cumulative
buffer of this decoder.
protected void
Called once data should be decoded from the given ByteBuf.
void
void
void
protected void
protected final void
final void
Do nothing by default, sub-classes may override this method.
protected void
Gets called after the ByteToMessageDecoder was removed from the actual context and it doesn't handle
events anymore.
Returns the internal cumulative buffer of this decoder.
boolean
void
void
void
void
Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Constructor Details
-
Lz4FrameDecoder
public Lz4FrameDecoder()
Creates the fastest LZ4 decoder.
Note that by default, validation of the checksum header in each chunk is
DISABLED for performance improvements. If performance is less of an issue,
or if you would prefer the safety that checksum validation brings, please
use the Lz4FrameDecoder(boolean) constructor with the argument
set to true.
-
Lz4FrameDecoder
public Lz4FrameDecoder(boolean validateChecksums)
Creates a LZ4 decoder with fastest decoder instance available on your machine.
- Parameters:
validateChecksums - if true, the checksum field will be validated against the actual
uncompressed data, and if the checksums do not match, a suitable
DecompressionException will be thrown
-
Lz4FrameDecoder
public Lz4FrameDecoder(boolean validateChecksums,
int maxDecompressedLength)
Creates a LZ4 decoder with fastest decoder instance available on your machine.
- Parameters:
validateChecksums - if true, the checksum field will be validated against the actual
uncompressed data, and if the checksums do not match, a suitable
DecompressionException will be thrown
maxDecompressedLength - maximum length of the decompressed block. If 0 is given it uses 32MB
by default.
-
Lz4FrameDecoder
public Lz4FrameDecoder(net.jpountz.lz4.LZ4Factory factory,
boolean validateChecksums)
Creates a new LZ4 decoder with customizable implementation.
- Parameters:
factory - user customizable LZ4Factory instance
which may be JNI bindings to the original C implementation, a pure Java implementation
or a Java implementation that uses the Unsafe
validateChecksums - if true, the checksum field will be validated against the actual
uncompressed data, and if the checksums do not match, a suitable
DecompressionException will be thrown. In this case encoder will use
xxhash hashing for Java, based on Yann Collet's work available at
Github.
-
Lz4FrameDecoder
public Lz4FrameDecoder(net.jpountz.lz4.LZ4Factory factory,
Checksum checksum)
Creates a new customizable LZ4 decoder.
- Parameters:
factory - user customizable LZ4Factory instance
which may be JNI bindings to the original C implementation, a pure Java implementation
or a Java implementation that uses the Unsafe
checksum - the Checksum instance to use to check data for integrity.
You may set null if you do not want to validate checksum of each block
-
Lz4FrameDecoder
public Lz4FrameDecoder(net.jpountz.lz4.LZ4Factory factory,
Checksum checksum,
int maxDecompressedLength)
Creates a new customizable LZ4 decoder.
- Parameters:
factory - user customizable LZ4Factory instance
which may be JNI bindings to the original C implementation, a pure Java implementation
or a Java implementation that uses the Unsafe
checksum - the Checksum instance to use to check data for integrity.
You may set null if you do not want to validate checksum of each block
maxDecompressedLength - maximum length of the decompressed block. If 0 is given it uses 32MB by default.
-
Method Details
-
-
isClosed
public boolean isClosed()
Returns true if and only if the end of the compressed stream
has been reached.
|