#include <Iguana/Utilities/classlib/zip/ZipArchive.h>
A ZIP archive consists of files compressed with the popular ZLIB compression algorithm. The archive format is used among others by PKZip and Info-ZIP. The compression algorithm is also used by GZIP and the PNG graphics standard. The format of the archives is explained briefly below. This class provides an interface to read and write such archives.
A ZIP archive contains a prefix, series of archive members (files), and a central directory. In theory the archive could span multiple disks (or files) with the central directory of the whole archive on the last disk, but this package does not support such multi-part archives. The prefix is only used in self-extracting executable archive files.
The member are stored in the archive sequentially, each with a local header followed by the compressed data; the local header describes the member, including its file name and compressed and real sizes. The central directory includes the member details again, plus allows an extra member comment to be added. The last member in the central directory is an end marker that can contain a comment for the whole archive. Both the local header and the central directory can also carry extra member-specific data; the data in the local and global parts can be different.
Once the archive has been opened, the client can query the members and read their contents by asking the archive for an input stream. The members can be accessed in any order, however only one member at a time should be read from. Trying to read data from more than one member at a time will confuse the internal file state. (FIXME: attempting to seek the underlying file storage behind the scenes will have similar impact.)
Archive writes are possible only in constrained sequential write of all members in one go. First create a in write mode. Next create a new , fully describing it in the constructor. Then retrieve the compressing output stream from the archive and write all the member file data to the stream. Once complete, close the stream, and repeat the whole process for subsequent files. Finally, the close or at least flush the archive itself. The writing is not thread safe, nor is it permitted to read from already-written members while writing.
The owns all the objects it returns as well as those added to it for write.
Definition at line 76 of file ZipArchive.h.
typedef std::vector<ZipMember *>::const_iterator lat::ZipArchive::Iterator |
Definition at line 79 of file ZipArchive.h.
lat::ZipArchive::ZipArchive | ( | Storage * | file | ) |
lat::ZipArchive::ZipArchive | ( | Filename | name, | |
unsigned | mode | |||
) |
virtual lat::ZipArchive::~ZipArchive | ( | void | ) | [virtual] |
lat::ZipArchive::ZipArchive | ( | const ZipArchive & | ) | [private] |
Referenced by edm::service::IguanaService::postEndJob().
void lat::ZipArchive::comment | ( | const std::string & | text | ) |
std::string lat::ZipArchive::comment | ( | void | ) | const |
InputStream* lat::ZipArchive::input | ( | ZipMember * | member | ) |
virtual Storage* lat::ZipArchive::openStored | ( | Storage * | master, | |
IOOffset | position, | |||
IOOffset | length | |||
) | [protected, virtual] |
const ZipArchive& lat::ZipArchive::operator= | ( | const ZipArchive & | ) | [private] |
OutputStream* lat::ZipArchive::output | ( | ZipMember * | member | ) |
size_t lat::ZipArchive::size | ( | void | ) | const |
friend class SInput [friend] |
Definition at line 122 of file ZipArchive.h.
friend class SOutput [friend] |
Definition at line 124 of file ZipArchive.h.
friend class ZInput [friend] |
Definition at line 120 of file ZipArchive.h.
friend class ZOutput [friend] |
Definition at line 123 of file ZipArchive.h.
std::string lat::ZipArchive::m_comment [private] |
Definition at line 141 of file ZipArchive.h.
OutputStream* lat::ZipArchive::m_current [private] |
Definition at line 156 of file ZipArchive.h.
IOOffset lat::ZipArchive::m_dirOffset [private] |
Definition at line 145 of file ZipArchive.h.
IOOffset lat::ZipArchive::m_dirPos [private] |
Definition at line 143 of file ZipArchive.h.
IOOffset lat::ZipArchive::m_dirSize [private] |
Definition at line 144 of file ZipArchive.h.
Storage* lat::ZipArchive::m_file [private] |
Definition at line 138 of file ZipArchive.h.
unsigned lat::ZipArchive::m_level [private] |
Definition at line 140 of file ZipArchive.h.
std::vector<ZipMember *> lat::ZipArchive::m_members [private] |
Definition at line 155 of file ZipArchive.h.
Method lat::ZipArchive::m_method [private] |
Definition at line 139 of file ZipArchive.h.
unsigned lat::ZipArchive::m_mode [private] |
Current open mode.
Always has one of File::ModeRead, File::ModeWrite set (exactly one of them), except that internally the whole mode is set to zero to indicate closed archive. (Flags other than those two can be set by the client.)
Definition at line 148 of file ZipArchive.h.
IOOffset lat::ZipArchive::m_prefixSize [private] |
Definition at line 142 of file ZipArchive.h.