public interface IHuffProcessor extends IHuffConstants
ALPH_SIZE, BITS_PER_INT, BITS_PER_WORD, MAGIC_NUMBER, STORE_COUNTS, STORE_CUSTOM, STORE_TREE
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
preprocessCompress
storing 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.
|
void setViewer(IHuffViewer viewer)
viewer
- is the view for communicating.int preprocessCompress(InputStream in, int headerFormat) throws IOException
in
- 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.int compress(InputStream in, OutputStream out, boolean force) throws IOException
preprocessCompress
storing state used by this call.
preprocessCompress
must be called before this methodin
- 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.int uncompress(InputStream in, OutputStream out) throws IOException
in
- 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.