|
Elexis API documentationVersion 2.1.6 as of December 11 2011 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectch.rgw.compress.Huff
public class Huff
Simple implementation of the Huffman compression algorithm. Consists solely of static functions.
To compress data:
This implementation uses an extension to the straightforward algorithm to deal with the situation of a character being written, which was not in the table, and with end-of-file conditions. In such cases, an escape character (0x07) will be written and specially interpreted
Field Summary | |
---|---|
static int |
eof
|
static byte |
escape
|
Constructor Summary | |
---|---|
Huff()
|
Method Summary | |
---|---|
static byte[] |
decode(HuffmanTree tree,
byte[] source)
Huffman decode the source array |
static java.lang.String |
decodeString(HuffmanTree tree,
byte[] in)
Decode a previously with encodeString compressed String |
static byte[] |
encode(HuffmanTree tree,
byte[] source)
Huffman encode the source array |
static byte[] |
encodeString(HuffmanTree tree,
java.lang.String i)
Huffman encode a String |
static void |
main(java.lang.String[] argv)
The main function can be used to accomplish a few tasks regarding persistent storage of Huffman tables.: java -classpath . ch.rgw.tools.Compress.Huff list: shows all stored tables in the system Preferences java -classpath . ch.rgw.tools.Compress.Huff create |
static java.lang.String |
Version()
|
static void |
writeEOF(ch.rgw.compress.HuffmanTree.Node act,
BitOutputStream out)
|
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final byte escape
public static final int eof
Constructor Detail |
---|
public Huff()
Method Detail |
---|
public static java.lang.String Version()
public static byte[] encode(HuffmanTree tree, byte[] source)
tree
- a Hufmann tree as created by new Tree() or nullsource
- the source to compress. If tree is null, the Tree will be computed from the source
first and its frequency table is included in the output.
public static byte[] decode(HuffmanTree tree, byte[] source)
tree
- a Huffman tree as created by new Tree() or nullsource
- A huffman compressed array as returned by encode(). If tree is null, the frequency
count is expected to be included to the source.
public static byte[] encodeString(HuffmanTree tree, java.lang.String i)
public static java.lang.String decodeString(HuffmanTree tree, byte[] in)
public static void writeEOF(ch.rgw.compress.HuffmanTree.Node act, BitOutputStream out) throws java.io.IOException
java.io.IOException
public static void main(java.lang.String[] argv)
|
Elexis API documentationVersion 2.1.6 as of December 11 2011 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |