Package net.jpountz.lz4
Class LZ4DecompressorWithLength
- java.lang.Object
-
- net.jpountz.lz4.LZ4DecompressorWithLength
-
public class LZ4DecompressorWithLength extends java.lang.Object
Convenience class to decompress data compressed byLZ4CompressorWithLength
. 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 Summary
Constructors Constructor Description LZ4DecompressorWithLength(LZ4FastDecompressor decompressor)
Creates a new decompressor to decompress data compressed byLZ4CompressorWithLength
.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description byte[]
decompress(byte[] src)
Convenience method, equivalent to callingdecompress(src, 0)
.int
decompress(byte[] src, byte[] dest)
Convenience method, equivalent to callingdecompress(src, 0, dest, 0)
.byte[]
decompress(byte[] src, int srcOff)
Convenience method which returnssrc[srcOff:]
decompressed.int
decompress(byte[] src, int srcOff, byte[] dest, int destOff)
Decompressessrc[srcOff:]
intodest[destOff:]
and returns the number of bytes read fromsrc
.int
decompress(java.nio.ByteBuffer src, int srcOff, java.nio.ByteBuffer dest, int destOff)
Decompressessrc[srcOff:]
intodest[destOff:]
and returns the number of bytes read fromsrc
.void
decompress(java.nio.ByteBuffer src, java.nio.ByteBuffer dest)
Decompressessrc
intodest
.static int
getDecompressedLength(byte[] src)
Returns the decompressed length of compressed data insrc
.static int
getDecompressedLength(byte[] src, int srcOff)
Returns the decompressed length of compressed data insrc[srcOff:]
.static int
getDecompressedLength(java.nio.ByteBuffer src)
Returns the decompressed length of compressed data insrc
.static int
getDecompressedLength(java.nio.ByteBuffer src, int srcOff)
Returns the decompressed length of compressed data insrc[srcOff:]
.
-
-
-
Constructor Detail
-
LZ4DecompressorWithLength
public LZ4DecompressorWithLength(LZ4FastDecompressor decompressor)
Creates a new decompressor to decompress data compressed byLZ4CompressorWithLength
.- Parameters:
decompressor
- decompressor to use
-
-
Method Detail
-
getDecompressedLength
public static int getDecompressedLength(byte[] src)
Returns the decompressed length of compressed data insrc
.- Parameters:
src
- the compressed data- Returns:
- the decompressed length
-
getDecompressedLength
public static int getDecompressedLength(byte[] src, int srcOff)
Returns the decompressed length of compressed data insrc[srcOff:]
.- Parameters:
src
- the compressed datasrcOff
- the start offset in src- Returns:
- the decompressed length
-
getDecompressedLength
public static int getDecompressedLength(java.nio.ByteBuffer src)
Returns the decompressed length of compressed data insrc
.- Parameters:
src
- the compressed data- Returns:
- the decompressed length
-
getDecompressedLength
public static int getDecompressedLength(java.nio.ByteBuffer src, int srcOff)
Returns the decompressed length of compressed data insrc[srcOff:]
.- Parameters:
src
- the compressed datasrcOff
- the start offset in src- Returns:
- the decompressed length
-
decompress
public int decompress(byte[] src, byte[] dest)
Convenience method, equivalent to callingdecompress(src, 0, dest, 0)
.- Parameters:
src
- the compressed datadest
- the destination buffer to store the decompressed data- Returns:
- the number of bytes read to restore the original input
-
decompress
public int decompress(byte[] src, int srcOff, byte[] dest, int destOff)
Decompressessrc[srcOff:]
intodest[destOff:]
and returns the number of bytes read fromsrc
.- Parameters:
src
- the compressed datasrcOff
- the start offset in srcdest
- the destination buffer to store the decompressed datadestOff
- the start offset in dest- Returns:
- the number of bytes read to restore the original input
-
decompress
public byte[] decompress(byte[] src)
Convenience method, equivalent to callingdecompress(src, 0)
.- Parameters:
src
- the compressed data- Returns:
- the decompressed data
-
decompress
public byte[] decompress(byte[] src, int srcOff)
Convenience method which returnssrc[srcOff:]
decompressed.Warning: this method has an important overhead due to the fact that it needs to allocate a buffer to decompress into.
- Parameters:
src
- the compressed datasrcOff
- the start offset in src- Returns:
- the decompressed data
-
decompress
public void decompress(java.nio.ByteBuffer src, java.nio.ByteBuffer dest)
Decompressessrc
intodest
. This method moves the positions of the buffers.- Parameters:
src
- the compressed datadest
- the destination buffer to store the decompressed data
-
decompress
public int decompress(java.nio.ByteBuffer src, int srcOff, java.nio.ByteBuffer dest, int destOff)
Decompressessrc[srcOff:]
intodest[destOff:]
and returns the number of bytes read fromsrc
. The positions and limits of theByteBuffer
s remain unchanged.- Parameters:
src
- the compressed datasrcOff
- the start offset in srcdest
- the destination buffer to store the decompressed datadestOff
- the start offset in dest- Returns:
- the number of bytes read to restore the original input
-
-