Package net.jpountz.lz4
Class LZ4FastDecompressor
java.lang.Object
net.jpountz.lz4.LZ4FastDecompressor
- All Implemented Interfaces:
LZ4Decompressor
LZ4 decompressor that requires the size of the original input to be known.
Use
LZ4SafeDecompressor if you only know the size of the
compressed stream.
From lz4-java 1.6.0, it is deprecated to use a JNI-binding instance
of this class; i.e., an instasnce returned by
LZ4Factory.fastDecompressor() of LZ4Factory.nativeInstance().
Please see LZ4Factory.nativeInstance() for details.
Instances of this class are thread-safe.
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfinal intdecompress(byte[] src, byte[] dest) Convenience method, equivalent to callingdecompress(src, dest, dest.length).final intdecompress(byte[] src, byte[] dest, int destLen) Convenience method, equivalent to callingdecompress(src, 0, dest, 0, destLen).final byte[]decompress(byte[] src, int destLen) Convenience method, equivalent to callingdecompress(src, 0, destLen).abstract intdecompress(byte[] src, int srcOff, byte[] dest, int destOff, int destLen) Decompressessrc[srcOff:]intodest[destOff:destOff+destLen]and returns the number of bytes read fromsrc.final byte[]decompress(byte[] src, int srcOff, int destLen) Convenience method which returnssrc[srcOff:?]decompressed.abstract intdecompress(ByteBuffer src, int srcOff, ByteBuffer dest, int destOff, int destLen) Decompressessrc[srcOff:]intodest[destOff:destOff+destLen]and returns the number of bytes read fromsrc.final voiddecompress(ByteBuffer src, ByteBuffer dest) Decompressessrcintodest.toString()
-
Constructor Details
-
LZ4FastDecompressor
public LZ4FastDecompressor()
-
-
Method Details
-
decompress
public abstract int decompress(byte[] src, int srcOff, byte[] dest, int destOff, int destLen) Decompressessrc[srcOff:]intodest[destOff:destOff+destLen]and returns the number of bytes read fromsrc.destLenmust be exactly the size of the decompressed data.- Specified by:
decompressin interfaceLZ4Decompressor- Parameters:
src- the compressed datasrcOff- the start offset in srcdest- the destination buffer to store the decompressed datadestOff- the start offset in destdestLen- the exact size of the original input- Returns:
- the number of bytes read to restore the original input
-
decompress
public abstract int decompress(ByteBuffer src, int srcOff, ByteBuffer dest, int destOff, int destLen) Decompressessrc[srcOff:]intodest[destOff:destOff+destLen]and returns the number of bytes read fromsrc.destLenmust be exactly the size of the decompressed data. The positions and limits of theByteBuffers remain unchanged.- Parameters:
src- the compressed datasrcOff- the start offset in srcdest- the destination buffer to store the decompressed datadestOff- the start offset in destdestLen- the exact size of the original input- Returns:
- the number of bytes read to restore the original input
-
decompress
public final int decompress(byte[] src, byte[] dest, int destLen) Convenience method, equivalent to callingdecompress(src, 0, dest, 0, destLen).- Parameters:
src- the compressed datadest- the destination buffer to store the decompressed datadestLen- the exact size of the original input- Returns:
- the number of bytes read to restore the original input
-
decompress
public final int decompress(byte[] src, byte[] dest) Convenience method, equivalent to callingdecompress(src, dest, dest.length).- 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 final byte[] decompress(byte[] src, int srcOff, int destLen) 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.
Here is how this method is implemented:
final byte[] decompressed = new byte[destLen]; decompress(src, srcOff, decompressed, 0, destLen); return decompressed;
- Parameters:
src- the compressed datasrcOff- the start offset in srcdestLen- the exact size of the original input- Returns:
- the decompressed data
-
decompress
public final byte[] decompress(byte[] src, int destLen) Convenience method, equivalent to callingdecompress(src, 0, destLen).- Parameters:
src- the compressed datadestLen- the exact size of the original input- Returns:
- the decompressed data
-
decompress
Decompressessrcintodest.dest'sBuffer.remaining()must be exactly the size of the decompressed data. This method moves the positions of the buffers.- Parameters:
src- the compressed datadest- the destination buffer to store the decompressed data
-
toString
-