Output stream for writing zip files.
PutNextEntry() is used to create a new entry in the output zip, then the entry's data is written to the wxZipOutputStream. Another call to PutNextEntry() closes the current entry and begins the next.
Derived from
Include files
<wx/zipstrm.h>
See also
Archive formats such as zip
wxZipEntry
wxZipInputStream
Members
wxZipOutputStream::wxZipOutputStream
wxZipOutputStream::~wxZipOutputStream
wxZipOutputStream::Close
wxZipOutputStream::CloseEntry
wxZipOutputStream::CopyArchiveMetaData
wxZipOutputStream::CopyEntry
wxZipOutputStream::Get/SetLevel
wxZipOutputStream::PutNextDirEntry
wxZipOutputStream::PutNextEntry
wxZipOutputStream::SetComment
wxZipOutputStream(wxOutputStream& stream, int level = -1, wxMBConv& conv = wxConvLocal)
wxZipOutputStream(wxOutputStream*stream, int level = -1, wxMBConv& conv = wxConvLocal)
Constructor. level is the compression level to use. It can be a value between 0 and 9 or -1 to use the default value which currently is equivalent to 6.
If the parent stream is passed as a pointer then the new filter stream takes ownership of it. If it is passed by reference then it does not.
In a Unicode build the third parameter conv is used to translate the filename and comment fields to an 8-bit encoding. It has no effect on the stream's data.
~wxZipOutputStream()
The destructor calls Close() to finish writing the zip if it has not been called already.
bool Close()
Finishes writing the zip, returning true if successful. Called by the destructor if not called explicitly.
bool CloseEntry()
Close the current entry. It is called implicitly whenever another new entry is created with CopyEntry() or PutNextEntry(), or when the zip is closed.
bool CopyArchiveMetaData(wxZipInputStream& inputStream)
Transfers the zip comment from the wxZipInputStream to this output stream.
bool CopyEntry(wxZipEntry* entry, wxZipInputStream& inputStream)
Takes ownership of entry and uses it to create a new entry in the zip. entry is then opened in inputStream and its contents copied to this stream.
CopyEntry() is much more efficient than transferring the data using Read() and Write() since it will copy them without decompressing and recompressing them.
For zips on seekable streams, entry must be from the same zip file as stream. For non-seekable streams, entry must also be the last thing read from inputStream.
int GetLevel() const
void SetLevel(int level)
Set the compression level that will be used the next time an entry is created. It can be a value between 0 and 9 or -1 to use the default value which currently is equivalent to 6.
bool PutNextDirEntry(const wxString& name, const wxDateTime& dt = wxDateTime::Now())
Create a new directory entry (see wxArchiveEntry::IsDir()) with the given name and timestamp.
PutNextEntry() can also be used to create directory entries, by supplying a name with a trailing path separator.
bool PutNextEntry(wxZipEntry* entry)
Takes ownership of entry and uses it to create a new entry in the zip.
bool PutNextEntry(const wxString& name, const wxDateTime& dt = wxDateTime::Now(), off_t size = wxInvalidOffset)
Create a new entry with the given name, timestamp and size.
void SetComment(const wxString& comment)
Sets a comment for the zip as a whole. It is written at the end of the zip.