wxTarOutputStream
Output stream for writing tar files.
PutNextEntry() is used to create
a new entry in the output tar, then the entry's data is written to the
wxTarOutputStream. Another call to PutNextEntry() closes the current
entry and begins the next.
Derived from
Include files
<wx/tarstrm.h>
Data structures
// Archive Formats (use wxTAR_PAX, it's backward compatible)
enum wxTarFormat
{
wxTAR_USTAR, // POSIX.1-1990 tar format
wxTAR_PAX // POSIX.1-2001 tar format
};
See also
Members
wxTarOutputStream::wxTarOutputStream
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
headers fields into an 8-bit encoding. It has no effect on the stream's data.
When the format is wxTAR_PAX, pax extended headers are generated
when any header field will not fit the standard tar header block or if it
uses any non-ascii characters.
Extended headers are stored as extra 'files' within the tar, and will be
extracted as such by any other tar program that does not understand them.
The conv parameter only affect the standard tar headers, the extended
headers are always UTF-8 encoded.
When the format is wxTAR_USTAR, no extended headers are
generated, and instead a warning message is logged if any header field
overflows.
wxTarOutputStream::~wxTarOutputStream
~wxTarOutputStream()
The destructor calls
Close() to finish
writing the tar if it has not been called already.
wxTarOutputStream::Close
bool Close()
Finishes writing the tar, returning true if successful.
Called by the destructor if not called explicitly.
wxTarOutputStream::CloseEntry
bool CloseEntry()
Close the current entry. It is called implicitly whenever another new
entry is created with
CopyEntry()
or
PutNextEntry(), or
when the tar is closed.
wxTarOutputStream::CopyArchiveMetaData
wxTarOutputStream::CopyEntry
Takes ownership of entry and uses it to create a new entry
in the tar. entry is then opened in inputStream and its contents
copied to this stream.
For some other archive formats CopyEntry() is much more efficient than
transferring the data using Read() and Write() since it will copy them
without decompressing and recompressing them. For tar however it makes
no difference.
For tars on seekable streams, entry must be from the same tar file
as stream. For non-seekable streams, entry must also be the
last thing read from inputStream.
wxTarOutputStream::Get/SetBlockingFactor
int GetBlockingFactor() const
void SetBlockingFactor(int factor)
The tar is zero padded to round its size up to BlockingFactor * 512 bytes.
Defaults to 10 for
wxTAR_PAX and 20 for
wxTAR_USTAR
(see the
constructor), as
specified in the POSIX standards.
wxTarOutputStream::PutNextDirEntry
PutNextEntry() can
also be used to create directory entries, by supplying a name with
a trailing path separator.
wxTarOutputStream::PutNextEntry
Takes ownership of entry and uses it to create a new entry
in the tar.
bool PutNextEntry(
const wxString& name,
const wxDateTime& dt = wxDateTime::Now(),
wxFileOffset size = wxInvalidOffset)
Create a new entry with the given name, timestamp and size.