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. More... | |
uint32 | getCount () const |
Returns the number of bytes written to the streambuf, that has been processed from the input buffer by the compressor. More... | |
uint32 | getCrc32 () const |
Returns the CRC32 for the current stream. More... | |
bool | init (int comp_level=6) |
virtual | ~DeflateOutputStreambuf () |
Destructor. More... | |
Public Member Functions inherited from zipios::FilterOutputStreambuf | |
FilterOutputStreambuf (streambuf *outbuf, bool del_outbuf=false) | |
Constructor. More... | |
virtual | ~FilterOutputStreambuf () |
Destructor. More... | |
Protected Member Functions | |
void | endDeflation () |
Flushes the remaining data in the zlib buffers, after which the only possible operations are deflateEnd() or deflateReset(). More... | |
bool | flushOutvec () |
Flushes _outvec and updates _zs.next_out and _zs.avail_out. More... | |
virtual int | overflow (int c=EOF) |
virtual int | sync () |
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.
|
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. |
References init().
|
virtual |
Destructor.
References closeStream().
bool zipios::DeflateOutputStreambuf::closeStream | ( | ) |
References endDeflation().
Referenced by zipios::ZipOutputStreambuf::closeEntry(), zipios::GZIPOutputStreambuf::finish(), and ~DeflateOutputStreambuf().
|
protected |
Flushes the remaining data in the zlib buffers, after which the only possible operations are deflateEnd() or deflateReset().
References flushOutvec(), and overflow().
Referenced by closeStream(), and init().
|
protected |
Flushes _outvec and updates _zs.next_out and _zs.avail_out.
Referenced by endDeflation(), and overflow().
uint32 zipios::DeflateOutputStreambuf::getCount | ( | ) | const |
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.
Referenced by zipios::ZipOutputStreambuf::updateEntryHeaderInfo().
uint32 zipios::DeflateOutputStreambuf::getCrc32 | ( | ) | const |
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.
Referenced by zipios::ZipOutputStreambuf::updateEntryHeaderInfo().
References endDeflation().
Referenced by DeflateOutputStreambuf(), DocumentObject.DocumentObject::onChanged(), and zipios::ZipOutputStreambuf::putNextEntry().
Reimplemented in zipios::GZIPOutputStreambuf, and zipios::ZipOutputStreambuf.
References flushOutvec(), and zipios::OutputStringStream::str().
Referenced by endDeflation(), zipios::GZIPOutputStreambuf::overflow(), and zipios::ZipOutputStreambuf::overflow().
|
protectedvirtual |
Reimplemented in zipios::GZIPOutputStreambuf, and zipios::ZipOutputStreambuf.
Referenced by zipios::GZIPOutputStreambuf::sync(), and zipios::ZipOutputStreambuf::sync().