com.ning.compress.lzf
Class LZFChunk

java.lang.Object
  extended by com.ning.compress.lzf.LZFChunk

public class LZFChunk
extends Object

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

Author:
[email protected]

Field Summary
protected  byte[] _data
           
protected  LZFChunk _next
           
static int BLOCK_TYPE_COMPRESSED
           
static int BLOCK_TYPE_NON_COMPRESSED
           
static byte BYTE_V
           
static byte BYTE_Z
           
static int MAX_CHUNK_LEN
           
static int MAX_HEADER_LEN
          Header can be either 7 bytes (compressed) or 5 bytes (uncompressed) long
static int MAX_LITERAL
          Maximum length of literal run for LZF encoding.
 
Method Summary
 int copyTo(byte[] dst, int ptr)
           
static LZFChunk createCompressed(int origLen, byte[] encData, int encPtr, int encLen)
          Factory method for constructing compressed chunk
static LZFChunk createNonCompressed(byte[] plainData, int ptr, int len)
          Factory method for constructing compressed chunk
 byte[] getData()
           
 int length()
           
 LZFChunk next()
           
 void setNext(LZFChunk next)
           
static void writeCompressedHeader(int origLen, int encLen, OutputStream out, byte[] headerBuffer)
           
static void writeNonCompressedHeader(int len, OutputStream out, byte[] headerBuffer)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

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
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

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


writeCompressedHeader

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

createNonCompressed

public static LZFChunk createNonCompressed(byte[] plainData,
                                           int ptr,
                                           int len)
Factory method for constructing compressed chunk


writeNonCompressedHeader

public static void writeNonCompressedHeader(int len,
                                            OutputStream out,
                                            byte[] headerBuffer)
                                     throws IOException
Throws:
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)


Copyright © 2011. All Rights Reserved.