zipios++
2.0.2
Zipios++ – a small C++ library that provides easy access to .zip files.
|
A ZipOutputStream to allow for data to be compressed zlib. More...
#include <zipoutputstream.hpp>
Public Member Functions | |
ZipOutputStream (std::ostream &os) | |
Initialize a ZipOutputStream object. More... | |
virtual | ~ZipOutputStream () |
Clean up a ZipOutputStream object. More... | |
void | close () |
Close the current stream. More... | |
void | closeEntry () |
void | finish () |
Finish up the output by flushing anything left. More... | |
void | putNextEntry (FileEntry::pointer_t entry) |
Add an entry to the output stream. More... | |
void | setComment (std::string const &comment) |
Set the global comment. More... | |
Private Attributes | |
std::unique_ptr< std::ofstream > | m_ofs |
std::unique_ptr < ZipOutputStreambuf > | m_ozf |
ZipOutputStream is an internal ostream implementation used to save a collection of files to a Zip archive file.
Definition at line 41 of file zipoutputstream.hpp.
zipios::ZipOutputStream::ZipOutputStream | ( | std::ostream & | os | ) |
The ZipOutputStream constructor create an output stream that will be used to save Zip data to a file.
[in] | os | The output stream to use to write the Zip archive. |
Definition at line 54 of file zipoutputstream.cpp.
References m_ozf.
|
virtual |
The destructor makes sure that all resources allocated by the ZipOutputStream object.
Definition at line 67 of file zipoutputstream.cpp.
void zipios::ZipOutputStream::close | ( | ) |
This function calls close() on the internal stream. After this call any attempt in writing to the file will fail.
The result is to ensure that the Zip archive file is complete and all buffers flushed to file.
Definition at line 90 of file zipoutputstream.cpp.
References m_ozf.
Referenced by zipios::ZipFile::saveCollectionToArchive().
void zipios::ZipOutputStream::closeEntry | ( | ) |
Closes the current entry updates its header with the relevant size information and positions the stream write pointer for the next entry header. Puts the stream in EOF state. Call putNextEntry() to clear the EOF stream state flag.
Definition at line 76 of file zipoutputstream.cpp.
References m_ozf.
Referenced by zipios::ZipFile::saveCollectionToArchive().
void zipios::ZipOutputStream::finish | ( | ) |
This function closes the current entry (if one is open) by writing 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 103 of file zipoutputstream.cpp.
References m_ozf.
Referenced by zipios::ZipFile::saveCollectionToArchive().
void zipios::ZipOutputStream::putNextEntry | ( | FileEntry::pointer_t | entry | ) |
This function saves the header of the entry and returns. The caller is expected to save the actual data of the file.
[in] | entry | The FileEntry to add to the output stream. |
Definition at line 129 of file zipoutputstream.cpp.
References m_ozf.
Referenced by zipios::ZipFile::saveCollectionToArchive().
void zipios::ZipOutputStream::setComment | ( | std::string const & | comment | ) |
This function is used to setup the Global Comment of the Zip archive file.
This comment is saved at the very end of the file, attached to the EndOfCentralDirectory block.
[in] | comment | The global comment to save in the Zip archive. |
Definition at line 154 of file zipoutputstream.cpp.
References m_ozf.
Referenced by zipios::ZipFile::saveCollectionToArchive().
|
private |
Definition at line 54 of file zipoutputstream.hpp.
|
private |
Definition at line 55 of file zipoutputstream.hpp.
Referenced by close(), closeEntry(), finish(), putNextEntry(), setComment(), and ZipOutputStream().