Compression/Decompression

Overview
Acknowledgments
Headers
Installation
Reference
Zlib Filters
Gzip Filters
Bzip2 Filters

Overview

The Boost Iostreams library provides three pairs of Filters for compression/decompression. The class templates basic_zlib_compressor and basic_zlib_decompressor perform compression and decompression in the ZLIB format ([Deutsch1]) using Jean-loup Gailly's and Mark Adler's zlib compression library ([Gailly]). The class templates basic_gzip_compressor and basic_gzip_decompressor perform compression and decompression in the GZIP format ([Deutsch3]), also using zlib. The class templates basic_bzip2_compressor and basic_bzip2_decompressor perform compression and decompression in the BZIP2 format using Julian Seward' libbzip2 compression library ([Seward]).

All the compression/decompression Filters are DualUseFilters so that they may be used for either input or output.[1] Most commonly, however, the compression Filters will be used for output and the decompression Filters for input.

Acknowledgments

The compression/decompression Filters were influences by the work of Jeff Garland ([Garland]) and Jonathan de Halleux ([de Halleux]). Thanks also to Jean-loup Gailly and Mark Adler and to Julian Seward for making their excellent librarys available to the public with Boost-compatible licenses.

Headers

<boost/iostreams/filter/zlib.hpp>
<boost/iostreams/filter/gzip.hpp>
<boost/iostreams/filter/bzip2.hpp>

Installation

The zlib and gzip Filters depend on the source file <libs/src/zlib.cpp>. The bzip2 Filters depend on the source file <libs/src/bzip2.cpp>. These source files use several headers from the zlib and gzip libraries, included with the Iostreams library distribution in the directories <libs/iostreams/src/zlib> and <libs/iostreams/src/bzip2>. Code using these filters must be linked against the zlib or libbzip2 binaries, which are available on most UNIX systems and which can be obtained for Windows systems here:

Alternatively, the binaries can be build from the source code ([Gailly], [Seward]).

Other Compression Methods

It is easy to write Filters based on compression algorithms from other libraries, such as LZO, OpenSSL and Crypto++. No Filters using LZO or OpenSSL are supplied since their licenses are not Boost-compatible. Most of Crypto++ is public domain, but providing Crypto++ filters would require including too many additional headers in the Iostreams library distribution.

In the future, additional compression methods may be added to the Iostreams library.


[1]Currently, basic_gzip_decompressor only models InputFilter, but this will be fixed soon.