Package com.ning.compress.lzf
Class LZFDecoder
java.lang.Object
com.ning.compress.lzf.LZFDecoder
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.- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected static final AtomicReference
<ChunkDecoder> Lazily initialized "fast" instance that may usesun.misc.Unsafe
to speed up decompressionprotected static final AtomicReference
<ChunkDecoder> Lazily initialized "safe" instance that DOES NOT usesun.misc.Unsafe
for decompression, just standard JDK functionality. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic 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.static byte[]
decode
(byte[] inputBuffer) static int
decode
(byte[] inputBuffer, byte[] targetBuffer) static byte[]
decode
(byte[] inputBuffer, int offset, int length) static int
decode
(byte[] sourceBuffer, int offset, int length, byte[] targetBuffer) static ChunkDecoder
Accessor method that can be used to obtainChunkDecoder
that uses all possible optimization methods available, includingsun.misc.Unsafe
for memory access.static byte[]
safeDecode
(byte[] inputBuffer) static int
safeDecode
(byte[] inputBuffer, byte[] targetBuffer) static byte[]
safeDecode
(byte[] inputBuffer, int offset, int length) static int
safeDecode
(byte[] sourceBuffer, int offset, int length, byte[] targetBuffer) static ChunkDecoder
Accessor method that can be used to obtainChunkDecoder
that only uses standard JDK access methods, and should work on all Java platforms and JVMs.
-
Field Details
-
_fastDecoderRef
Lazily initialized "fast" instance that may usesun.misc.Unsafe
to speed up decompression -
_safeDecoderRef
Lazily initialized "safe" instance that DOES NOT usesun.misc.Unsafe
for decompression, just standard JDK functionality.
-
-
Constructor Details
-
LZFDecoder
public LZFDecoder()
-
-
Method Details
-
fastDecoder
Accessor method that can be used to obtainChunkDecoder
that uses all possible optimization methods available, includingsun.misc.Unsafe
for memory access. -
safeDecoder
Accessor method that can be used to obtainChunkDecoder
that only uses standard JDK access methods, and should work on all Java platforms and JVMs. -
calculateUncompressedSize
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.- Throws:
LZFException
-
decode
- Throws:
LZFException
-
decode
- Throws:
LZFException
-
decode
- Throws:
LZFException
-
decode
public static int decode(byte[] sourceBuffer, int offset, int length, byte[] targetBuffer) throws LZFException - Throws:
LZFException
-
safeDecode
- Throws:
LZFException
-
safeDecode
- Throws:
LZFException
-
safeDecode
- Throws:
LZFException
-
safeDecode
public static int safeDecode(byte[] sourceBuffer, int offset, int length, byte[] targetBuffer) throws LZFException - Throws:
LZFException
-