Public Member Functions

# wxArchiveOutputStream Class Reference
[Archive support, Streams]

`#include <wx/archive.h>`

Inheritance diagram for wxArchiveOutputStream:
[legend]

## Detailed Description

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

wxArchiveOutputStream::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.

##

Library: wxBase
Category: Archive support, Streams

See also:
  Archive Formats, wxArchiveEntry, wxArchiveInputStream

## Public Member Functions
virtual | ~wxArchiveOutputStream ()
| Calls Close() if it has not already been called.
virtual bool | Close ()
| Closes the archive, returning true if it was successfully written.
virtual bool | CloseEntry ()=0
| Close the current entry.
virtual bool | CopyArchiveMetaData (wxArchiveInputStream &stream)=0
| Some archive formats have additional meta-data that applies to the archive as a whole.
virtual bool | CopyEntry (wxArchiveEntry *entry, wxArchiveInputStream &stream)=0
| Takes ownership of entry and uses it to create a new entry in the archive.
virtual bool | PutNextDirEntry (const wxString &name, const wxDateTime &dt=wxDateTime::Now())=0
| Create a new directory entry (see wxArchiveEntry::IsDir) with the given name and timestamp.
virtual bool | PutNextEntry (wxArchiveEntry *entry)=0
| Takes ownership of entry and uses it to create a new entry in the archive.
virtual bool | PutNextEntry (const wxString &name, const wxDateTime &dt=wxDateTime::Now(), wxFileOffset size=wxInvalidOffset)=0
| Create a new entry with the given name, timestamp and size.

List of all members.

## Constructor & Destructor Documentation

virtual wxArchiveOutputStream::~wxArchiveOutputStream | ( |  | ) | `[virtual]`

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

## Member Function Documentation

virtual bool wxArchiveOutputStream::Close | ( |  | ) | `[virtual]`

Closes the archive, returning true if it was successfully written.

Called by the destructor if not called explicitly.

See also:
  wxOutputStream::Close()

Reimplemented from wxOutputStream.

Reimplemented in wxTarOutputStream, and wxZipOutputStream.

virtual bool wxArchiveOutputStream::CloseEntry | ( |  | ) | `[pure virtual]`

Close the current entry.

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

Implemented in wxTarOutputStream, and wxZipOutputStream.

virtual bool wxArchiveOutputStream::CopyArchiveMetaData | ( | wxArchiveInputStream & | stream | ) | `[pure virtual]`

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.

virtual bool wxArchiveOutputStream::CopyEntry | ( | wxArchiveEntry * | entry,
|  | wxArchiveInputStream & | stream |
| ) |  |  | `[pure virtual]`

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.

virtual bool wxArchiveOutputStream::PutNextDirEntry | ( | const wxString & | name,
|  | const wxDateTime & | dt = `wxDateTime::Now()` |
| ) |  |  | `[pure virtual]`

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.

Implemented in wxTarOutputStream, and wxZipOutputStream.

virtual bool wxArchiveOutputStream::PutNextEntry | ( | wxArchiveEntry * | entry | ) | `[pure virtual]`

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.

virtual bool wxArchiveOutputStream::PutNextEntry | ( | const wxString & | name,
|  | const wxDateTime & | dt = `wxDateTime::Now()`,
|  | wxFileOffset | size = `wxInvalidOffset` |
| ) |  |  | `[pure virtual]`

Create a new entry with the given name, timestamp and size.

The entry's data can then be written by writing to this wxArchiveOutputStream.

Implemented in wxTarOutputStream, and wxZipOutputStream.

|  | [ top ]