zipios++
2.0.2
Zipios++ – a small C++ library that provides easy access to .zip files.
|
A stream implementation that outputs data to a ZIP file. More...
#include <gzipoutputstream.hpp>
Public Member Functions | |
GZIPOutputStream (std::ostream &os, FileEntry::CompressionLevel compression_level) | |
Create a ZIP output stream object. More... | |
GZIPOutputStream (std::string const &filename, FileEntry::CompressionLevel compression_level) | |
Create a named ZIP stream for output. More... | |
virtual | ~GZIPOutputStream () |
Destroy the output stream. More... | |
void | close () |
Close the streams. More... | |
void | finish () |
Finishes the stream. More... | |
void | setComment (std::string const &comment) |
Set a comment in the stream. More... | |
void | setFilename (std::string const &filename) |
Set the filename of a stream. More... | |
Private Attributes | |
std::unique_ptr< std::ofstream > | m_ofs |
std::unique_ptr < GZIPOutputStreambuf > | m_ozf |
GZIPOutputStream is an ostream that writes the output to a zip file. The interface approximates the interface of the Java GZIPOutputStream.
It can be used with either an existing std::ostream object, or a filename.
Definition at line 42 of file gzipoutputstream.hpp.
zipios::GZIPOutputStream::GZIPOutputStream | ( | std::ostream & | os, |
FileEntry::CompressionLevel | compression_level | ||
) |
This constructor creates a zip stream from an existing standard output stream.
os
stream.)[in,out] | os | ostream to which the compressed zip archive is written. |
[in] | compression_level | The compression level to use to compress. |
Definition at line 63 of file gzipoutputstream.cpp.
References m_ozf.
zipios::GZIPOutputStream::GZIPOutputStream | ( | std::string const & | filename, |
FileEntry::CompressionLevel | compression_level | ||
) |
[in] | filename | Name of the file where the zip archive is to be written. |
[in] | compression_level | The compression level to use to compress. |
Definition at line 82 of file gzipoutputstream.cpp.
References m_ozf.
|
virtual |
The destructor ensures that all allocated resources get destroyed.
Definition at line 95 of file gzipoutputstream.cpp.
void zipios::GZIPOutputStream::close | ( | ) |
This function closes the streams making sure that all data gets saved in the output file.
It is not required since destroying the object will also force a close.
Definition at line 137 of file gzipoutputstream.cpp.
void zipios::GZIPOutputStream::finish | ( | ) |
Definition at line 150 of file gzipoutputstream.cpp.
References m_ozf.
void zipios::GZIPOutputStream::setComment | ( | std::string const & | comment | ) |
This function can be used to add a comment to the zip file.
A comment is optional.
[in] | comment | The comment to attach to this stream. |
Definition at line 123 of file gzipoutputstream.cpp.
References m_ozf.
void zipios::GZIPOutputStream::setFilename | ( | std::string const & | filename | ) |
This function can be used to set the name of the file being added to this stream.
The filename is optional.
[in] | filename | The filename to attach to this stream. |
Definition at line 109 of file gzipoutputstream.cpp.
References m_ozf.
|
private |
Definition at line 55 of file gzipoutputstream.hpp.
Referenced by close().
|
private |
Definition at line 56 of file gzipoutputstream.hpp.
Referenced by close(), finish(), GZIPOutputStream(), setComment(), and setFilename().