CZipFile Class Reference

class CZipFile : public CZipArchive

A CZipFile represents a ZIP archive contained in a single file. Multi file zip archives are not supported.

Inherits from

Nested Classes and Structures

Public Member Functions
CZipFile ( RFs &, const TDesC &)
~CZipFile ()
IMPORT_C CZipFileMember * CaseInsensitiveMemberL (const TDesC &)
IMPORT_C CZipFileMember * CaseSensitiveOrCaseInsensitiveMemberL (const TDesC &)
IMPORT_C void Close (void)
IMPORT_C TInt GetInputStreamL (const CZipFileMember *, RZipFileMemberReaderStream *&)
IMPORT_C CZipFileMemberIterator * GetMembersL (void)
IMPORT_C CZipFileMember * MemberL (const TDesC &)
IMPORT_C CZipFile * NewL ( RFs &, RFile &)
IMPORT_C CZipFile * NewL ( RFs &, const TDesC &)
IMPORT_C TInt OpenL (void)
IMPORT_C TInt Size ( TInt &)
Protected Member Functions
IMPORT_C void ConstructL (const TDesC &)
IMPORT_C void ConstructL ( RFile &)
void DeleteMemberPointers (void)
TInt FindCentralDirectoryTrailer ( TUint32 &)
const TMemberPointer * FindMemberPointer (const TDesC &, TBool )
TInt LoadMemberPointersL (void)
RZipFileMemberReaderStream * MakeInputStreamL ( TUint32 , TUint32 , TUint32 , TUint32 )
CZipFileMember * MakeMemberL ( TInt )
CZipFileMember * MakeMemberL (const TMemberPointer &, const TLocalHeader &)
void OpenFileL (const TDesC &)
TInt Read ( TByte *, TUint32 )
TInt Read ( TUint16 &)
TInt Read ( TUint32 &)
TInt ReadCentralDirectoryHeaderL ( TCentralDirectoryHeader &, TMemberPointer &, CCnvCharacterSetConverter *, TInt )
TInt ReadCentralDirectoryTrailer ( TUint32 , TCentralDirectoryTrailer &)
TInt ReadLocalHeader ( TUint32 , TLocalHeader &)
TInt Seek ( TInt )
Inherited Functions
CBase::CBase()
CBase::Delete(CBase *)
CBase::Extension_(TUint,TAny *&,TAny *)
CBase::operator new(TUint)
CBase::operator new(TUint,TAny *)
CBase::operator new(TUint,TLeave)
CBase::operator new(TUint,TLeave,TUint)
CBase::operator new(TUint,TUint)
CBase::~CBase()
Public Member Enumerations
enum anonymous { KZipFileError  = KZipArchiveMinError - 1, KZipFileNotFound  = KZipFileError - 1, KZipFileIOError  = KZipFileError - 2 }
Inherited Enumerations
CZipArchive:@49
CZipArchive:@50
CZipArchive:@51
CZipArchive:@52
CZipArchive:TCompressionMethod
Private Attributes
ContentAccess::CData * iData
TUint32 iFileLength
const TDesC & iFileName
RFs & iFs
TMemberPointer * iMemberPointers
TCentralDirectoryTrailer iTrailer

Constructor & Destructor Documentation

CZipFile(RFs &, const TDesC &)

IMPORT_C CZipFile ( RFs & aFs,
const TDesC & aFileName
)

in 7.0

Parameters

RFs & aFs
const TDesC & aFileName

~CZipFile()

IMPORT_C ~CZipFile ( ) [virtual]

Destructor

Member Functions Documentation

CaseInsensitiveMemberL(const TDesC &)

IMPORT_C CZipFileMember * CaseInsensitiveMemberL ( const TDesC & aName )

Constructs and returns a CZipFileMember object which is used to access information about a compressed file contained in the CZipFile archive. The name of the file to be searched for in the zipfile is case-insensitive.

leave
... Any one of the system-wide error codes for other errors.

Parameters

const TDesC & aName The name of the file to be searched in the zipfile

CaseSensitiveOrCaseInsensitiveMemberL(const TDesC &)

IMPORT_C CZipFileMember * CaseSensitiveOrCaseInsensitiveMemberL ( const TDesC & aName )

Constructs and returns a CZipFileMember object which is used to access information about a compressed file contained in the CZipFile archive. An exact match for the filename is searched for first. If a match is not found, a case-insensitive search is performed. If both filenames exist in the archive, the case-sensitive match will be returned.

leave
... Any one of the system-wide error codes for other errors.

Parameters

const TDesC & aName The name of the file to be searched in the zipfile

Close(void)

IMPORT_C void Close ( void )

in 7.0

Parameters

void

ConstructL(const TDesC &)

IMPORT_C void ConstructL ( const TDesC & aFileName ) [protected]

Second phase of construction. Used by filename using NewL overload

leave
... Any one of the system-wide error codes for other errors.

Parameters

const TDesC & aFileName

ConstructL(RFile &)

IMPORT_C void ConstructL ( RFile & aFile ) [protected]

Second phase of construction. Used by Rfile using NewL overload.

leave
... Any one of the system-wide error codes for other errors.

Parameters

RFile & aFile

DeleteMemberPointers(void)

void DeleteMemberPointers ( void ) [protected]

Parameters

void

FindCentralDirectoryTrailer(TUint32 &)

TInt FindCentralDirectoryTrailer ( TUint32 & offset ) [protected]

Parameters

TUint32 & offset

FindMemberPointer(const TDesC &, TBool)

const TMemberPointer * FindMemberPointer ( const TDesC & ,
TBool
) [protected]

Parameters

const TDesC &
TBool

GetInputStreamL(const CZipFileMember *, RZipFileMemberReaderStream *&)

IMPORT_C TInt GetInputStreamL ( const CZipFileMember * aMember,
RZipFileMemberReaderStream *& aStream
)

Creates and returns the input stream for a file in the archive. Only files compressed with Stored or Deflated compression methods are supported.

leave
... Any one of the system-wide error codes for other errors.

Parameters

const CZipFileMember * aMember The compressed file in the archive
RZipFileMemberReaderStream *& aStream On return, the stream to be used for reading the contents of the compressed file. The caller owns this object and is responsible for deleting it.

GetMembersL(void)

IMPORT_C CZipFileMemberIterator * GetMembersL ( void )

Gets the iterator used for iterating through the files contained in the ZIP file. It is the caller's responsibility to release the iterator when finsihed.

leave
... Any one of the system-wide error codes for other errors.

Parameters

void

LoadMemberPointersL(void)

TInt LoadMemberPointersL ( void ) [protected]

Parameters

void

MakeInputStreamL(TUint32, TUint32, TUint32, TUint32)

RZipFileMemberReaderStream * MakeInputStreamL ( TUint32 ,
TUint32 ,
TUint32 ,
TUint32
) [protected]

MakeMemberL(TInt)

CZipFileMember * MakeMemberL ( TInt ) [protected]

Parameters

TInt

MakeMemberL(const TMemberPointer &, const TLocalHeader &)

CZipFileMember * MakeMemberL ( const TMemberPointer & ,
const TLocalHeader &
) [protected]

Parameters

const TMemberPointer &
const TLocalHeader &

MemberL(const TDesC &)

IMPORT_C CZipFileMember * MemberL ( const TDesC & aName )

Constructs and returns a CZipFileMember object which is used to access information about a compressed file contained in the CZipFile archive. The name of the file to be searched for in the zipfile is case-sensitive.

leave
... Any one of the system-wide error codes for other errors.

Parameters

const TDesC & aName The name of the file to be searched in the zipfile

NewL(RFs &, RFile &)

IMPORT_C CZipFile * NewL ( RFs & aFs,
RFile & aFile
) [static]

Creates a new CZipFile object using the supplied file server session and a valid file handle. The caller must have sufficient rights to access the content of the zipfile, if encrypted/protected.

leave
KZipArchiveError If file cannot be accessed(invalid handle, corrupt file header, etc.)
leave
KZipFileIOError If file cannot be read
leave
KCentralDirectoryTrailerNotFound If zip file header doesn't contain information about files inside the archive
leave
KCentralDirectoryTrailerInvalid If the information about files inside the archive is corrupt
leave
KMultiDiskArchivesNotSupported If zipfile is a multi disk archive
leave
... Any one of the system-wide error codes for other errors.

Parameters

RFs & aFs File server session used for opening the zipfile
RFile & aFile File handle to be used for accessing the zipfile

NewL(RFs &, const TDesC &)

IMPORT_C CZipFile * NewL ( RFs & aFs,
const TDesC & aFileName
) [static]

Creates a new CZipFile object using the supplied file server session and file name. The caller must have sufficient capabilities to access the directory. The caller must also have sufficient rights to access the content of the zipfile, if encrypted/protected.

leave
KZipArchiveError If file cannot be accessed(invalid handle, corrupt file header, etc.)
leave
KZipFileIOError If file cannot be read
leave
KCentralDirectoryTrailerNotFound If zip file header doesn't contain information about files inside the archive
leave
KCentralDirectoryTrailerInvalid If the information about files inside the archive is corrupt
leave
KMultiDiskArchivesNotSupported If zipfile is a multi disk archive.
leave
... Any one of the system-wide error codes for other errors.

Parameters

RFs & aFs File server session used for opening the zipfile
const TDesC & aFileName Name of the zipfile

OpenFileL(const TDesC &)

void OpenFileL ( const TDesC & aFileName ) [protected]

Parameters

const TDesC & aFileName

OpenL(void)

IMPORT_C TInt OpenL ( void )

in 7.0

Parameters

void

Read(TByte *, TUint32)

TInt Read ( TByte * ,
TUint32
) [protected]

Parameters

TByte *
TUint32

Read(TUint16 &)

TInt Read ( TUint16 & ) [protected]

Parameters

TUint16 &

Read(TUint32 &)

TInt Read ( TUint32 & ) [protected]

Parameters

TUint32 &

ReadCentralDirectoryHeaderL(TCentralDirectoryHeader &, TMemberPointer &, CCnvCharacterSetConverter *, TInt)

TInt ReadCentralDirectoryHeaderL ( TCentralDirectoryHeader & ,
TMemberPointer & ,
CCnvCharacterSetConverter * aConverter,
TInt aConverterState
) [protected]

ReadCentralDirectoryTrailer(TUint32, TCentralDirectoryTrailer &)

TInt ReadCentralDirectoryTrailer ( TUint32 offset,
TCentralDirectoryTrailer &
) [protected]

ReadLocalHeader(TUint32, TLocalHeader &)

TInt ReadLocalHeader ( TUint32 ,
TLocalHeader &
) [protected]

Seek(TInt)

TInt Seek ( TInt ) [protected]

Parameters

TInt

Size(TInt &)

IMPORT_C TInt Size ( TInt & aSize ) const

Gets the size of the compressed data contained in the zip file in bytes Each CZipFile object has a compressed and uncompressed size. This method will return the compressed size of a zip file.

Parameters

TInt & aSize On return, the size of the compressed data in bytes

Member Enumerations Documentation

Enum anonymous

ZipFile error enumeration.

Enumerators

KZipFileError = KZipArchiveMinError - 1

Cannot read file directory in the archive file

KZipFileNotFound = KZipFileError - 1

File not found error. It is not used in current implemenation

KZipFileIOError = KZipFileError - 2

File IO error.Any error occurs during a archive file is readed. For examples, any error about reading number of disk, an offset of signature, or the content of file is non-readable.

Member Data Documentation

ContentAccess::CData * iData

ContentAccess::CData * iData [private]

The pointer to CData object created from a zip file

TUint32 iFileLength

TUint32 iFileLength [private]

const TDesC & iFileName

const TDesC & iFileName [private]

RFs & iFs

RFs & iFs [private]

TMemberPointer * iMemberPointers

TMemberPointer * iMemberPointers [private]

The pointer to a a compressed file in a zipfile

TCentralDirectoryTrailer iTrailer

TCentralDirectoryTrailer iTrailer [private]

The central directory of ZIP File Trailer