Buffer 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 *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
| Modifier and Type | Class and Description |
|---|---|
| private static enum | Lz4Decompressor.
Current state of stream. |
| Modifier and Type | Field and Description |
|---|---|
| private int | blockType
Type of current block. |
| private BufferChecksum | checksum
Underlying checksum calculator in use. |
| private int | compressedLength
Compressed length of current incoming block. |
| private int | currentChecksum
Checksum value of current incoming block. |
| private Lz4Decompressor. | |
| private int | decompressedLength
Decompressed length of current incoming block. |
| private LZ4FastDecompressor | decompressor
Underlying decompressor in use. |
| Access | Constructor and Description |
|---|---|
| private | Lz4Decompressor(LZ4Factory
user customizable factory, Checksum LZ4Factory instance
which may be JNI bindings to the original C implementation, a pure Java implementation
or a Java implementation that uses the sun.the checksum)Checksum instance to use to check data for integrity.
You may set null if you do not want to validate checksum of each blockCreates a new customizable LZ4 decompressor factory. |
| Modifier and Type | Method and Description |
|---|---|
| public void | |
| private void | |
| public Buffer | decompress(Buffer
the in, BufferAllocator Buffer that contains the data to be decompressed.the allocator)BufferAllocator that is used to allocate a new buffer (if needed) to write the
decompressed bytes too.Implements io. Buffer and decompress into a new Buffer that will be
allocated (if needed) from the BufferAllocator.
|
| public boolean | isClosed()
Implements io. true if the decompressor was closed, false otherwise.
|
| public boolean | isFinished()
Implements io. true if the decompressor was finish.
|
| public static Supplier | |
| public static Supplier | Returns: the factory.if validateChecksums)true, the checksum field will be validated against the actual
uncompressed data, and if the checksums do not match, a suitable
DecompressionException will be thrownCreates a LZ4 decompressor factory with fastest decoder instance available on your machine. |
| public static Supplier | Returns: the factory.user customizable factory, boolean LZ4Factory instance
which may be JNI bindings to the original C implementation, a pure Java implementation
or a Java implementation that uses the sun.if validateChecksums)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.Creates a LZ4 decompressor factory with customizable implementation. |
| public static Supplier | Returns: the factory.user customizable factory, Checksum LZ4Factory instance
which may be JNI bindings to the original C implementation, a pure Java implementation
or a Java implementation that uses the sun.the checksum)Checksum instance to use to check data for integrity.
You may set null if you do not want to validate checksum of each blockCreates a customizable LZ4 decompressor factory. |
| private void | |
| private void |
| blockType | back to summary |
|---|---|
| private int blockType Type of current block. | |
| checksum | back to summary |
|---|---|
| private BufferChecksum checksum Underlying checksum calculator in use. | |
| compressedLength | back to summary |
|---|---|
| private int compressedLength Compressed length of current incoming block. | |
| currentChecksum | back to summary |
|---|---|
| private int currentChecksum Checksum value of current incoming block. | |
| currentState | back to summary |
|---|---|
| private Lz4Decompressor. | |
| decompressedLength | back to summary |
|---|---|
| private int decompressedLength Decompressed length of current incoming block. | |
| decompressor | back to summary |
|---|---|
| private LZ4FastDecompressor decompressor
Deprecated as a consequence of Underlying decompressor in use. | |
| Lz4Decompressor | back to summary |
|---|---|
| private Lz4Decompressor(LZ4Factory factory, Checksum checksum) Creates a new customizable LZ4 decompressor factory.
| |
| close | back to summary |
|---|---|
| public void close() Implements io. Doc from io. Close the decompressor. After this method was called
| |
| decompress | back to summary |
|---|---|
| private void decompress(Buffer compressed, Buffer uncompressed) | |
| decompress | back to summary |
|---|---|
| public Buffer decompress(Buffer in, BufferAllocator allocator) throws DecompressionException Implements io. Doc from io. This method will read from the input isFinished() is false
input
| |
| isClosed | back to summary |
|---|---|
| public boolean isClosed() Implements io. Doc from io. Return | |
| isFinished | back to summary |
|---|---|
| public boolean isFinished() Implements io. Doc from io. Returns
| |
| newFactory | back to summary |
|---|---|
| public static Supplier Creates the fastest LZ4 decompressor factory.
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
| |
| newFactory | back to summary |
|---|---|
| public static Supplier Creates a LZ4 decompressor factory with fastest decoder instance available on your machine.
| |
| newFactory | back to summary |
|---|---|
| public static Supplier Creates a LZ4 decompressor factory with customizable implementation.
| |
| newFactory | back to summary |
|---|---|
| public static Supplier Creates a customizable LZ4 decompressor factory.
| |
| streamCorrupted | back to summary |
|---|---|
| private void streamCorrupted(String message) | |
| streamCorrupted | back to summary |
|---|---|
| private void streamCorrupted(Exception cause) | |
| Modifier and Type | Field and Description |
|---|---|
| public static final Lz4Decompressor. | |
| public static final Lz4Decompressor. | |
| public static final Lz4Decompressor. | |
| public static final Lz4Decompressor. | |
| public static final Lz4Decompressor. |
| Access | Constructor and Description |
|---|---|
| private |
| Modifier and Type | Method and Description |
|---|---|
| public static Lz4Decompressor. | |
| public static Lz4Decompressor. |
| CLOSED | back to summary |
|---|---|
| public static final Lz4Decompressor. | |
| CORRUPTED | back to summary |
|---|---|
| public static final Lz4Decompressor. | |
| DECOMPRESS_DATA | back to summary |
|---|---|
| public static final Lz4Decompressor. | |
| FINISHED | back to summary |
|---|---|
| public static final Lz4Decompressor. | |
| INIT_BLOCK | back to summary |
|---|---|
| public static final Lz4Decompressor. | |
| State | back to summary |
|---|---|
| private State() | |
| valueOf | back to summary |
|---|---|
| public static Lz4Decompressor. | |
| values | back to summary |
|---|---|
| public static Lz4Decompressor. | |