Package com.ning.compress.lzf
Class LZFDecoder
- java.lang.Object
-
- com.ning.compress.lzf.LZFDecoder
-
public class LZFDecoder extends java.lang.ObjectDecoder that handles decoding of sequence of encoded LZF chunks, combining them into a single contiguous result byte array. This class has been mostly replaced byChunkDecoder, although static methods are left here and may still be used for convenience. All static methods useChunkDecoderFactory.optimalInstance()to find actualChunkDecoderinstance to use.- See Also:
ChunkDecoder
-
-
Field Summary
Fields Modifier and Type Field Description protected static java.util.concurrent.atomic.AtomicReference<ChunkDecoder>_fastDecoderRefLazily initialized "fast" instance that may usesun.misc.Unsafeto speed up decompressionprotected static java.util.concurrent.atomic.AtomicReference<ChunkDecoder>_safeDecoderRefLazily initialized "safe" instance that DOES NOT usesun.misc.Unsafefor decompression, just standard JDK functionality.
-
Constructor Summary
Constructors Constructor Description LZFDecoder()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static intcalculateUncompressedSize(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 intdecode(byte[] inputBuffer, byte[] targetBuffer)static byte[]decode(byte[] inputBuffer, int offset, int length)static intdecode(byte[] sourceBuffer, int offset, int length, byte[] targetBuffer)static ChunkDecoderfastDecoder()Accessor method that can be used to obtainChunkDecoderthat uses all possible optimization methods available, includingsun.misc.Unsafefor memory access.static byte[]safeDecode(byte[] inputBuffer)static intsafeDecode(byte[] inputBuffer, byte[] targetBuffer)static byte[]safeDecode(byte[] inputBuffer, int offset, int length)static intsafeDecode(byte[] sourceBuffer, int offset, int length, byte[] targetBuffer)static ChunkDecodersafeDecoder()Accessor method that can be used to obtainChunkDecoderthat only uses standard JDK access methods, and should work on all Java platforms and JVMs.
-
-
-
Field Detail
-
_fastDecoderRef
protected static final java.util.concurrent.atomic.AtomicReference<ChunkDecoder> _fastDecoderRef
Lazily initialized "fast" instance that may usesun.misc.Unsafeto speed up decompression
-
_safeDecoderRef
protected static final java.util.concurrent.atomic.AtomicReference<ChunkDecoder> _safeDecoderRef
Lazily initialized "safe" instance that DOES NOT usesun.misc.Unsafefor decompression, just standard JDK functionality.
-
-
Method Detail
-
fastDecoder
public static ChunkDecoder fastDecoder()
Accessor method that can be used to obtainChunkDecoderthat uses all possible optimization methods available, includingsun.misc.Unsafefor memory access.
-
safeDecoder
public static ChunkDecoder safeDecoder()
Accessor method that can be used to obtainChunkDecoderthat 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 LZFExceptionHelper method that checks resulting size of an LZF chunk, regardless of whether it contains compressed or uncompressed contents.- Throws:
LZFException
-
decode
public static byte[] decode(byte[] inputBuffer) throws LZFException- Throws:
LZFException
-
decode
public static byte[] decode(byte[] inputBuffer, int offset, int length) throws LZFException- Throws:
LZFException
-
decode
public static int decode(byte[] inputBuffer, byte[] targetBuffer) throws LZFException- Throws:
LZFException
-
decode
public static int decode(byte[] sourceBuffer, int offset, int length, byte[] targetBuffer) throws LZFException- Throws:
LZFException
-
safeDecode
public static byte[] safeDecode(byte[] inputBuffer) throws LZFException- Throws:
LZFException
-
safeDecode
public static byte[] safeDecode(byte[] inputBuffer, int offset, int length) throws LZFException- Throws:
LZFException
-
safeDecode
public static int safeDecode(byte[] inputBuffer, byte[] targetBuffer) throws LZFException- Throws:
LZFException
-
safeDecode
public static int safeDecode(byte[] sourceBuffer, int offset, int length, byte[] targetBuffer) throws LZFException- Throws:
LZFException
-
-