Zip Compression Library Overview

The Zip Compression Library, EZLib, provides stream and file compression and decompression functionality for the Symbian platforms.

EZLib provides classes to handle the file, stream and buffer requirements of zlib. It provides native Symbian APIs that access the zlib compression algorithms and it exports some zlib and gzio C APIs from libz.dll. EZLib can operate on streams, flat zip files (zlib format) and gzip files.

Purpose

EZLib facilitates:

  • Compression and decompression of memory streams

  • Compression and decompression of files

  • Decompression of file archives of gzip format

Required background

You must be familiar with zlib, gzip compression and decompression formats and Deflate algorithms. You can find further information about each of these on the IETF (Internet Engineering Task Force) website.

RFC1950- zlib format

RFC1951-Deflate algorithm

RFC1952-gzip format

Key concepts and terms

zlib

zlib format is an open standard for lossless compressed data. It can be implemented using a number of alternative compression algorithms.

Compression

Data compression is a process of encoding information using fewer bits (or other information-bearing units) using specific encoding algorithms.

Decompression

Decompression is the process of reconverting compressed data into its original (or nearly original) form.

Stream

A stream is an abstraction that represents a device on which input and ouput operations are performed. A stream can be considered as a source or destination of characters of indefinite length. A stream can be accessed only in sequence.

gzip File Format

gzip is normally used to compress single files. Deflate is the compression algorithm used.

gzio

gzio APIs are input amd output functions for gzip format.

zip Format

The zip file format is both data compression and archive. A zip file contains one or more files that have been compressed where possible to reduce file size. The zip file format permits a number of compression algorithms but only Deflate is widely used and supported.

Architecture

The Zip Compression Library (EZLib) provides C++ wrapper classes that encapsulate the functionality of version 1.2.3 of the zlib library. zlib and gzio APIs are written in C. The core functionality is performed by a core library (libzcore.dll).

EZLib provides three DLLs which encapsulate the core functionality in Symbian C++ and Open Environment APIs.

  • LIBZ.DLL: This is an Open Environment library that provides the zlib and gzio C APIs. The APIs can be used to compress and decompress zlib and gzip file formats.

  • EZLIB.DLL: This provides Symbian C++ wrappers for the zlib compression and decompression APIs. It offers buffer, stream and gzip file handling classes. It also exports the C API interface provided by LIBZ.DLL with the exception of the gzio APIs. This library can be used to compress and decompress zlib and gzip file formats and memory streams.

  • EZIP.DLL: This provides Symbian C++ APIs for reading from and decompressing zip archives. It cannot be used to compress archives to zip archives.

Figure: EZLib Architecture

APIs

The classes exported from ezlib.dll are tabulated below:

API Description

CEZCompressor

Provides wrapper for ‘compress’ and ‘Deflate’ zlib APIs.

CEZDecompressor

Provides wrapper for ‘uncompress’ and ‘inflate’ zlib APIs.

CEZFileBufferManager

Provides basic file handling for CEZCompressor and CEZDecompressor classes.

CEZFileToGZip

Provides implementation to compress an uncompressed file to a gzip file.

CEZFileToGzipBM

Provides buffer management class for CEZFileToGZip.

CEZGZipToFile

Provides implementation to uncompress a gzip file to an output file.

CEZGzipToFileBM

Provides buffer management class for CEZGzipToFile.

CEZZStream

Provides stream handling.

MEZBufferManager

Pure virtual interface class. CEZFileBufferManager derives from this class.

The classes exported from ezip.dll are tabulated below:

API Description

CZipArchive

Represents a zip archive and defines all relevant enumerations and structures.

CZipFile

Represents a zip archive contained in a single file.

CZipFileMember

Represents a compressed file contained in a CZipFile archive file.

CZipFileMemberIterator

Allows iteration through all the entries of an archive.

RZipFileMemberReaderStream

Represents an input stream for compressed files in an archive.

libz.dll provides the C open environment and hybrid applications to support the zlib library.

Typical uses

The typical uses of the ZIP Compression Library are: