| Version: 3.0.2

- Main Page
- Related Pages
- Categories
- Classes
- Files

- Class List
- Class Index
- Class Hierarchy
- Class Members

Public Member Functions | List of all members
wxArchiveOutputStream Class Referenceabstract
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.
Public Member Functions inherited from wxFilterOutputStream
| wxFilterOutputStream (wxOutputStream &stream)
| Initializes a "filter" stream.
| wxFilterOutputStream (wxOutputStream *stream)
| Initializes a "filter" stream.
Public Member Functions inherited from wxOutputStream
| wxOutputStream ()
| Creates a dummy wxOutputStream object.
virtual | ~wxOutputStream ()
| Destructor.
virtual size_t | LastWrite () const
| Returns the number of bytes written during the last Write().
void | PutC (char c)
| Puts the specified character in the output queue and increments the stream position.
virtual wxFileOffset | SeekO (wxFileOffset pos, wxSeekMode mode=wxFromStart)
| Changes the stream current position.
virtual wxFileOffset | TellO () const
| Returns the current stream position.
virtual wxOutputStream & | Write (const void *buffer, size_t size)
| Writes up to the specified amount of bytes using the data of buffer.
wxOutputStream & | Write (wxInputStream &stream_in)
| Reads data from the specified input stream and stores them in the current stream.
bool | WriteAll (const void *buffer, size_t size)
| Writes exactly the specified number of bytes from the buffer.
Public Member Functions inherited from wxStreamBase
| wxStreamBase ()
| Creates a dummy stream object.
virtual | ~wxStreamBase ()
| Destructor.
wxStreamError | GetLastError () const
| This function returns the last error.
virtual wxFileOffset | GetLength () const
| Returns the length of the stream in bytes.
virtual size_t | GetSize () const
| This function returns the size of the stream.
virtual bool | IsOk () const
| Returns true if no error occurred on the stream.
virtual bool | IsSeekable () const
| Returns true if the stream supports seeking to arbitrary offsets.
void | Reset (wxStreamError error=wxSTREAM_NO_ERROR)
| Resets the stream state.
bool | operator! () const
| Returns the opposite of IsOk().

## Additional Inherited Members
Protected Member Functions inherited from wxOutputStream
size_t | OnSysWrite (const void *buffer, size_t bufsize)
| Internal function.

## 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 wxZipOutputStream, and wxTarOutputStream.

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 wxZipOutputStream, and wxTarOutputStream.

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 wxZipOutputStream, and wxTarOutputStream.

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 wxZipOutputStream, and wxTarOutputStream.