blob: 32a84ba7991c92a4623de419815344249da120c7 [file] [log] [blame]
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<HTML>
<HEAD>
<TITLE>Gzip Filters</TITLE>
<LINK REL="stylesheet" HREF="../../../../boost.css">
<LINK REL="stylesheet" HREF="../theme/iostreams.css">
</HEAD>
<BODY>
<!-- Begin Banner -->
<H1 CLASS="title">Gzip Filters</H1>
<HR CLASS="banner">
<!-- End Banner -->
<DL class="page-index">
<DT><A href="#overview">Overview</A></DT>
<DT><A href="#acknowledgments">Acknowledgments</A></DT>
<DT><A href="#headers">Headers</A></DT>
<DT><A href="#synopsis">Synopsis</A></DT>
<DT><A HREF="#reference">Reference</A>
<DL class="page-index">
<DT><A HREF="#constants">namespace <CODE>boost::iostreams::gzip</CODE></A></DT>
<DT><A HREF="#gzip_params">Class <CODE>gzip_params</CODE></A></DT>
<DT><A HREF="#basic_gzip_compressor">Class template <CODE>gzip_compressor</CODE></A></DT>
<DT><A HREF="#basic_gzip_decompressor">Class template <CODE>gzip_decompressor</CODE></A></DT>
<DT><A HREF="#gzip_error">Class <CODE>gzip_error</CODE></A></DT>
</DL>
</DT>
<DT><A href="#examples">Examples</A></DT>
<DT><A href="#installation">Installation</A></DT>
</DL>
<A NAME="overview"></A>
<H2>Overview</H2>
<P>
The class templates <A HREF="#basic_gzip_compressor"><CODE>basic_gzip_compressor</CODE></A> and <A HREF="#basic_gzip_decompressor"><CODE>basic_gzip_decompressor</CODE></A> perform compression and decompression based on the G<SPAN STYLE="font-size:80%">ZIP</SPAN> format (<A CLASS="bib_ref" HREF="../bibliography.html#deutsch3">[Deutsch3]</A>) using Jean-loup Gailly's and Mark Adler's zlib compression library (<A CLASS="bib_ref" HREF="../bibliography.html#gailly">[Gailly]</A>). They are implementation as derived classes of the <A HREF="zlib.html">Zlib Filters</A>. The difference between the G<SPAN STYLE="font-size:80%">ZIP</SPAN> and Z<SPAN STYLE="font-size:80%">LIB</SPAN> formats is that data in the G<SPAN STYLE="font-size:80%">ZIP</SPAN> contains more header information and a different checksum (<A CLASS="bib_ref" HREF="../bibliography.html#deutsch1">[Deutsch1]</A>, <A CLASS="bib_ref" HREF="../bibliography.html#deutsch3">[Deutsch3]</A>).
</P>
<P>
Currently, <CODE>basic_gzip_compressor</CODE> is a <A HREF="../concepts/dual_use_filter.html">DualUseFilters</A>, but <CODE>basic_gzip_compressor</CODE> is only an <A HREF="../concepts/input_filter.html">InputFilter</A>.
</P>
<A NAME="acknowledgments"></A>
<H2>Acknowledgments</H2>
<P>
The gzip Filters were influences by the work of Jeff Garland (<A CLASS="bib_ref" HREF="../bibliography.html#garland">[Garland]</A>) and Jonathan de Halleux (<A CLASS="bib_ref" HREF="../bibliography.html#de_halleux">[de Halleux]</A>).
</P>
Thanks to <A HREF="mailto:jloup@gailly.net">Jean-loup Gailly</A> and <A HREF="mailto:&#109;&#097;&#100;&#108;&#101;&#114;&#064;&#097;&#108;&#117;&#109;&#110;&#105;&#046;&#099;&#097;&#108;&#116;&#101;&#099;&#104;&#046;&#101;&#100;&#117;">Mark Adler</A> for making their excellent library available to the public with a <A HREF="http://www.boost.org/more/lib_guide.htm#Requirements">Boost-compatible</A> license.
<A NAME="headers"></A>
<H2>Headers</H2>
<DL>
<DT><A CLASS="header" HREF="../../../../boost/iostreams/filter/gzip.hpp"><CODE>&lt;boost/iostreams/filter/gzip.hpp&gt;</CODE></A></DT>
</DL>
<A NAME="synopsis"></A>
<H2>Synopsis</H2>
<PRE CLASS="broken_ie"><SPAN CLASS="keyword">namespace</SPAN> boost { <SPAN CLASS="keyword">namespace</SPAN> iostreams {
<SPAN CLASS="keyword">namespace</SPAN> <A CLASS="documented" HREF="#constants">gzip</A> {
<SPAN CLASS="keyword">using</SPAN> <SPAN CLASS="keyword">namespace</SPAN> <A CLASS="documented" HREF="zlib.html#constants">boost::iostreams::zlib</A>;
<SPAN CLASS="comment">// Error codes used by gzip_error.</SPAN>
<SPAN CLASS="keyword">const</SPAN> <SPAN CLASS="keyword">int</SPAN> <A CLASS="documented" HREF="#zlib_error">zlib_error</A>;
<SPAN CLASS="keyword">const</SPAN> <SPAN CLASS="keyword">int</SPAN> <A CLASS="documented" HREF="#bad_crc">bad_crc</A>;
<SPAN CLASS="keyword">const</SPAN> <SPAN CLASS="keyword">int</SPAN> <A CLASS="documented" HREF="#bad_length">bad_length</A>;
<SPAN CLASS="keyword">const</SPAN> <SPAN CLASS="keyword">int</SPAN> <A CLASS="documented" HREF="#bad_header">bad_header</A>;
<SPAN CLASS="keyword">const</SPAN> <SPAN CLASS="keyword">int</SPAN> <A CLASS="documented" HREF="#bad_footer">bad_footer</A>;
} <SPAN CLASS="comment">// End namespace boost::iostreams::gzip</SPAN>
<SPAN CLASS="keyword">struct</SPAN> <A CLASS="documented" HREF="#gzip_params">gzip_params</A>;
<SPAN CLASS="keyword">template</SPAN><<SPAN CLASS="keyword">typename</SPAN> Alloc = std::allocator<<SPAN CLASS="keyword">char</SPAN>> >
<SPAN CLASS="keyword">struc</SPAN>t <A CLASS="documented" HREF="#basic_gzip_compressor">basic_gzip_compressor</A>;
<SPAN CLASS="keyword">template</SPAN><<SPAN CLASS="keyword">typename</SPAN> Alloc = std::allocator<<SPAN CLASS="keyword">char</SPAN>> >
<SPAN CLASS="keyword">struct</SPAN> <A CLASS="documented" HREF="#basic_gzip_decompressor">basic_gzip_decompressor</A>;
<SPAN CLASS="keyword">typedef</SPAN> basic_gzip_compressor<> <SPAN CLASS="defined">gzip_compressor</SPAN>;
<SPAN CLASS="keyword">typedef</SPAN> basic_gzip_decompressor<> <SPAN CLASS="defined">gzip_decompressor</SPAN>;
<SPAN CLASS="keyword">class</SPAN> <A CLASS="documented" HREF="#gzip_error">gzip_error</A>;
} } <SPAN CLASS="comment">// End namespace boost::io</SPAN></PRE>
<A NAME="reference"></A>
<H2>Reference</H2>
<A NAME="constants"></A>
<H3>Namespace <CODE>boost::iostreams::gzip</CODE></H3>
<P>The namespace <CODE>boost::iostreams::gzip</CODE> contains integral constants used to configure gzip Filters and to report errors. The constants have the following interpretations. (<I>See</I> <A CLASS="bib_ref" HREF="../bibliography.html#deutsch3">[Deutsch3]</A> for additional details.)</P>
<TABLE STYLE="margin-left:2em" BORDER=1 CELLPADDING=4>
<TR><TH>Constant</TH><TH>Interpretation</TH></TR>
<TR>
<TD VALIGN="top"><A NAME="zlib_error"></A><CODE>zlib_error</CODE></TD>
<TD>A zlib error has occured; use <A HREF="#gzip_error_zlib_error_code"><CODE>gzip_error::zlib_error_code</CODE></A> to obtain an error code.</TD>
</TR>
<TR>
<TD VALIGN="top"><A NAME="bad_crc"></A><CODE>bad_crc</CODE></TD>
<TD>Recorded crc doesn't match data.</TD>
</TR>
<TR>
<TD VALIGN="top"><A NAME="bad_length"></A><CODE>bad_length</CODE></TD>
<TD>Recorded length doesn't match data.</TD>
</TR>
<TR>
<TD VALIGN="top"><A NAME="bad_header"></A><CODE>bad_header</CODE></TD>
<TD>Malformed file header.</TD>
</TR>
<TR>
<TD VALIGN="top"><A NAME="bad_footer"></A><CODE>bad_footer</CODE></TD>
<TD>Portion of file following compressed data is malformed.</TD>
</TR>
</TABLE>
<A NAME="gzip_params"></A>
<H3>Class <CODE>gzip_params</CODE></H3>
<H4>Description</H4>
<P>Encapsulates the parameters used to configure <A HREF="#basic_gzip_compressor"><CODE>basic_gzip_compressor</CODE></A> and <A HREF="#basic_gzip_decompressor"><CODE>basic_gzip_decompressor</CODE></A>.</P>
<H4>Synopsis</H4>
<PRE CLASS="broken_ie"><SPAN CLASS="keyword">struct</SPAN> <SPAN CLASS="defined">gzip_params</SPAN> : <A CLASS="documented" HREF="zlib.html#zlib_params">zlib_params</A> {
<SPAN CLASS="comment">// Non-explicit constructor.</SPAN>
<A CLASS="documented" HREF="#gzip_params_constructor">gzip_params</A>( <SPAN CLASS="keyword">int</SPAN> level = <SPAN CLASS="omitted">default value</SPAN>,
<SPAN CLASS="keyword">int</SPAN> method = <SPAN CLASS="omitted">default value</SPAN>,
<SPAN CLASS="keyword">int</SPAN> window_bits = <SPAN CLASS="omitted">default value</SPAN>,
<SPAN CLASS="keyword">int</SPAN> mem_level = <SPAN CLASS="omitted">default value</SPAN>,
<SPAN CLASS="keyword">int</SPAN> strategy = <SPAN CLASS="omitted">default value</SPAN>,
std::string file_name = "",
std::string comment = "",
std::time_t mtime = 0 );
std::string file_name;
std::string comment;
std::time_t mtime;
};</PRE>
<A NAME="gzip_params_constructor"></A>
<H4><CODE>gzip_params::gzip_params</CODE></H4>
<PRE CLASS="broken_ie"> gzip_params( <SPAN CLASS="keyword">int</SPAN> level = <SPAN CLASS="omitted">default value</SPAN>,
<SPAN CLASS="keyword">int</SPAN> method = <SPAN CLASS="omitted">default value</SPAN>,
<SPAN CLASS="keyword">int</SPAN> window_bits = <SPAN CLASS="omitted">default value</SPAN>,
<SPAN CLASS="keyword">int</SPAN> mem_level = <SPAN CLASS="omitted">default value</SPAN>,
<SPAN CLASS="keyword">int</SPAN> strategy = <SPAN CLASS="omitted">default value</SPAN>,
std::string file_name = "",
std::string comment = "",
std::time_t mtime = 0 );</PRE>
<P>Constructs a <CODE>gzip_params</CODE> object, where the parameters have the following interpretations:</AP>
<TABLE STYLE="margin-left:2em" BORDER=0 CELLPADDING=2>
<TR>
<TR>
<TD VALIGN="top"><A NAME="level"></A><I>level</I></TD><TD WIDTH="2em" VALIGN="top">-</TD>
<TD>Compression level. Must be equal to <CODE>zlib::default_compression</CODE> or a value in the range <CODE>0-9</CODE>. The value <CODE>0</CODE> yields no compression, while <CODE>9</CODE> yields the best compression ratio. Affects compression only.</TD>
</TR>
<TR>
<TD VALIGN="top"><A NAME="method"></A><I>method</I></TD><TD WIDTH="2em" VALIGN="top">-</TD>
<TD>Compression method. Must equal <A HREF="zlib.html#deflated"><CODE>zlib::deflated</CODE></A>. Affects compression only.</TD>
</TR>
<TR>
<TD VALIGN="top"><A NAME="window_bits"></A><I>window_bits</I></TD><TD WIDTH="2em" VALIGN="top">-</TD>
<TD>The base two logarithm of the window size. Must be in the range 8-15; defaults to 15.</TD>
</TR>
<TR>
<TD VALIGN="top"><A NAME="mem_level"></A><I>mem_level</I></TD><TD WIDTH="2em" VALIGN="top">-</TD>
<TD>Specifies the amount of memory to be used. Must be in the range 1-9; defaults to 8. Affects compression only.</TD>
</TR>
<TR>
<TD VALIGN="top"><A NAME="strategy"></A><I>strategy</I></TD><TD WIDTH="2em" VALIGN="top">-</TD>
<TD>Must be <A HREF="zlib.html#default_strategy"><CODE>zlib::default_strategy</CODE></A>, <A HREF="zlib.html#filtered"><CODE>zlib::filtered</CODE></A> or <A HREF="zlib.html#huffman_only"><CODE>zlib::huffman_only</CODE></A>. Affects compression only. </TD>
</TR>
<TR>
<TD VALIGN="top"><A NAME="file_name"></A><I>file_name</I></TD><TD WIDTH="2em" VALIGN="top">-</TD>
<TD>Represents the optional section of the G<SPAN STYLE="font-size:80%">ZIP</SPAN> header containing a file name.</TD>
</TR>
<TR>
<TD VALIGN="top"><A NAME="comment"></A><I>comment</I></TD><TD WIDTH="2em" VALIGN="top">-</TD>
<TD>Represents the optional section of the G<SPAN STYLE="font-size:80%">ZIP</SPAN> header containing a comment.</TD>
</TR>
<TR>
<TD VALIGN="top"><A NAME="mtime"></A><I>mtime</I></TD><TD WIDTH="2em" VALIGN="top">-</TD>
<TD>Represents the optional section of the G<SPAN STYLE="font-size:80%">ZIP</SPAN> header containing a file modification time.</TD>
</TR>
</TABLE>
<P>See <A CLASS="bib_ref" HREF="../bibliography.html#gailly">[Gailly]</A> and <A CLASS="bib_ref" HREF="../bibliography.html#deutsch1">[Deutsch1]</A> for additional details.</P>
<A NAME="basic_gzip_compressor"></A>
<H3>Class template <CODE>basic_gzip_compressor</CODE></H3>
<H4>Description</H4>
<P>Model of <A HREF="../concepts/dual_use_filter.html">DualUseFilter</A> which compresses data in the G<SPAN STYLE="font-size:80%">ZIP</SPAN> format (<A CLASS="bib_ref" HREF="../bibliography.html#deutsch3">[Deutsch3]</A>).</P>
<H4>Synopsis</H4>
<PRE CLASS="broken_ie"><SPAN CLASS="keyword">template</SPAN>&lt;<SPAN CLASS="keyword">typename</SPAN> <A CLASS="documented" HREF="#basic_gzip_compressor_params">Alloc</A> = std::allocator&lt;<SPAN CLASS="keyword">char</SPAN>&gt; &gt;
<SPAN CLASS="keyword">struct</SPAN> <A CLASS="documented" HREF="#basic_gzip_compressor_params">basic_gzip_compressor</A> {
<SPAN CLASS="keyword">typedef</SPAN> <SPAN CLASS="keyword">char</SPAN> char_type;
<SPAN CLASS="keyword">typedef</SPAN> <SPAN CLASS="omitted">implementation-defined</SPAN> category;
<A CLASS="documented" HREF="#basic_gzip_compressor_ctors">basic_gzip_compressor</A>( <SPAN CLASS="keyword">const</SPAN> <A CLASS="documented" HREF="#gzip_params">gzip_params</A>& = <SPAN CLASS="omitted">zlib::default_compression</SPAN>,
std::streamsize buffer_size = <SPAN CLASS="omitted">default value</SPAN> );
<SPAN CLASS="comment">// DualUseFilter members.</SPAN>
};
<SPAN CLASS="keyword">typedef</SPAN> basic_gzip_compressor<> <SPAN CLASS="defined">gzip_compressor</SPAN>;</PRE>
<A NAME="basic_gzip_compressor_params"></A>
<H4>Template Parameters</H4>
<TABLE STYLE="margin-left:2em" BORDER=0 CELLPADDING=2>
<TR>
<TR>
<TD VALIGN="top"><I>Alloc</I></TD><TD WIDTH="2em" VALIGN="top">-</TD>
<TD>A C++ standard library allocator type (<A CLASS="bib_ref" HREF="../bibliography.html#iso">[ISO]</A>, 20.1.5), used to allocate a character buffer and to configure zlib.</TD>
</TR>
</TABLE>
<A NAME="basic_gzip_compressor_ctors"></A>
<H4><CODE>basic_gzip_compressor::basic_gzip_compressor</CODE></H4>
<PRE CLASS="broken_ie"> basic_gzip_compressor( <SPAN CLASS="keyword">const</SPAN> gzip_params& = <SPAN CLASS="omitted">zlib::default_compression</SPAN>,
std::streamsize buffer_size = <SPAN CLASS="omitted">default value</SPAN> );</PRE>
<P>Constructs an instance of <CODE>basic_gzip_compressor</CODE> with the given parameters and buffer size. Since a <A CLASS="documented" HREF="#gzip_params"><CODE>gzip_params</CODE></A> object is implicitly constructible from an <CODE>int</CODE> representing a compression level, an <CODE>int</CODE> may be passed as the first constructor argument.</P>
<A NAME="basic_gzip_decompressor"></A>
<H3>Class template <CODE>basic_gzip_decompressor</CODE></H3>
<H4>Description</H4>
<P>Model of <A HREF="../concepts/dual_use_filter.html">DualUseFilter</A> which decompresses data in the G<SPAN STYLE="font-size:80%">ZIP</SPAN> format (<A CLASS="bib_ref" HREF="../bibliography.html#deutsch3">[Deutsch3]</A>).</P>
<H4>Synopsis</H4>
<PRE CLASS="broken_ie"><SPAN CLASS="keyword">template</SPAN>&lt;<SPAN CLASS="keyword">typename</SPAN> <A CLASS="documented" HREF="#basic_gzip_decompressor_params">Alloc</A> = std::allocator&lt;<SPAN CLASS="keyword">char</SPAN>&gt; &gt;
<SPAN CLASS="keyword">struct</SPAN> <A CLASS="documented" HREF="#basic_gzip_decompressor_params">basic_gzip_decompressor</A> {
<SPAN CLASS="keyword">typedef</SPAN> <SPAN CLASS="keyword">char</SPAN> char_type;
<SPAN CLASS="keyword">typedef</SPAN> <SPAN CLASS="omitted">implementation-defined</SPAN> category;
<A CLASS="documented" HREF="#basic_gzip_decompressor_constructor">basic_gzip_decompressor</A>( <SPAN CLASS="keyword">int</SPAN> window_bits = <SPAN CLASS="omitted">default value</SPAN>,
std::streamsize buffer_size =
<SPAN CLASS="omitted">default value</SPAN> );
<SPAN CLASS="comment">// DualUseFilter members.</SPAN>
};
<SPAN CLASS="keyword">typedef</SPAN> basic_gzip_decompressor<> <SPAN CLASS="defined">gzip_decompressor</SPAN>;</PRE>
<A NAME="basic_gzip_decompressor_params"></A>
<H4>Template Parameters</H4>
<TABLE STYLE="margin-left:2em" BORDER=0 CELLPADDING=2>
<TR>
<TR>
<TD VALIGN="top"><I>Alloc</I></TD><TD WIDTH="2em" VALIGN="top">-</TD>
<TD>A C++ standard library allocator type (<A CLASS="bib_ref" HREF="../bibliography.html#iso">[ISO]</A>, 20.1.5), used to allocate a character buffer and to configure zlib.</TD>
</TR>
</TABLE>
<A NAME="basic_gzip_decompressor_constructor"></A>
<H4><CODE>basic_gzip_decompressor::basic_gzip_decompressor</CODE></H4>
<PRE CLASS="broken_ie"> basic_gzip_decompressor( <SPAN CLASS="keyword">int</SPAN> window_bits = <SPAN CLASS="omitted">default value</SPAN>,
std::streamsize buffer_size =
<SPAN CLASS="omitted">default value</SPAN> );</PRE>
<P>Constructs an instance of <CODE>basic_gzip_decompressor</CODE> with the given <A HREF="#window_bits">window bits</A> value and buffer size. Other parameters affecting decompression are set to default values.</P>
<A NAME="gzip_error"></A>
<H3>Class <CODE>gzip_error</CODE></H3>
<H4>Description</H4>
Used by the gzip Filters to report errors.
<H4>Synopsis</H4>
<PRE CLASS="broken_ie"><SPAN CLASS="keyword">class</SPAN> <SPAN CLASS="defined">gzip_error</SPAN> : <SPAN CLASS="keyword">public</SPAN> std::ios_base::failure {
<SPAN CLASS="keyword">public:</SPAN>
<A CLASS="documented" HREF="#gzip_error_constructor">gzip_error</A>(<SPAN CLASS="keyword">int</SPAN> error);
<A CLASS="documented" HREF="#gzip_error_constructor">gzip_error</A>(<SPAN CLASS="keyword">const</SPAN> <A CLASS="documented" HREF="zlib.html#zlib_error">zlib_error</A>& e);
<SPAN CLASS="keyword">int</SPAN> <A CLASS="documented" HREF="#gzip_error_error">error</A>() <SPAN CLASS="keyword">const</SPAN>;
<SPAN CLASS="keyword">int</SPAN> <A CLASS="documented" HREF="#gzip_error_zlib_error_code">zlib_error_code</A>() <SPAN CLASS="keyword">const</SPAN>;
};</PRE>
<A NAME="gzip_error_constructor"></A>
<H4><CODE>gzip_error::gzip_error</CODE></H4>
<PRE CLASS="broken_ie"> gzip_error(<SPAN CLASS="keyword">int</SPAN> error);
gzip_error(<SPAN CLASS="keyword">const</SPAN> <A HREF="#zlib_error">zlib_error</A>& e);</PRE>
<P>The first member constructs an instance of <CODE>gzip_error</CODE> with the given error code from the namespace <A HREF="#constants"><CODE>boost::iostreams::gzip</CODE></A>. The second constructs an instance of <CODE>gzip_error</CODE> based on an instance of <A HREF="zlib.html#zlib_error"><CODE>zlib_error</CODE></A>.</P>
<A NAME="gzip_error_error"></A>
<H4><CODE>gzip_error::error</CODE></H4>
<PRE CLASS="broken_ie"> <SPAN CLASS="keyword">void</SPAN> error() <SPAN CLASS="keyword">const</SPAN>;</PRE>
<P>Returns an error code from the namespace <A HREF="#constants"><CODE>boost::iostreams::gzip</CODE></A>.</P>
<A NAME="gzip_error_zlib_error_code"></A>
<PRE CLASS="broken_ie"> <SPAN CLASS="keyword">void</SPAN> zlib_error_code() <SPAN CLASS="keyword">const</SPAN>;</PRE>
<P>Returns an error code from the namespace <A HREF="zlib.html#constants"><CODE>boost::iostreams::zlib</CODE></A>. Meaningful only if <A HREF="#gzip_error_error"><CODE>error()</CODE></A> returns the constant <A HREF="#constants"><CODE>boost::iostreams::gzip::zlib_error</CODE></A>.</P>
<A NAME="examples"></A>
<H2>Examples</H2>
The following code decompresses data from a file and writes it to standard output.
<PRE CLASS="broken_ie"><SPAN CLASS="preprocessor">#include</SPAN> <SPAN CLASS="literal">&lt;fstream&gt;</SPAN>
<SPAN CLASS="preprocessor">#include</SPAN> <SPAN CLASS="literal">&lt;iostream&gt;</SPAN>
<SPAN CLASS="preprocessor">#include</SPAN> <A CLASS="header" HREF="../../../../boost/iostreams/filtering_streambuf.hpp"><SPAN CLASS="literal">&lt;boost/iostreams/filtering_streambuf.hpp&gt;</SPAN></A>
<SPAN CLASS="preprocessor">#include</SPAN> <A CLASS="header" HREF="../../../../boost/iostreams/copy.hpp"><SPAN CLASS="literal">&lt;boost/iostreams/copy.hpp&gt;</SPAN></A>
<SPAN CLASS="preprocessor">#include</SPAN> <A CLASS="header" HREF="../../../../boost/iostreams/filter/gzip.hpp"><SPAN CLASS="literal">&lt;boost/iostreams/filter/gzip.hpp&gt;</SPAN></A>
int main()
{
<SPAN CLASS="keyword">using</SPAN> <SPAN CLASS="keyword">namespace</SPAN> std;
ifstream file(<SPAN CLASS="literal">"hello.gz"</SPAN>, ios_base::in | ios_base::binary);
filtering_streambuf&lt;input&gt; in;
in.push(gzip_decompressor());
in.push(file);
boost::iostreams::copy(in, cout);
}</PRE>
<A NAME="installation"></A>
<H3>Installation</H3>
<P>
The gzip Filters depend on the third-party zlib library, which is <I>not</I> included in the Boost distribution. Prebuilt zlib binaries are available on most UNIX and UNIX-like systems, and will be found automatically by the Boost build system. Windows users can obtain prebuilt binaries at the <A HREF="http://www.gzip.org/zlib/">zlib homepage</A>. Users can also configure the Boost Iostream library to build zlib from the source code, which is available at the zlib homepage. For details on configuring the build system to find your zlib installation, please see <A HREF="../installation.html">Installation</A>.
</P>
<!-- Adler's obfuscated address is copied from his homepage -->
<!-- Begin Footer -->
<HR>
<P CLASS="copyright">Revised 02 Feb 2008</P>
<P CLASS="copyright">&copy; Copyright 2008 <a href="http://www.coderage.com/" target="_top">CodeRage, LLC</a><br/>&copy; Copyright 2004-2007 <a href="http://www.coderage.com/turkanis/" target="_top">Jonathan Turkanis</a></P>
<P CLASS="copyright">
Distributed under the Boost Software License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at <A HREF="http://www.boost.org/LICENSE_1_0.txt">http://www.boost.org/LICENSE_1_0.txt</A>)
</P>
<!-- End Footer -->
</BODY>