public abstract class ChunkDecoder extends Object
Note that instances have no state, so they are fully thread-safe and reusable.
| Modifier and Type | Field and Description |
|---|---|
protected static byte |
BYTE_NULL |
protected static int |
HEADER_BYTES |
| Constructor and Description |
|---|
ChunkDecoder() |
| Modifier and Type | Method and Description |
|---|---|
protected void |
_reportArrayOverflow(byte[] targetBuffer,
int outPtr,
int dataLen)
Helper method called when it is determined that the target buffer can not
hold all data to copy or uncompress
|
protected void |
_reportCorruptHeader() |
static int |
calculateUncompressedSize(byte[] data,
int ptr,
int length)
Helper method that will calculate total uncompressed size, for sequence of
one or more LZF blocks stored in given byte array.
|
byte[] |
decode(byte[] inputBuffer)
Method for decompressing a block of input data encoded in LZF
block structure (compatible with lzf command line utility),
and can consist of any number of blocks.
|
int |
decode(byte[] inputBuffer,
byte[] targetBuffer)
Method for decompressing a block of input data encoded in LZF
block structure (compatible with lzf command line utility),
and can consist of any number of blocks.
|
byte[] |
decode(byte[] inputBuffer,
int inputPtr,
int inputLen)
Method for decompressing a block of input data encoded in LZF
block structure (compatible with lzf command line utility),
and can consist of any number of blocks.
|
int |
decode(byte[] sourceBuffer,
int inPtr,
int inLength,
byte[] targetBuffer)
Method for decompressing a block of input data encoded in LZF
block structure (compatible with LZF command line utility),
and can consist of any number of blocks.
|
abstract void |
decodeChunk(byte[] in,
int inPos,
byte[] out,
int outPos,
int outEnd)
Main decode method for individual chunks.
|
abstract int |
decodeChunk(InputStream is,
byte[] inputBuffer,
byte[] outputBuffer)
Main decode from a stream.
|
protected static void |
readFully(InputStream is,
boolean compressed,
byte[] outputBuffer,
int offset,
int len) |
protected static int |
readHeader(InputStream is,
byte[] inputBuffer)
Helper method to forcibly load header bytes that must be read before
chunk can be handled.
|
protected static void |
skipFully(InputStream is,
int amount) |
abstract int |
skipOrDecodeChunk(InputStream is,
byte[] inputBuffer,
byte[] outputBuffer,
long maxToSkip) |
protected static int |
uint16(byte[] data,
int ptr) |
protected static final byte BYTE_NULL
protected static final int HEADER_BYTES
public final byte[] decode(byte[] inputBuffer)
throws LZFException
LZFExceptionpublic final byte[] decode(byte[] inputBuffer,
int inputPtr,
int inputLen)
throws LZFException
LZFExceptionpublic final int decode(byte[] inputBuffer,
byte[] targetBuffer)
throws LZFException
LZFExceptionpublic int decode(byte[] sourceBuffer,
int inPtr,
int inLength,
byte[] targetBuffer)
throws LZFException
LZFExceptionpublic abstract int decodeChunk(InputStream is, byte[] inputBuffer, byte[] outputBuffer) throws IOException
is - An input stream of LZF compressed bytesinputBuffer - A byte array used as a scratch area.outputBuffer - A byte array in which the result is returnedIOExceptionpublic abstract void decodeChunk(byte[] in,
int inPos,
byte[] out,
int outPos,
int outEnd)
throws LZFException
LZFExceptionpublic abstract int skipOrDecodeChunk(InputStream is, byte[] inputBuffer, byte[] outputBuffer, long maxToSkip) throws IOException
returnValue = -(decodedAmount + 2))IOExceptionpublic static int calculateUncompressedSize(byte[] data,
int ptr,
int length)
throws LZFException
LZFExceptionprotected static final int uint16(byte[] data,
int ptr)
protected static final int readHeader(InputStream is, byte[] inputBuffer) throws IOException
IOExceptionprotected static final void readFully(InputStream is, boolean compressed, byte[] outputBuffer, int offset, int len) throws IOException
IOExceptionprotected static final void skipFully(InputStream is, int amount) throws IOException
IOExceptionprotected void _reportCorruptHeader()
throws LZFException
LZFExceptionprotected void _reportArrayOverflow(byte[] targetBuffer,
int outPtr,
int dataLen)
throws LZFException
LZFExceptionCopyright © 2023 FasterXML. All rights reserved.