Humble Framework for SkyOS


Main Page | Modules | Class Hierarchy | Alphabetical List | Data Structures | Directories | File List | Data Fields | Globals | Related Pages

HZipFile Class Reference
[System]

#include <HZipFile.h>

Inheritance diagram for HZipFile:

HFile HObjNoCopy HObj HResMgr

Detailed Description

The HZipFile class subclasses the HFile class to manipulate files stored in a .zip archive (compatible with PKZip 2.0 or similar "work-alikes"). It uses the zlib library for all compression and decompression. Currently, only the "store" and "deflate" algorithms are supported.

Definition at line 34 of file HZipFile.h.

Public Member Functions

virtual ErrCode Close (void)
 Closes the file.
virtual ErrCode Extract (StringPtr pstrSrc, StringPtr pstrDst=NULL)
 Extracts a file from the .zip archive.
ErrCode Open (const HFilename &fn, uint32 uFlags)
 Opens the file, creating it if necessary.
ErrCode UnZip (StringPtr pstrSrc, HMemory &bufOut)
 Unzips a file from the .zip archive.

Protected Member Functions

ZipDirFileHeader * findDir (StringPtr pstrFile) const
 Looks for a file in the directory data.
ErrCode inflateData (const ZipLocalHeader &header, HMemory &bufData)
 Inflates a data stream.
ErrCode unstoreData (ZipLocalHeader const &header, HMemory &bufData)
 "Unstores" a data stream

Protected Attributes

HZipFile::ZipLocalHeader aligned
HZipFile::ZipLocalHeader packed
HZipFile::ZipDirHeader aligned
HZipFile::ZipDirHeader packed
HZipFile::ZipDirFileHeader aligned
HZipFile::ZipDirFileHeader packed
int32 m_nEntries
 Count of entries (files) in zip archive.
HMemory m_directory
 Raw directory data.

Data Structures

struct  ZipDirFileHeader
struct  ZipDirHeader
struct  ZipLocalHeader


Member Function Documentation

ZipDirFileHeader* HZipFile::findDir StringPtr  pstrFile  )  const [protected]
 

This method traverses the .zip directory structure looking for a file. The file name and path must match exactly.

Returns:
Pointer to directory entry if found, NULL otherwise
Parameters:
pstrFile Filename to search for

Definition at line 134 of file HZipFile.h.

ErrCode HZipFile::inflateData const ZipLocalHeader &  header,
HMemory bufData
[protected]
 

This method reads in compressed data from the current file position and uses the zlib library to inflate it.

Returns:
NO_ERROR on success, error code otherwise
Parameters:
header ZipLocalHeader read in from the file
[out] bufData Buffer containing uncompressed data

Definition at line 179 of file HZipFile.h.

ErrCode HZipFile::unstoreData ZipLocalHeader const &  header,
HMemory bufData
[protected]
 

This method reads in uncompressed data from the current file position. The following errors may be returned:

  • ERR_INVALID_DATA
  • ERR_FILE_READ

Returns:
NO_ERROR on success, error code otherwise
Parameters:
header ZipLocalHeader read in from the file
[out] bufData Buffer containing uncompressed data

Definition at line 254 of file HZipFile.h.

virtual ErrCode HZipFile::Close void   )  [virtual]
 

Returns:
NO_ERROR on success, error code otherwise

Reimplemented from HFile.

Definition at line 279 of file HZipFile.h.

virtual ErrCode HZipFile::Extract StringPtr  pstrSrc,
StringPtr  pstrDst = NULL
[virtual]
 

This method looks for a given source file in the .zip archive and reads in the file's contents, inflating it if needed. The resulting data is then written out to a file. Although hierarchical filename can be used, the caller is responsible for ensuring that any or all subdirectories exist.

Returns:
NO_ERROR on success, error code otherwise
Parameters:
pstrSrc File name inside .zip archive
pstrDst [optional] File name to copy to

Reimplemented in HResMgr.

Definition at line 302 of file HZipFile.h.

ErrCode HZipFile::Open const HFilename fn,
uint32  uFlags
 

Returns:
NO_ERROR on success, error code otherwise
Parameters:
fn Fully-qualified filename
uFlags Flags passed to the open() routine
Todo:
: Add .zip extension if not already present

Definition at line 355 of file HZipFile.h.

ErrCode HZipFile::UnZip StringPtr  pstrSrc,
HMemory bufOut
 

Returns:
NO_ERROR on success, error code otherwise
Parameters:
pstrSrc Pointer to file name inside .zip archive
[out] bufOut Buffer containing data

Definition at line 442 of file HZipFile.h.


The documentation for this class was generated from the following file:
 

2006.01.09-16:37