Contents Up Previous Next

wxArchiveOutputStream

An abstract base class which serves as a common interface to archive output streams such as wxZipOutputStream.

PutNextEntry() is used to create a new entry in the output archive, then the entry's data is written to the wxArchiveOutputStream. Another call to PutNextEntry() closes the current entry and begins the next.

Derived from

wxFilterOutputStream

Include files

<wx/archive.h>

See also

Archive formats such as zip
wxArchiveEntry
wxArchiveInputStream

Members

wxArchiveOutputStream::~wxArchiveOutputStream
wxArchiveOutputStream::Close
wxArchiveOutputStream::CloseEntry
wxArchiveOutputStream::CopyArchiveMetaData
wxArchiveOutputStream::CopyEntry
wxArchiveOutputStream::PutNextDirEntry
wxArchiveOutputStream::PutNextEntry


wxArchiveOutputStream::~wxArchiveOutputStream

~wxArchiveOutputStream()

Calls Close() if it has not already been called.


wxArchiveOutputStream::Close

bool Close()

Closes the archive, returning true if it was successfully written. Called by the destructor if not called explicitly.


wxArchiveOutputStream::CloseEntry

bool CloseEntry()

Close the current entry. It is called implicitly whenever another new entry is created with CopyEntry() or PutNextEntry(), or when the archive is closed.


wxArchiveOutputStream::CopyArchiveMetaData

bool CopyArchiveMetaData(wxArchiveInputStream& stream)

Some archive formats have additional meta-data that applies to the archive as a whole. For example in the case of zip there is a comment, which is stored at the end of the zip file. CopyArchiveMetaData() can be used to transfer such information when writing a modified copy of an archive.

Since the position of the meta-data can vary between the various archive formats, it is best to call CopyArchiveMetaData() before transferring the entries. The wxArchiveOutputStream will then hold on to the meta-data and write it at the correct point in the output file.

When the input archive is being read from a non-seekable stream, the meta-data may not be available when CopyArchiveMetaData() is called, in which case the two streams set up a link and transfer the data when it becomes available.


wxArchiveOutputStream::CopyEntry

bool CopyEntry(wxArchiveEntry* entry, wxArchiveInputStream& stream)

Takes ownership of entry and uses it to create a new entry in the archive. entry is then opened in the input stream stream and its contents copied to this stream.

For archive types which compress entry data, CopyEntry() is likely to be much more efficient than transferring the data using Read() and Write() since it will copy them without decompressing and recompressing them.

entry must be from the same archive file that stream is accessing. For non-seekable streams, entry must also be the last thing read from stream.


wxArchiveOutputStream::PutNextDirEntry

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.


wxArchiveOutputStream::PutNextEntry

bool PutNextEntry(wxArchiveEntry* entry)

Takes ownership of entry and uses it to create a new entry in the archive. The entry's data can then be written by writing to this wxArchiveOutputStream.

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. The entry's data can then be written by writing to this wxArchiveOutputStream.