How the Compression Folio Works


The sections below describe how to compress and decompress data.

Compressing Data

To compress data, you must create a compression engine by calling CreateCompressor().

You must also allocate a buffer of the correct size and supply a pointer to it with the COMP_TAG_WORKBUFFER tag and pass in a pointer to your output function.

Once you create the engine, call FeedCompressor() to have the engine compress the data you supply. FeedCompressor() then gives data to the compression engine, which in turn sends it to your output function, one word at a time. When the compression engine is finished compressing the data, call DeleteCompressor() to delete the engine and clean up.

Decompressing Data

Decompression works almost the same as compressing data. First, you create a decompression engine with CreateDecompressor(). Then, allocate a buffer of the correct size and supply a pointer to it with the COMP_TAG_WORKBUFFER tag and provide a pointer to your output function.

Feed compressed data to the decompression engine with the FeedDecompressorEngine() call, which in turn sends it to the output call. Again when you are finished decompressing data, call DeleteDecompressor() to delete the engine and clean up.