wxtaroutputstreamoutput 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 constants for the format parameter of the constructor.
// 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
archive formats such as zip members
wxtaroutputstream::wxtaroutputstream
wxtaroutputstream::wxtaroutputstreamwxtaroutputstream(wxoutputstream& stream, wxtarformat format = wxtar_pax, wxmbconv& conv = wxconvlocal) wxtaroutputstream(wxoutputstream* stream, wxtarformat format = wxtar_pax, wxmbconv& conv = wxconvlocal) 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::closebool close() finishes writing the tar, returning true if successful. called by the destructor if not called explicitly.
wxtaroutputstream::closeentrybool 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::copyarchivemetadatabool copyarchivemetadata(wxtarinputstream& s) see wxarchiveoutputstream::copyarchivemetadata. for the tar format this function does nothing.
wxtaroutputstream::copyentrybool copyentry(wxtarentry* entry, wxtarinputstream& inputstream) 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/setblockingfactorint 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::putnextdirentrybool 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.
wxtaroutputstream::putnextentrybool putnextentry(wxtarentry* entry) 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.
|