| Version: 3.0.5

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

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

All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
Public Member Functions | List of all members
wxArchiveOutputStream Class Referenceabstract
Class List by Category » Archive support Class List by Category » | 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. More...
virtual bool | Close ()
| Closes the archive, returning true if it was successfully written. More...
virtual bool | CloseEntry ()=0
| Close the current entry. More...
virtual bool | CopyArchiveMetaData (wxArchiveInputStream &stream)=0
| Some archive formats have additional meta-data that applies to the archive as a whole. More...
virtual bool | CopyEntry (wxArchiveEntry *entry, wxArchiveInputStream &stream)=0
| Takes ownership of entry and uses it to create a new entry in the archive. More...
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. More...
virtual bool | PutNextEntry (wxArchiveEntry *entry)=0
| Takes ownership of entry and uses it to create a new entry in the archive. More...
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. More...
Public Member Functions inherited from wxFilterOutputStream
| wxFilterOutputStream (wxOutputStream &stream)
| Initializes a "filter" stream. More...
| wxFilterOutputStream (wxOutputStream *stream)
| Initializes a "filter" stream. More...
Public Member Functions inherited from wxOutputStream
| wxOutputStream ()
| Creates a dummy wxOutputStream object. More...
virtual | ~wxOutputStream ()
| Destructor. More...
virtual size_t | LastWrite () const
| Returns the number of bytes written during the last Write(). More...
void | PutC (char c)
| Puts the specified character in the output queue and increments the stream position. More...
virtual wxFileOffset | SeekO (wxFileOffset pos, wxSeekMode mode=wxFromStart)
| Changes the stream current position. More...
virtual wxFileOffset | TellO () const
| Returns the current stream position. More...
virtual wxOutputStream & | Write (const void *buffer, size_t size)
| Writes up to the specified amount of bytes using the data of buffer. More...
wxOutputStream & | Write (wxInputStream &stream_in)
| Reads data from the specified input stream and stores them in the current stream. More...
bool | WriteAll (const void *buffer, size_t size)
| Writes exactly the specified number of bytes from the buffer. More...
Public Member Functions inherited from wxStreamBase
| wxStreamBase ()
| Creates a dummy stream object. More...
virtual | ~wxStreamBase ()
| Destructor. More...
wxStreamError | GetLastError () const
| This function returns the last error. More...
virtual wxFileOffset | GetLength () const
| Returns the length of the stream in bytes. More...
virtual size_t | GetSize () const
| This function returns the size of the stream. More...
virtual bool | IsOk () const
| Returns true if no error occurred on the stream. More...
virtual bool | IsSeekable () const
| Returns true if the stream supports seeking to arbitrary offsets. More...
void | Reset (wxStreamError error=wxSTREAM_NO_ERROR)
| Resets the stream state. More...
bool | operator! () const
| Returns the opposite of IsOk(). More...

## Additional Inherited Members

Protected Member Functions inherited from wxOutputStream
size_t | OnSysWrite (const void *buffer, size_t bufsize)
| Internal function. More...
Protected Member Functions inherited from wxStreamBase
virtual wxFileOffset | OnSysSeek (wxFileOffset pos, wxSeekMode mode)
| Internal function. More...
virtual wxFileOffset | OnSysTell () const
| Internal function. More...

## 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.