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

public Class LZFChunk

extends Object
Class Inheritance
Imports
java.io.*

Helper class used to store LZF encoded segments (compressed and non-compressed) that can be sequenced to produce LZF files/streams.
Author
Tatu Saloranta

Field Summary

Modifier and TypeField and Description
protected final byte[]
protected LZFChunk
public static final int
public static final int
public static final byte
public static final byte
public static final int
public static final int
public static final int
MAX_CHUNK_LEN

Chunk length is limited by 2-byte length indicator, to 64k

public static final int
MAX_HEADER_LEN

Header can be either 7 bytes (compressed) or 5 bytes (uncompressed) long

public static final int
MAX_LITERAL

Maximum length of literal run for LZF encoding.

Constructor Summary

AccessConstructor and Description
private
LZFChunk(byte[] data)

Method Summary

Modifier and TypeMethod and Description
public static int
appendCompressedHeader(int origLen, int encLen, byte[] headerBuffer, int offset)

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.

public static int
appendNonCompressedHeader(int len, byte[] headerBuffer, int offset)

public int
copyTo(byte[] dst, int ptr)

public static LZFChunk
createCompressed(int origLen, byte[] encData, int encPtr, int encLen)

Factory method for constructing compressed chunk

public static LZFChunk
createNonCompressed(byte[] plainData, int ptr, int len)

Factory method for constructing compressed chunk

public byte[]
public int
public LZFChunk
next()

public void
public static void
writeCompressedHeader(int origLen, int encLen, OutputStream out, byte[] headerBuffer)

public static void
writeNonCompressedHeader(int len, OutputStream out, byte[] headerBuffer)

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

_databack to summary
protected final byte[] _data
_nextback to summary
protected LZFChunk _next
BLOCK_TYPE_COMPRESSEDback to summary
public static final int BLOCK_TYPE_COMPRESSED
BLOCK_TYPE_NON_COMPRESSEDback to summary
public static final int BLOCK_TYPE_NON_COMPRESSED
BYTE_Vback to summary
public static final byte BYTE_V
BYTE_Zback to summary
public static final byte BYTE_Z
HEADER_LEN_COMPRESSEDback to summary
public static final int HEADER_LEN_COMPRESSED
HEADER_LEN_NOT_COMPRESSEDback to summary
public static final int HEADER_LEN_NOT_COMPRESSED
MAX_CHUNK_LENback to summary
public static final int MAX_CHUNK_LEN

Chunk length is limited by 2-byte length indicator, to 64k

MAX_HEADER_LENback to summary
public static final int MAX_HEADER_LEN

Header can be either 7 bytes (compressed) or 5 bytes (uncompressed) long

MAX_LITERALback to summary
public static final int MAX_LITERAL

Maximum length of literal run for LZF encoding.

Constructor Detail

LZFChunkback to summary
private LZFChunk(byte[] data)

Method Detail

appendCompressedHeaderback to summary
public static int appendCompressedHeader(int origLen, int encLen, byte[] headerBuffer, int offset)
appendNonCompressedback to summary
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.

appendNonCompressedHeaderback to summary
public static int appendNonCompressedHeader(int len, byte[] headerBuffer, int offset)
copyToback to summary
public int copyTo(byte[] dst, int ptr)
createCompressedback to summary
public static LZFChunk createCompressed(int origLen, byte[] encData, int encPtr, int encLen)

Factory method for constructing compressed chunk

createNonCompressedback to summary
public static LZFChunk createNonCompressed(byte[] plainData, int ptr, int len)

Factory method for constructing compressed chunk

getDataback to summary
public byte[] getData()
lengthback to summary
public int length()
nextback to summary
public LZFChunk next()
setNextback to summary
public void setNext(LZFChunk next)
writeCompressedHeaderback to summary
public static void writeCompressedHeader(int origLen, int encLen, OutputStream out, byte[] headerBuffer) throws IOException
writeNonCompressedHeaderback to summary
public static void writeNonCompressedHeader(int len, OutputStream out, byte[] headerBuffer) throws IOException