public class SimpleHuffProcessor extends Object implements IHuffProcessor
ALPH_SIZE, BITS_PER_INT, BITS_PER_WORD, MAGIC_NUMBER, STORE_COUNTS, STORE_CUSTOM, STORE_TREE| Constructor and Description | 
|---|
| SimpleHuffProcessor() | 
| Modifier and Type | Method and Description | 
|---|---|
| int | compress(InputStream in,
        OutputStream out,
        boolean force)Compresses input to output, where the same InputStream has
 previously been pre-processed via  preprocessCompressstoring state used by this call. | 
| int | preprocessCompress(InputStream in,
                  int headerFormat)Preprocess data so that compression is possible ---
 count characters/create tree/store state so that
 a subsequent call to compress will work. | 
| void | setViewer(IHuffViewer viewer)Make sure this model communicates with some view. | 
| int | uncompress(InputStream in,
          OutputStream out)Uncompress a previously compressed stream in, writing the
 uncompressed bits/data to out. | 
public int compress(InputStream in, OutputStream out, boolean force) throws IOException
IHuffProcessorpreprocessCompress
 storing state used by this call.
 preprocessCompress must be called before this methodcompress in interface IHuffProcessorin - is the stream being compressed (NOT a BitInputStream)out - is bound to a file/stream to which bits are written
 for the compressed file (not a BitOutputStream)force - if this is true create the output file even if it is larger than the input file.
 If this is false do not create the output file if it is larger than the input file.IOException - if an error occurs while reading from the input file or
 writing to the output file.public int preprocessCompress(InputStream in, int headerFormat) throws IOException
IHuffProcessorpreprocessCompress in interface IHuffProcessorin - is the stream which could be subsequently compressedheaderFormat - a constant from IHuffProcessor that determines what kind of
 header to use, standard count format, standard tree format, or
 possibly some format added in the future.IOException - if an error occurs while reading from the input file.public void setViewer(IHuffViewer viewer)
IHuffProcessorsetViewer in interface IHuffProcessorviewer - is the view for communicating.public int uncompress(InputStream in, OutputStream out) throws IOException
IHuffProcessoruncompress in interface IHuffProcessorin - is the previously compressed data (not a BitInputStream)out - is the uncompressed file/streamIOException - if an error occurs while reading from the input file or
 writing to the output file.