All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class fi.faidon.util.DataCompression

java.lang.Object
   |
   +----fi.faidon.util.DataCompression

public class DataCompression
extends Object

Constructor Index

 o DataCompression()

Method Index

 o getPackBitsMaxDestBytes(int)
Return the maximal possible buffer size needed for the destination byte array of packBits.
 o main(String[])
Program entry point.
 o packBits(byte[], byte[], int)
Pack "nbrSrcBytes" bytes of "srcBytes" into dstBytes that should be big enough to hold the packed data (see getPackBitsMaxDestBytes).
 o unPackBits(byte[], byte[], int, int)
"srcBytes" is the packed byte array, to unpack from the byte "indSrcStart".

Constructors

 o DataCompression
 public DataCompression()

Methods

 o main
 public static void main(String argv[])
Program entry point.

 o getPackBitsMaxDestBytes
 public static int getPackBitsMaxDestBytes(int nbrSrcBytes)
Return the maximal possible buffer size needed for the destination byte array of packBits.

 o packBits
 public static int packBits(byte srcBytes[],
                            byte dstBytes[],
                            int nbrSrcBytes)
Pack "nbrSrcBytes" bytes of "srcBytes" into dstBytes that should be big enough to hold the packed data (see getPackBitsMaxDestBytes). The number of packed bytes is returned.

 o unPackBits
 public static int unPackBits(byte srcBytes[],
                              byte dstBytes[],
                              int indSrcStart,
                              int nbrSrcBytes)
"srcBytes" is the packed byte array, to unpack from the byte "indSrcStart". "dstBytes" is the unpacked bytes buffer, which is filled up from the first byte and as far as possible. The return value is the number of bytes actually unpacked. Since Java doesn't allow parameter passing by reference, we have a one-element array "newInds" whose first element contains the new start index to use if there remains some bytes to unpack. "nbrSrcBytes" is the maximum number of source bytes to treat. This is useful if the packed data length is smaller than the source buffer size. "dstBytes" should be at least 127 bytes to always hold at least one packed item. Having a bigger buffer will speed things up. It should be a good idea to use a n*127 size buffer. "indSrcStart" should point to a byte count byte.


All Packages  Class Hierarchy  This Package  Previous  Next  Index