public abstract class LZ4SafeDecompressor extends java.lang.Object implements LZ4UnknownSizeDecompressor
Implementations of this class are usually a little slower than those of
LZ4FastDecompressor but do not require the size of the original data to
be known.
| Constructor and Description |
|---|
LZ4SafeDecompressor() |
| Modifier and Type | Method and Description |
|---|---|
int |
decompress(byte[] src,
byte[] dest)
Convenience method, equivalent to calling
decompress(src, 0, src.length, dest, 0) |
byte[] |
decompress(byte[] src,
int maxDestLen)
Convenience method, equivalent to calling
decompress(src, 0, src.length, maxDestLen). |
int |
decompress(byte[] src,
int srcOff,
int srcLen,
byte[] dest,
int destOff)
Convenience method, equivalent to calling
decompress(src, srcOff, srcLen, dest, destOff, dest.length - destOff). |
abstract int |
decompress(byte[] src,
int srcOff,
int srcLen,
byte[] dest,
int destOff,
int maxDestLen)
Decompresses
src[srcOff:srcOff+srcLen] into
dest[destOff:destOff+maxDestLen] and returns the number of
decompressed bytes written into dest. |
byte[] |
decompress(byte[] src,
int srcOff,
int srcLen,
int maxDestLen)
Convenience method which returns
src[srcOff:srcOff+srcLen]
decompressed. |
void |
decompress(java.nio.ByteBuffer src,
java.nio.ByteBuffer dest)
Decompresses
src into dest. |
abstract int |
decompress(java.nio.ByteBuffer src,
int srcOff,
int srcLen,
java.nio.ByteBuffer dest,
int destOff,
int maxDestLen)
Decompresses
src[srcOff:srcOff+srcLen] into
dest[destOff:destOff+maxDestLen] and returns the number of
decompressed bytes written into dest. |
java.lang.String |
toString() |
public abstract int decompress(byte[] src,
int srcOff,
int srcLen,
byte[] dest,
int destOff,
int maxDestLen)
src[srcOff:srcOff+srcLen] into
dest[destOff:destOff+maxDestLen] and returns the number of
decompressed bytes written into dest.decompress in interface LZ4UnknownSizeDecompressorsrc - the compressed datasrcOff - the start offset in srcsrcLen - the exact size of the compressed datadest - the destination buffer to store the decompressed datadestOff - the start offset in destmaxDestLen - the maximum number of bytes to write in destLZ4Exception - if maxDestLen is too smallpublic abstract int decompress(java.nio.ByteBuffer src,
int srcOff,
int srcLen,
java.nio.ByteBuffer dest,
int destOff,
int maxDestLen)
src[srcOff:srcOff+srcLen] into
dest[destOff:destOff+maxDestLen] and returns the number of
decompressed bytes written into dest.
The positions and limits of the ByteBuffers remain unchanged.src - the compressed datasrcOff - the start offset in srcsrcLen - the exact size of the compressed datadest - the destination buffer to store the decompressed datadestOff - the start offset in destmaxDestLen - the maximum number of bytes to write in destLZ4Exception - if maxDestLen is too smallpublic final int decompress(byte[] src,
int srcOff,
int srcLen,
byte[] dest,
int destOff)
decompress(src, srcOff, srcLen, dest, destOff, dest.length - destOff).decompress in interface LZ4UnknownSizeDecompressorsrc - the compressed datasrcOff - the start offset in srcsrcLen - the exact size of the compressed datadest - the destination buffer to store the decompressed datadestOff - the start offset in destLZ4Exception - if dest is too smallpublic final int decompress(byte[] src,
byte[] dest)
decompress(src, 0, src.length, dest, 0)src - the compressed datadest - the destination buffer to store the decompressed dataLZ4Exception - if dest is too smallpublic final byte[] decompress(byte[] src,
int srcOff,
int srcLen,
int maxDestLen)
src[srcOff:srcOff+srcLen]
decompressed.
Warning: this method has an important overhead due to the fact that it needs to allocate a buffer to decompress into, and then needs to resize this buffer to the actual decompressed length.
Here is how this method is implemented:
byte[] decompressed = new byte[maxDestLen];
final int decompressedLength = decompress(src, srcOff, srcLen, decompressed, 0, maxDestLen);
if (decompressedLength != decompressed.length) {
decompressed = Arrays.copyOf(decompressed, decompressedLength);
}
return decompressed;
src - the compressed datasrcOff - the start offset in srcsrcLen - the exact size of the compressed datamaxDestLen - the maximum number of bytes to write in destLZ4Exception - if maxDestLen is too smallpublic final byte[] decompress(byte[] src,
int maxDestLen)
decompress(src, 0, src.length, maxDestLen).src - the compressed datamaxDestLen - the maximum number of bytes to write in destLZ4Exception - if maxDestLen is too smallpublic final void decompress(java.nio.ByteBuffer src,
java.nio.ByteBuffer dest)
src into dest. 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 dataLZ4Exception - if dest is too smallpublic java.lang.String toString()
toString in class java.lang.Object