C++ library for reading and writing Zip file.

C++ library for reading and writing Zip file.

Introduction

Zipios++ is a java.util.zip-like C++ library for reading and writing Zip files. Access to individual entries is provided through standard C++ iostreams. A simple read-only virtual file system that mounts regular directories and zip files is also provided.

The source code is released under the GNU Lesser General Public License.

Status

Spanned archives are not supported, and support is not planned.

The library has been tested and appears to be working with

If you are aware of any other platforms that Zipios++ works on, please let me know (thoma.nosp@m.ss@d.nosp@m.eltad.nosp@m.ata..nosp@m.dk).

Zip file access

The two most important classes are ZipFile and ZipInputStream. ZipInputStream is an istream for reading zipfiles. It can be instantiated directly, without the use of ZipFile. A new ZipInputStream reads from the first entry, and the user can skip to the next entry by calling ZipInputStream::getNextEntry().

ZipFile scans the central directory of a zipfile and provides an interface to access that directory. The user may search for entries with a particular filename using ZipFile::getEntry(), or simply get the complete list of entries with ZipFile::entries(). To get an istream (ZipInputStream) to a particular entry simply use ZipFile::getInputStream().

"example_zip.cpp" demonstrates the central elements of Zipios++.

A Zip file appended to another file, e.g. a binary program, with the program "appendzip", can be read with ZipFile::openEmbeddedZipFile().

FileCollections

A ZipFile is actually just a special kind of FileCollection that obtains its entries from a .zip Zip archive. Zipios++ also implements a DirectoryCollection that obtains its entries from a specified directory, and a CollectionCollection that obtains its entries from other collections. Using a single CollectionCollection any number of other FileCollections can be placed under its control and accessed through the same single interface that is used to access a ZipFile or a DirectoryCollection. A singleton (a unique global instance) CollectionCollection can be obtained through

CollectionCollection::inst() ;

To save typing CollectionCollection has been typedef'ed to CColl. In the initialization part of an application FileCollections can be created, and placed under CColll::inst()'s control using

CColl::inst().addCollection()

and later an istream can be obtained using

CColl::inst().getInputStream().

Download

Go to Zipios++ project page on SourceForge for tar balls and ChangeLog. http://sourceforge.net/project/?group_id=5418

Links

zlib. The compression library that Zipios++ uses to perform the actual decompression.

Java 2 Platform, Standard Edition, v 1.3 API Specification . Zipios++ is heavily inspired by the java.util.zip package.

PKWARE zip format . A description of the zip file format.

Bugs

Submit bug reports and patches to thoma.nosp@m.ss@d.nosp@m.eltad.nosp@m.ata..nosp@m.dk

Project hosted by SourceForge