com.ning.compress.lzf
Class LZFDecoder

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

public class LZFDecoder
extends Object

Decoder that handles decoding of sequence of encoded LZF chunks, combining them into a single contiguous result byte array

Author:
[email protected]

Method Summary
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.
static 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.
static 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.
static 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.
static 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.
static void decompressChunk(byte[] in, int inPos, byte[] out, int outPos, int outEnd)
          Main decode method for individual chunks.
static int decompressChunk(InputStream is, byte[] inputBuffer, byte[] outputBuffer)
          Main decode from a stream.
protected static int readHeader(InputStream is, byte[] inputBuffer)
          Helper method to forcibly load header bytes that must be read before chunk can be handled.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

decode

public static byte[] decode(byte[] inputBuffer)
                     throws IOException
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. Note that input MUST consists of a sequence of one or more complete chunks; partial chunks can not be handled.

Throws:
IOException

decode

public static byte[] decode(byte[] inputBuffer,
                            int inputPtr,
                            int inputLen)
                     throws IOException
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. Note that input MUST consists of a sequence of one or more complete chunks; partial chunks can not be handled.

Throws:
IOException
Since:
0.8.2

decode

public static int decode(byte[] inputBuffer,
                         byte[] targetBuffer)
                  throws IOException
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. Note that input MUST consists of a sequence of one or more complete chunks; partial chunks can not be handled.

Throws:
IOException

decode

public static int decode(byte[] sourceBuffer,
                         int inPtr,
                         int inLength,
                         byte[] targetBuffer)
                  throws IOException
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. Note that input MUST consists of a sequence of one or more complete chunks; partial chunks can not be handled.

Throws:
IOException

calculateUncompressedSize

public static int calculateUncompressedSize(byte[] data,
                                            int ptr,
                                            int length)
                                     throws IOException
Helper method that will calculate total uncompressed size, for sequence of one or more LZF blocks stored in given byte array. Will do basic sanity checking, so that this method can be called to verify against some types of corruption.

Throws:
IOException

decompressChunk

public static int decompressChunk(InputStream is,
                                  byte[] inputBuffer,
                                  byte[] outputBuffer)
                           throws IOException
Main decode from a stream. Decompressed bytes are placed in the outputBuffer, inputBuffer is a "scratch-area".

Parameters:
is - An input stream of LZF compressed bytes
inputBuffer - A byte array used as a scratch area.
outputBuffer - A byte array in which the result is returned
Returns:
The number of bytes placed in the outputBuffer.
Throws:
IOException

decompressChunk

public static void decompressChunk(byte[] in,
                                   int inPos,
                                   byte[] out,
                                   int outPos,
                                   int outEnd)
                            throws IOException
Main decode method for individual chunks.

Throws:
IOException

readHeader

protected static int readHeader(InputStream is,
                                byte[] inputBuffer)
                         throws IOException
Helper method to forcibly load header bytes that must be read before chunk can be handled.

Throws:
IOException


Copyright © 2011. All Rights Reserved.