Package com.ning.compress.lzf
Class LZFChunk
- java.lang.Object
-
- com.ning.compress.lzf.LZFChunk
-
public class LZFChunk extends java.lang.ObjectHelper class used to store LZF encoded segments (compressed and non-compressed) that can be sequenced to produce LZF files/streams.
-
-
Field Summary
Fields Modifier and Type Field Description protected byte[]_dataprotected LZFChunk_nextstatic intBLOCK_TYPE_COMPRESSEDstatic intBLOCK_TYPE_NON_COMPRESSEDstatic byteBYTE_Vstatic byteBYTE_Zstatic intHEADER_LEN_COMPRESSEDstatic intHEADER_LEN_NOT_COMPRESSEDstatic intMAX_CHUNK_LENChunk length is limited by 2-byte length indicator, to 64kstatic intMAX_HEADER_LENHeader can be either 7 bytes (compressed) or 5 bytes (uncompressed) longstatic intMAX_LITERALMaximum length of literal run for LZF encoding.
-
Constructor Summary
Constructors Modifier Constructor Description privateLZFChunk(byte[] data)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static intappendCompressedHeader(int origLen, int encLen, byte[] headerBuffer, int offset)static intappendNonCompressed(byte[] plainData, int ptr, int len, byte[] outputBuffer, int outputPtr)Method for appending specific content as non-compressed chunk, in given buffer.static intappendNonCompressedHeader(int len, byte[] headerBuffer, int offset)intcopyTo(byte[] dst, int ptr)static LZFChunkcreateCompressed(int origLen, byte[] encData, int encPtr, int encLen)Factory method for constructing compressed chunkstatic LZFChunkcreateNonCompressed(byte[] plainData, int ptr, int len)Factory method for constructing compressed chunkbyte[]getData()intlength()LZFChunknext()voidsetNext(LZFChunk next)static voidwriteCompressedHeader(int origLen, int encLen, java.io.OutputStream out, byte[] headerBuffer)static voidwriteNonCompressedHeader(int len, java.io.OutputStream out, byte[] headerBuffer)
-
-
-
Field Detail
-
MAX_LITERAL
public static final int MAX_LITERAL
Maximum length of literal run for LZF encoding.- See Also:
- Constant Field Values
-
MAX_CHUNK_LEN
public static final int MAX_CHUNK_LEN
Chunk length is limited by 2-byte length indicator, to 64k- See Also:
- Constant Field Values
-
MAX_HEADER_LEN
public static final int MAX_HEADER_LEN
Header can be either 7 bytes (compressed) or 5 bytes (uncompressed) long- See Also:
- Constant Field Values
-
HEADER_LEN_COMPRESSED
public static final int HEADER_LEN_COMPRESSED
- See Also:
- Constant Field Values
-
HEADER_LEN_NOT_COMPRESSED
public static final int HEADER_LEN_NOT_COMPRESSED
- See Also:
- Constant Field Values
-
BYTE_Z
public static final byte BYTE_Z
- See Also:
- Constant Field Values
-
BYTE_V
public static final byte BYTE_V
- See Also:
- Constant Field Values
-
BLOCK_TYPE_NON_COMPRESSED
public static final int BLOCK_TYPE_NON_COMPRESSED
- See Also:
- Constant Field Values
-
BLOCK_TYPE_COMPRESSED
public static final int BLOCK_TYPE_COMPRESSED
- See Also:
- Constant Field Values
-
_data
protected final byte[] _data
-
_next
protected LZFChunk _next
-
-
Method Detail
-
createCompressed
public static LZFChunk createCompressed(int origLen, byte[] encData, int encPtr, int encLen)
Factory method for constructing compressed chunk
-
appendCompressedHeader
public static int appendCompressedHeader(int origLen, int encLen, byte[] headerBuffer, int offset)
-
writeCompressedHeader
public static void writeCompressedHeader(int origLen, int encLen, java.io.OutputStream out, byte[] headerBuffer) throws java.io.IOException- Throws:
java.io.IOException
-
createNonCompressed
public static LZFChunk createNonCompressed(byte[] plainData, int ptr, int len)
Factory method for constructing compressed chunk
-
appendNonCompressed
public static int appendNonCompressed(byte[] plainData, int ptr, int len, byte[] outputBuffer, int outputPtr)Method for appending specific content as non-compressed chunk, in given buffer.
-
appendNonCompressedHeader
public static int appendNonCompressedHeader(int len, byte[] headerBuffer, int offset)
-
writeNonCompressedHeader
public static void writeNonCompressedHeader(int len, java.io.OutputStream out, byte[] headerBuffer) throws java.io.IOException- Throws:
java.io.IOException
-
setNext
public void setNext(LZFChunk next)
-
next
public LZFChunk next()
-
length
public int length()
-
getData
public byte[] getData()
-
copyTo
public int copyTo(byte[] dst, int ptr)
-
-