EzlibExample: Using EZLIB to Compress and Decompress Files

This overview describes the example application that demonstrates the usage of the EZLIB API.

Download

Click on the following link to download the example: EzlibExample.zip

Click: browse to view the example code.

Description

EZLIB is a utility API used to compress and decompress data. The API is an extension of ZLIB compression library. For more information on ZLIB compression library, refer to RFC1950 .

This example application uses the EZLIB API to extract files from a .zip and a .gz file into specified folders, and to compress a .wav file into a .gz file. The application reads input files and stores the extracted files in c:\private\E80000B7\ .

The application uses an object of the RFs class to open the EzlibZipFolder.zip file. It reads the properties of each file in the archive using the CZipFileMember object and prints it to the console.

After reading all the properties of each file in the archive, the application extracts all the files to the specified folder using the CZipFile::GetInputStreamL() method.

Other than extracting all the files in the archive, the application also searches for a specific file using the CZipFile::CaseInsensitiveMemberL() method and extracts it.

The application also opens the icon.bmp.gz file and extracts its contents to the specified location. The GZip file is represented by an object of the CEZGZipToFile class and its contents are extracted using the CEZGZipToFile::InflateL() method.

Finally, the application compresses the error.wav file to a .gz file. The GZip file being created is represented by an object of the CEZFileToGZip class and the .wav file is compressed using the CEZFileToGZip::DeflateL() method.

Build

The Symbian build process describes how to build an application.

The EzlibExample builds an executable file called ezlibexample.exe in the standard location ( \epoc32\release\winscw\ < build_variant > for CodeWarrior). After launching the executable, depending on the emulator you are using, you may need to navigate using the application launcher or the eshell screen to view the console.