Top Description Fields Constructors Methods
com.ning.compress.lzf

public Class LZFDecoder

extends Object
Class Inheritance
Imports
java.util.concurrent.atomic.AtomicReference, com.ning.compress.lzf.util.ChunkDecoderFactory

Decoder that handles decoding of sequence of encoded LZF chunks, combining them into a single contiguous result byte array. This class has been mostly replaced by ChunkDecoder, although static methods are left here and may still be used for convenience. All static methods use ChunkDecoderFactory#optimalInstance to find actual ChunkDecoder instance to use.
Author
Tatu Saloranta ([email protected])
See Also
com.ning.compress.lzf.ChunkDecoder

Field Summary

Modifier and TypeField and Description
protected static final AtomicReference<ChunkDecoder>
_fastDecoderRef

Lazily initialized "fast" instance that may use sun.misc.Unsafe to speed up decompression

protected static final AtomicReference<ChunkDecoder>
_safeDecoderRef

Lazily initialized "safe" instance that DOES NOT use sun.misc.Unsafe for decompression, just standard JDK functionality.

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public static int
calculateUncompressedSize(byte[] data, int offset, int length)

Helper method that checks resulting size of an LZF chunk, regardless of whether it contains compressed or uncompressed contents.

public static byte[]
decode(final byte[] inputBuffer)

public static byte[]
decode(final byte[] inputBuffer, int offset, int length)

public static int
decode(final byte[] inputBuffer, final byte[] targetBuffer)

public static int
decode(final byte[] sourceBuffer, int offset, int length, final byte[] targetBuffer)

public static ChunkDecoder
fastDecoder()

Accessor method that can be used to obtain ChunkDecoder that uses all possible optimization methods available, including sun.misc.Unsafe for memory access.

public static byte[]
safeDecode(final byte[] inputBuffer)

public static byte[]
safeDecode(final byte[] inputBuffer, int offset, int length)

public static int
safeDecode(final byte[] inputBuffer, final byte[] targetBuffer)

public static int
safeDecode(final byte[] sourceBuffer, int offset, int length, final byte[] targetBuffer)

public static ChunkDecoder
safeDecoder()

Accessor method that can be used to obtain ChunkDecoder that only uses standard JDK access methods, and should work on all Java platforms and JVMs.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

_fastDecoderRefback to summary
protected static final AtomicReference<ChunkDecoder> _fastDecoderRef

Lazily initialized "fast" instance that may use sun.misc.Unsafe to speed up decompression

_safeDecoderRefback to summary
protected static final AtomicReference<ChunkDecoder> _safeDecoderRef

Lazily initialized "safe" instance that DOES NOT use sun.misc.Unsafe for decompression, just standard JDK functionality.

Constructor Detail

LZFDecoderback to summary
public LZFDecoder()

Method Detail

calculateUncompressedSizeback to summary
public static int calculateUncompressedSize(byte[] data, int offset, int length) throws LZFException

Helper method that checks resulting size of an LZF chunk, regardless of whether it contains compressed or uncompressed contents.

decodeback to summary
public static byte[] decode(final byte[] inputBuffer) throws LZFException
decodeback to summary
public static byte[] decode(final byte[] inputBuffer, int offset, int length) throws LZFException
decodeback to summary
public static int decode(final byte[] inputBuffer, final byte[] targetBuffer) throws LZFException
decodeback to summary
public static int decode(final byte[] sourceBuffer, int offset, int length, final byte[] targetBuffer) throws LZFException
fastDecoderback to summary
public static ChunkDecoder fastDecoder()

Accessor method that can be used to obtain ChunkDecoder that uses all possible optimization methods available, including sun.misc.Unsafe for memory access.

safeDecodeback to summary
public static byte[] safeDecode(final byte[] inputBuffer) throws LZFException
safeDecodeback to summary
public static byte[] safeDecode(final byte[] inputBuffer, int offset, int length) throws LZFException
safeDecodeback to summary
public static int safeDecode(final byte[] inputBuffer, final byte[] targetBuffer) throws LZFException
safeDecodeback to summary
public static int safeDecode(final byte[] sourceBuffer, int offset, int length, final byte[] targetBuffer) throws LZFException
safeDecoderback to summary
public static ChunkDecoder safeDecoder()

Accessor method that can be used to obtain ChunkDecoder that only uses standard JDK access methods, and should work on all Java platforms and JVMs.