public class LZ4DecompressorWithLength
extends java.lang.Object
LZ4CompressorWithLength
.
This decompressor is NOT compatible with any other compressors in lz4-java
or any other lz4 tools.
The user does not need to specify the length of the compressed data or
original data because the length of the original decompressed data is
included in the compressed data.Constructor and Description |
---|
LZ4DecompressorWithLength(LZ4FastDecompressor fastDecompressor)
Creates a new decompressor to decompress data compressed by
LZ4CompressorWithLength . |
LZ4DecompressorWithLength(LZ4SafeDecompressor safeDecompressor)
Creates a new decompressor to decompress data compressed by
LZ4CompressorWithLength . |
Modifier and Type | Method and Description |
---|---|
byte[] |
decompress(byte[] src)
Convenience method, equivalent to calling
decompress(src, 0) . |
int |
decompress(byte[] src,
byte[] dest)
Convenience method, equivalent to calling
decompress(src, 0, dest, 0) . |
byte[] |
decompress(byte[] src,
int srcOff)
Convenience method which returns
src[srcOff:]
decompressed when LZ4FastDecompressor was specified to the constructor,
or src[srcOff:src.length] decompressed when
LZ4SafeDecompressor was specified to the constructor. |
int |
decompress(byte[] src,
int srcOff,
byte[] dest,
int destOff)
When
LZ4FastDecompressor was specified to the constructor,
decompresses src[srcOff:] into dest[destOff:]
and returns the number of bytes read from src , and
when LZ4SafeDecompressor was specified to the constructor,
decompresses src[srcOff:src.length] into dest[destOff:]
and returns the number of decompressed bytes written into dest . |
byte[] |
decompress(byte[] src,
int srcOff,
int srcLen)
Convenience method which returns
src[srcOff:]
decompressed when LZ4FastDecompressor was specified to the constructor,
or src[srcOff:srcOff+srcLen] decompressed when
LZ4SafeDecompressor was specified to the constructor. |
int |
decompress(byte[] src,
int srcOff,
int srcLen,
byte[] dest,
int destOff)
When
LZ4FastDecompressor was specified to the constructor,
decompresses src[srcOff:] into dest[destOff:]
and returns the number of bytes read from src , and
when LZ4SafeDecompressor was specified to the constructor,
decompresses src[srcOff:srcOff+srcLen] into dest[destOff:]
and returns the number of decompressed bytes written into dest . |
void |
decompress(java.nio.ByteBuffer src,
java.nio.ByteBuffer dest)
Decompresses
src into dest . |
int |
decompress(java.nio.ByteBuffer src,
int srcOff,
java.nio.ByteBuffer dest,
int destOff)
When
LZ4FastDecompressor was specified to the constructor,
decompresses src[srcOff:] into dest[destOff:]
and returns the number of bytes read from src , and
when LZ4SafeDecompressor was specified to the constructor,
decompresses src[srcOff:src.remaining()] into dest[destOff:]
and returns the number of decompressed bytes written into dest . |
int |
decompress(java.nio.ByteBuffer src,
int srcOff,
int srcLen,
java.nio.ByteBuffer dest,
int destOff)
When
LZ4FastDecompressor was specified to the constructor,
decompresses src[srcOff:] into dest[destOff:]
and returns the number of bytes read from src , and
when LZ4SafeDecompressor was specified to the constructor,
decompresses src[srcOff:srcOff+srcLen] into dest[destOff:]
and returns the number of decompressed bytes written into dest . |
static int |
getDecompressedLength(byte[] src)
Returns the decompressed length of compressed data in
src . |
static int |
getDecompressedLength(byte[] src,
int srcOff)
Returns the decompressed length of compressed data in
src[srcOff:] . |
static int |
getDecompressedLength(java.nio.ByteBuffer src)
Returns the decompressed length of compressed data in
src . |
static int |
getDecompressedLength(java.nio.ByteBuffer src,
int srcOff)
Returns the decompressed length of compressed data in
src[srcOff:] . |
public LZ4DecompressorWithLength(LZ4FastDecompressor fastDecompressor)
LZ4CompressorWithLength
.
Note that it is deprecated to use a JNI-binding instance of LZ4FastDecompressor
.
Please see LZ4Factory.nativeInstance()
for details.fastDecompressor
- fast decompressor to usepublic LZ4DecompressorWithLength(LZ4SafeDecompressor safeDecompressor)
LZ4CompressorWithLength
.safeDecompressor
- safe decompressor to usepublic static int getDecompressedLength(byte[] src)
src
.src
- the compressed datapublic static int getDecompressedLength(byte[] src, int srcOff)
src[srcOff:]
.src
- the compressed datasrcOff
- the start offset in srcpublic static int getDecompressedLength(java.nio.ByteBuffer src)
src
.src
- the compressed datapublic static int getDecompressedLength(java.nio.ByteBuffer src, int srcOff)
src[srcOff:]
.src
- the compressed datasrcOff
- the start offset in srcpublic int decompress(byte[] src, byte[] dest)
decompress(src, 0, dest, 0)
.src
- the compressed datadest
- the destination buffer to store the decompressed datapublic int decompress(byte[] src, int srcOff, byte[] dest, int destOff)
LZ4FastDecompressor
was specified to the constructor,
decompresses src[srcOff:]
into dest[destOff:]
and returns the number of bytes read from src
, and
when LZ4SafeDecompressor
was specified to the constructor,
decompresses src[srcOff:src.length]
into dest[destOff:]
and returns the number of decompressed bytes written into dest
.src
- the compressed datasrcOff
- the start offset in srcdest
- the destination buffer to store the decompressed datadestOff
- the start offset in destLZ4FastDecompressor
is used), or the number of decompressed bytes (when LZ4SafeDecompressor
is used)public int decompress(byte[] src, int srcOff, int srcLen, byte[] dest, int destOff)
LZ4FastDecompressor
was specified to the constructor,
decompresses src[srcOff:]
into dest[destOff:]
and returns the number of bytes read from src
, and
when LZ4SafeDecompressor
was specified to the constructor,
decompresses src[srcOff:srcOff+srcLen]
into dest[destOff:]
and returns the number of decompressed bytes written into dest
.src
- the compressed datasrcOff
- the start offset in srcsrcLen
- the exact size of the compressed data (ignored when LZ4FastDecompressor
is used)dest
- the destination buffer to store the decompressed datadestOff
- the start offset in destLZ4FastDecompressor
is used), or the number of decompressed bytes (when LZ4SafeDecompressor
is used)public byte[] decompress(byte[] src)
decompress(src, 0)
.src
- the compressed datapublic byte[] decompress(byte[] src, int srcOff)
src[srcOff:]
decompressed when LZ4FastDecompressor
was specified to the constructor,
or src[srcOff:src.length]
decompressed when
LZ4SafeDecompressor
was specified to the constructor.
Warning: this method has an important overhead due to the fact that it needs to allocate a buffer to decompress into.
src
- the compressed datasrcOff
- the start offset in srcpublic byte[] decompress(byte[] src, int srcOff, int srcLen)
src[srcOff:]
decompressed when LZ4FastDecompressor
was specified to the constructor,
or src[srcOff:srcOff+srcLen]
decompressed when
LZ4SafeDecompressor
was specified to the constructor.
Warning: this method has an important overhead due to the fact that it needs to allocate a buffer to decompress into.
src
- the compressed datasrcOff
- the start offset in srcsrcLen
- the exact size of the compressed data (ignored when LZ4FastDecompressor
is used)public void decompress(java.nio.ByteBuffer src, java.nio.ByteBuffer dest)
src
into dest
.
When LZ4SafeDecompressor
was specified to the constructor,
src
's Buffer.remaining()
must be exactly the size
of the compressed data. This method moves the positions of the buffers.src
- the compressed datadest
- the destination buffer to store the decompressed datapublic int decompress(java.nio.ByteBuffer src, int srcOff, java.nio.ByteBuffer dest, int destOff)
LZ4FastDecompressor
was specified to the constructor,
decompresses src[srcOff:]
into dest[destOff:]
and returns the number of bytes read from src
, and
when LZ4SafeDecompressor
was specified to the constructor,
decompresses src[srcOff:src.remaining()]
into dest[destOff:]
and returns the number of decompressed bytes written into dest
.
The positions and limits of the ByteBuffer
s remain unchanged.src
- the compressed datasrcOff
- the start offset in srcdest
- the destination buffer to store the decompressed datadestOff
- the start offset in destLZ4FastDecompressor
is used), or the number of decompressed bytes (when LZ4SafeDecompressor
is used)public int decompress(java.nio.ByteBuffer src, int srcOff, int srcLen, java.nio.ByteBuffer dest, int destOff)
LZ4FastDecompressor
was specified to the constructor,
decompresses src[srcOff:]
into dest[destOff:]
and returns the number of bytes read from src
, and
when LZ4SafeDecompressor
was specified to the constructor,
decompresses src[srcOff:srcOff+srcLen]
into dest[destOff:]
and returns the number of decompressed bytes written into dest
.
The positions and limits of the ByteBuffer
s remain unchanged.src
- the compressed datasrcOff
- the start offset in srcsrcLen
- the exact size of the compressed data (ignored when LZ4FastDecompressor
is used)dest
- the destination buffer to store the decompressed datadestOff
- the start offset in destLZ4FastDecompressor
is used), or the number of decompressed bytes (when LZ4SafeDecompressor
is used)