Barracuda Application Server C/C++ Reference
NO
|
The ZipIo class makes it possible for the web-server to work with resources in a ZIP file as if the ZIP file is a read-only file system.
The most common archive format, ZIP-File, is an "archive" that can contain one or more files. Usually the files "archived" in a ZIP-File are compressed to save space.
A ZIP-File contains a central repository, which stores the original directory structure that was archived. You can think of the central repository as a "read only" file system. The ZipIo class can decode and interpret the central repository in a ZIP-File.
The ZipIo class can automatically convert the internal ZIP data to a GZIP file without using an uncompressing library. Many browsers support the GZIP format and a file inside a ZIP-File can easily be transformed into a GZIP file.
Whenever a browser requests a file that is in a ZIP-File, the ZipIo class extracts the file, appends a GZIP header to the compressed data, and sends the file as a GZIP file to the browser.
A compression library is only needed if you have to support older browsers or if you plan to use method HttpResponse::include with Zip-Files. See Server Side Include files in the user manual for more information.
It is possible to create a non compressed ZIP file, which can be used without the aforementioned restrictions. A non compressed ZIP file is created by running: zip -0 args. See ZIP man page for more info. On windows, open a bash shell (Cygwin) and type one of:
info zip
zip -h
Directory and file names in the ZIP file must be stored as ASCII or UTF8.
A ZIP-File can be made plug-able; that is, you can add and remove a Zip-File from the virtual file system. The ZIP-File uses a ZipReader class, which inherits from CspReader, as the interface to the Zip-File. The example directory contains the FileZipReader which is an example implementation of a ZipReader.
#include <ZipIo.h>
Public Member Functions | |
ZipIo (ZipReader *reader, size_t size=256, AllocatorIntf *alloc=0) | |
ZipIo constructor. More... | |
~ZipIo () | |
ZipIo destructor. | |
ZipErr | getECode () |
Returns an error code if the ZipIo constructor failed. | |
Additional Inherited Members | |
Public Attributes inherited from IoIntf | |
IoIntf_Property | propertyFp |
Set or get property. | |
IoIntf_CloseDir | closeDirFp |
Close directory. | |
IoIntf_MkDir | mkDirFp |
Make directory. More... | |
IoIntf_Rename | renameFp |
Rename resource. More... | |
IoIntf_OpenDir | openDirFp |
Open directory. | |
IoIntf_OpenRes | openResFp |
Open resource. | |
IoIntf_OpenResGzip | openResGzipFp |
Open file as a compressed gzip file. More... | |
IoIntf_Remove | removeFp |
Remove file. More... | |
IoIntf_RmDir | rmDirFp |
Remove directory. More... | |
IoIntf_Stat | statFp |
Get resource information. | |