ZipOutputStreambuf is a zip output streambuf filter. More...
#include <zipoutputstreambuf.h>
Public Types | |
enum | CompressionLevels { NO_COMPRESSION = Z_NO_COMPRESSION, BEST_SPEED = Z_BEST_SPEED, BEST_COMPRESSION = Z_BEST_COMPRESSION, DEFAULT_COMPRESSION = Z_DEFAULT_COMPRESSION } |
Public Member Functions | |
void | close () |
Calls finish. | |
void | closeEntry () |
Closes the current entry, and positions the stream read pointer at the beginning of the next entry (if there is one). | |
void | finish () |
Closes the current entry (if one is open), then writes the Zip Central Directory Structure closing the ZipOutputStream. | |
void | putNextEntry (const ZipCDirEntry &entry) |
Begins writing the next entry. | |
void | setComment (const string &comment) |
Sets the global comment for the Zip archive. | |
void | setLevel (int level) |
Sets the compression level to be used for subsequent entries. | |
void | setMethod (StorageMethod method) |
Sets the compression method to be used. | |
ZipOutputStreambuf (streambuf *outbuf, bool del_outbuf=false) | |
ZipOutputStreambuf constructor. | |
virtual | ~ZipOutputStreambuf () |
Destructor. | |
Protected Member Functions | |
virtual int | overflow (int c=EOF) |
void | setEntryClosedState () |
virtual int | sync () |
void | updateEntryHeaderInfo () |
Static Protected Member Functions | |
static void | writeCentralDirectory (const vector< ZipCDirEntry > &entries, EndOfCentralDirectory eocd, ostream &os) |
ZipOutputStreambuf is a zip output streambuf filter.
Definition at line 17 of file zipoutputstreambuf.h.
Definition at line 20 of file zipoutputstreambuf.h.
zipios::ZipOutputStreambuf::ZipOutputStreambuf | ( | streambuf * | outbuf, | |
bool | del_outbuf = false | |||
) | [explicit] |
ZipOutputStreambuf constructor.
A newly constructed ZipOutputStreambuf is not ready to accept data, putNextEntry() must be invoked first.
outbuf | the streambuf to use for input. | |
del_outbuf | if true is specified outbuf will be deleted, when the ZipOutputStreambuf is destructed. |
Definition at line 21 of file zipoutputstreambuf.cpp.
zipios::ZipOutputStreambuf::~ZipOutputStreambuf | ( | ) | [virtual] |
void zipios::ZipOutputStreambuf::close | ( | ) |
Calls finish.
Definition at line 42 of file zipoutputstreambuf.cpp.
References finish().
Referenced by zipios::ZipOutputStream::close().
void zipios::ZipOutputStreambuf::closeEntry | ( | ) |
Closes the current entry, and positions the stream read pointer at the beginning of the next entry (if there is one).
Definition at line 31 of file zipoutputstreambuf.cpp.
References zipios::DeflateOutputStreambuf::closeStream(), setEntryClosedState(), and updateEntryHeaderInfo().
Referenced by zipios::ZipOutputStream::closeEntry(), finish(), and putNextEntry().
void zipios::ZipOutputStreambuf::finish | ( | ) |
Closes the current entry (if one is open), then writes the Zip Central Directory Structure closing the ZipOutputStream.
The output stream that the zip archive is being written to is not closed.
Definition at line 47 of file zipoutputstreambuf.cpp.
References zipios::FilterOutputStreambuf::_outbuf, closeEntry(), and writeCentralDirectory().
Referenced by close(), zipios::ZipOutputStream::finish(), and ~ZipOutputStreambuf().
int zipios::ZipOutputStreambuf::overflow | ( | int | c = EOF |
) | [protected, virtual] |
Reimplemented from zipios::DeflateOutputStreambuf.
Definition at line 109 of file zipoutputstreambuf.cpp.
void zipios::ZipOutputStreambuf::putNextEntry | ( | const ZipCDirEntry & | entry | ) |
Begins writing the next entry.
Opens the next entry in the zip archive and returns a const pointer to a FileEntry object for the entry.
Definition at line 62 of file zipoutputstreambuf.cpp.
References zipios::FilterOutputStreambuf::_outbuf, closeEntry(), zipios::DeflateOutputStreambuf::init(), zipios::ZipCDirEntry::setLocalHeaderOffset(), and zipios::ZipLocalEntry::setMethod().
Referenced by zipios::ZipOutputStream::putNextEntry().
void zipios::ZipOutputStreambuf::setComment | ( | const string & | comment | ) |
Sets the global comment for the Zip archive.
Definition at line 84 of file zipoutputstreambuf.cpp.
Referenced by zipios::ZipOutputStream::setComment().
void zipios::ZipOutputStreambuf::setEntryClosedState | ( | ) | [protected] |
Definition at line 128 of file zipoutputstreambuf.cpp.
Referenced by closeEntry().
void zipios::ZipOutputStreambuf::setLevel | ( | int | level | ) |
Sets the compression level to be used for subsequent entries.
Definition at line 89 of file zipoutputstreambuf.cpp.
Referenced by zipios::ZipOutputStream::setLevel(), and setMethod().
void zipios::ZipOutputStreambuf::setMethod | ( | StorageMethod | method | ) |
Sets the compression method to be used.
only STORED and DEFLATED are supported.
Definition at line 94 of file zipoutputstreambuf.cpp.
References DEFAULT_COMPRESSION, zipios::DEFLATED, NO_COMPRESSION, setLevel(), and zipios::STORED.
Referenced by zipios::ZipOutputStream::setMethod().
int zipios::ZipOutputStreambuf::sync | ( | ) | [protected, virtual] |
Reimplemented from zipios::DeflateOutputStreambuf.
Definition at line 119 of file zipoutputstreambuf.cpp.
void zipios::ZipOutputStreambuf::updateEntryHeaderInfo | ( | ) | [protected] |
Definition at line 135 of file zipoutputstreambuf.cpp.
References zipios::FilterOutputStreambuf::_outbuf, zipios::DeflateOutputStreambuf::getCount(), zipios::DeflateOutputStreambuf::getCrc32(), zipios::ZipCDirEntry::getLocalHeaderOffset(), zipios::ZipLocalEntry::getLocalHeaderSize(), zipios::ZipLocalEntry::setCompressedSize(), zipios::ZipLocalEntry::setCrc(), zipios::ZipLocalEntry::setSize(), and zipios::ZipLocalEntry::setTime().
Referenced by closeEntry().
void zipios::ZipOutputStreambuf::writeCentralDirectory | ( | const vector< ZipCDirEntry > & | entries, | |
EndOfCentralDirectory | eocd, | |||
ostream & | os | |||
) | [static, protected] |
Definition at line 165 of file zipoutputstreambuf.cpp.
References zipios::EndOfCentralDirectory::setCDirSize(), zipios::EndOfCentralDirectory::setOffset(), and zipios::EndOfCentralDirectory::setTotalCount().
Referenced by finish().