Top Description Constructors Methods
net.jpountz.lz4

public abstract Class LZ4SafeDecompressor

extends Object
implements LZ4UnknownSizeDecompressor
Class Inheritance
All Implemented Interfaces
net.jpountz.lz4.LZ4UnknownSizeDecompressor
Known Direct Subclasses
net.jpountz.lz4.LZ4JNISafeDecompressor
Imports
java.nio.ByteBuffer, java.util.Arrays

Deprecated

as a consequence of LZ4UnknownSizeDecompressor being deprecated. See corresponding docs for further information.

LZ4 decompressor that requires the size of the compressed data to be known.

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 Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public abstract int

Returns:

the original input size
decompress
(byte[] src, int srcOff, int
the exact size of the compressed stream
srcLen
,
byte[] dest, int destOff, int maxDestLen)

Redeclares net.jpountz.lz4.LZ4UnknownSizeDecompressor.decompress.

Decompress src[srcOff:srcLen] into dest[destOff:destOff+maxDestLen] and returns the number of decompressed bytes written into dest.
public abstract int

Returns:

the original input size
decompress
(ByteBuffer src, int srcOff, int
the exact size of the compressed stream
srcLen
,
ByteBuffer dest, int destOff, int maxDestLen)

Uncompress src[srcOff:srcLen] into dest[destOff:destOff+maxDestLen] and returns the number of decompressed bytes written into dest.

public final int
decompress(byte[] src, int srcOff, int srcLen, byte[] dest, int destOff)

Implements net.jpountz.lz4.LZ4UnknownSizeDecompressor.decompress.

Convenience method, equivalent to calling decompress(src, srcOff, srcLen, dest, destOff, dest.length - destOff).
public final int
decompress(byte[] src, byte[] dest)

Convenience method, equivalent to calling decompress(src, 0, src.length, dest, 0)

public final byte[]
decompress(byte[] src, int srcOff, int srcLen, int maxDestLen)

Convenience method which returns src[srcOff:srcOff+srcLen] decompressed.

public final byte[]
decompress(byte[] src, int maxDestLen)

Convenience method, equivalent to calling decompress(src, 0, src.length, maxDestLen).

public final void
decompress(ByteBuffer src, ByteBuffer dest)

Decompress src into dest.

public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAllwaitwaitwait

Constructor Detail

LZ4SafeDecompressorback to summary
public LZ4SafeDecompressor()

Method Detail

decompressback to summary
public abstract int decompress(byte[] src, int srcOff, int srcLen, byte[] dest, int destOff, int maxDestLen)

Redeclares net.jpountz.lz4.LZ4UnknownSizeDecompressor.decompress.

Decompress src[srcOff:srcLen] into dest[destOff:destOff+maxDestLen] and returns the number of decompressed bytes written into dest.

Parameters
srcLen:int

the exact size of the compressed stream

Returns:int

the original input size

Exceptions
LZ4Exception:
if maxDestLen is too small
decompressback to summary
public abstract int decompress(ByteBuffer src, int srcOff, int srcLen, ByteBuffer dest, int destOff, int maxDestLen)

Uncompress src[srcOff:srcLen] into dest[destOff:destOff+maxDestLen] and returns the number of decompressed bytes written into dest.

Parameters
srcLen:int

the exact size of the compressed stream

Returns:int

the original input size

Exceptions
LZ4Exception:
if maxDestLen is too small
decompressback to summary
public final int decompress(byte[] src, int srcOff, int srcLen, byte[] dest, int destOff)

Implements net.jpountz.lz4.LZ4UnknownSizeDecompressor.decompress.

Convenience method, equivalent to calling decompress(src, srcOff, srcLen, dest, destOff, dest.length - destOff).

decompressback to summary
public final int decompress(byte[] src, byte[] dest)

Convenience method, equivalent to calling decompress(src, 0, src.length, dest, 0)

decompressback to summary
public final byte[] decompress(byte[] src, int srcOff, int srcLen, int maxDestLen)

Convenience method which returns 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;
decompressback to summary
public final byte[] decompress(byte[] src, int maxDestLen)

Convenience method, equivalent to calling decompress(src, 0, src.length, maxDestLen).

decompressback to summary
public final void decompress(ByteBuffer src, ByteBuffer dest)

Decompress src into dest. src's ByteBuffer#remaining() must be exactly the size of the compressed data. This method moves the positions of the buffers.

toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object.

Returns:String

a string representation of the object.

Annotations
@Override