zipios::DeflateOutputStreambuf - DeflateOutputStreambuf is an output stream filter, that deflates the
Contents
Constructor & Destructor Documentation
zipios::DeflateOutputStreambuf::DeflateOutputStreambuf(streambuf*outbuf,booluser_init=false,booldel_outbuf=false)[explicit]DeflateOutputStreambuf constructor.
Parametersoutbuf the streambuf to use for output.
user_init If false user must invoke init() before writing any data. (ZipOutputStreambuf needs to do
this)
del_outbuf if true is specified outbuf will be deleted, when the DeflateOutputStreambuf is
destructed.
Definition at line 18 of file deflateoutputstreambuf.cpp.
zipios::DeflateOutputStreambuf::~DeflateOutputStreambuf()[virtual]
Destructor.
Definition at line 43 of file deflateoutputstreambuf.cpp.
Detailed Description
DeflateOutputStreambuf is an output stream filter, that deflates the data that is written to it before it
passes it on to the output stream it is attached to.
Deflation/Inflation is a compression/decompression method used in gzip and zip. The zlib library is used
to perform the actual deflation, this class only wraps the functionality in an output stream filter.
Definition at line 25 of file deflateoutputstreambuf.h.
Member Function Documentation
voidzipios::DeflateOutputStreambuf::endDeflation()[protected]
Flushes the remaining data in the zlib buffers, after which the only possible operations are deflateEnd()
or deflateReset().
Definition at line 173 of file deflateoutputstreambuf.cpp.
boolzipios::DeflateOutputStreambuf::flushOutvec()[protected]
Flushes _outvec and updates _zs.next_out and _zs.avail_out.
Definition at line 162 of file deflateoutputstreambuf.cpp.
uint32zipios::DeflateOutputStreambuf::getCount()const[inline]
Returns the number of bytes written to the streambuf, that has been processed from the input buffer by
the compressor. After closeStream() has been called this number is the total number of bytes written to
the stream.
Definition at line 55 of file deflateoutputstreambuf.h.
uint32zipios::DeflateOutputStreambuf::getCrc32()const[inline]
Returns the CRC32 for the current stream. The returned value is the CRC for the data that has been
compressed already (due to a call to overflow()). As DeflateOutputStreambuf may buffer an arbitrary
amount of bytes until closeStream() has been invoked, the returned value is not very useful before
closeStream() has been called.
Definition at line 49 of file deflateoutputstreambuf.h.
Name
zipios::DeflateOutputStreambuf - DeflateOutputStreambuf is an output stream filter, that deflates the
data that is written to it before it passes it on to the output stream it is attached to.
Synopsis
#include <deflateoutputstreambuf.h>
Inherits zipios::FilterOutputStreambuf.
Inherited by zipios::GZIPOutputStreambuf, and zipios::ZipOutputStreambuf.
PublicMemberFunctionsDeflateOutputStreambuf (streambuf *outbuf, bool user_init=false, bool del_outbuf=false)
DeflateOutputStreambuf constructor.
virtual ~DeflateOutputStreambuf ()
Destructor.
bool init (int comp_level=6)
bool closeStream ()
uint32 getCrc32 () const
Returns the CRC32 for the current stream.
uint32 getCount () const
Returns the number of bytes written to the streambuf, that has been processed from the input buffer
by the compressor.
ProtectedMemberFunctions
virtual int overflow (int c=EOF)
virtual int sync ()
bool flushOutvec ()
Flushes _outvec and updates _zs.next_out and _zs.avail_out.
void endDeflation ()
Flushes the remaining data in the zlib buffers, after which the only possible operations are
deflateEnd() or deflateReset().
ProtectedAttributes
const int _invecsize
vector< char > _invec
const int _outvecsize
vector< char > _outvec
uint32 _crc32
uint32 _overflown_bytes