public class Huffman extends Object
Huffman class provides static methods for compressing
and expanding a binary input using Huffman codes over the 8-bit extended
ASCII alphabet.
For additional documentation, see Section 5.5 of Algorithms, 4th Edition by Robert Sedgewick and Kevin Wayne.
| Modifier and Type | Method and Description |
|---|---|
static void |
compress()
Reads a sequence of 8-bit bytes from standard input; compresses them
using Huffman codes with an 8-bit alphabet; and writes the results
to standard output.
|
static void |
expand()
Reads a sequence of bits that represents a Huffman-compressed message from
standard input; expands them; and writes the results to standard output.
|
static void |
main(String[] args)
Sample client that calls
compress() if the command-line
argument is "-" an expand() if it is "+". |
public static void compress()
public static void expand()
public static void main(String[] args)
compress() if the command-line
argument is "-" an expand() if it is "+".args - the command-line arguments