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. More...
#include <deflateoutputstreambuf.h>
Public Member Functions | |
bool | closeStream () |
DeflateOutputStreambuf (streambuf *outbuf, bool user_init=false, bool del_outbuf=false) | |
DeflateOutputStreambuf constructor. | |
uint32 | getCount () const |
Returns the number of bytes written to the streambuf, that has been processed from the input buffer by the compressor. | |
uint32 | getCrc32 () const |
Returns the CRC32 for the current stream. | |
bool | init (int comp_level=6) |
virtual | ~DeflateOutputStreambuf () |
Destructor. | |
Protected Member Functions | |
void | endDeflation () |
Flushes the remaining data in the zlib buffers, after which the only possible operations are deflateEnd() or deflateReset(). | |
bool | flushOutvec () |
Flushes _outvec and updates _zs.next_out and _zs.avail_out. | |
virtual int | overflow (int c=EOF) |
virtual int | sync () |
Protected Attributes | |
uint32 | _crc32 |
vector< char > | _invec |
const int | _invecsize |
vector< char > | _outvec |
const int | _outvecsize |
uint32 | _overflown_bytes |
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.
zipios::DeflateOutputStreambuf::DeflateOutputStreambuf | ( | streambuf * | outbuf, | |
bool | user_init = false , |
|||
bool | del_outbuf = false | |||
) | [explicit] |
DeflateOutputStreambuf constructor.
outbuf | 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.
References init().
zipios::DeflateOutputStreambuf::~DeflateOutputStreambuf | ( | ) | [virtual] |
bool zipios::DeflateOutputStreambuf::closeStream | ( | ) |
Definition at line 88 of file deflateoutputstreambuf.cpp.
References endDeflation().
Referenced by zipios::ZipOutputStreambuf::closeEntry(), zipios::GZIPOutputStreambuf::finish(), and ~DeflateOutputStreambuf().
void zipios::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.
References _outvec, _outvecsize, flushOutvec(), and overflow().
Referenced by closeStream(), and init().
bool zipios::DeflateOutputStreambuf::flushOutvec | ( | ) | [protected] |
Flushes _outvec and updates _zs.next_out and _zs.avail_out.
Definition at line 162 of file deflateoutputstreambuf.cpp.
References zipios::FilterOutputStreambuf::_outbuf, _outvec, and _outvecsize.
Referenced by endDeflation(), and overflow().
uint32 zipios::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.
Referenced by zipios::ZipOutputStreambuf::updateEntryHeaderInfo().
uint32 zipios::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.
Referenced by zipios::ZipOutputStreambuf::updateEntryHeaderInfo().
bool zipios::DeflateOutputStreambuf::init | ( | int | comp_level = 6 |
) |
Definition at line 51 of file deflateoutputstreambuf.cpp.
References _crc32, _invec, _invecsize, _outvec, _outvecsize, _overflown_bytes, and endDeflation().
Referenced by DeflateOutputStreambuf(), and zipios::ZipOutputStreambuf::putNextEntry().
int zipios::DeflateOutputStreambuf::overflow | ( | int | c = EOF |
) | [protected, virtual] |
Reimplemented in zipios::GZIPOutputStreambuf, and zipios::ZipOutputStreambuf.
Definition at line 109 of file deflateoutputstreambuf.cpp.
References _crc32, _invec, _invecsize, _outvec, _outvecsize, _overflown_bytes, flushOutvec(), and zipios::OutputStringStream::str().
Referenced by endDeflation().
int zipios::DeflateOutputStreambuf::sync | ( | ) | [protected, virtual] |
Reimplemented in zipios::GZIPOutputStreambuf, and zipios::ZipOutputStreambuf.
Definition at line 155 of file deflateoutputstreambuf.cpp.
uint32 zipios::DeflateOutputStreambuf::_crc32 [protected] |
Definition at line 77 of file deflateoutputstreambuf.h.
Referenced by init(), and overflow().
vector< char > zipios::DeflateOutputStreambuf::_invec [protected] |
Definition at line 73 of file deflateoutputstreambuf.h.
Referenced by init(), and overflow().
const int zipios::DeflateOutputStreambuf::_invecsize [protected] |
Definition at line 72 of file deflateoutputstreambuf.h.
Referenced by init(), and overflow().
vector< char > zipios::DeflateOutputStreambuf::_outvec [protected] |
Definition at line 75 of file deflateoutputstreambuf.h.
Referenced by endDeflation(), flushOutvec(), init(), and overflow().
const int zipios::DeflateOutputStreambuf::_outvecsize [protected] |
Definition at line 74 of file deflateoutputstreambuf.h.
Referenced by endDeflation(), flushOutvec(), init(), and overflow().
Definition at line 78 of file deflateoutputstreambuf.h.
Referenced by init(), and overflow().