CZipFile Class Reference

#include <zipfile.h>

Link against: ezip.lib

class CZipFile : public CZipArchive

Inherits from

Nested Classes and Structures

Public Member Enumerations
enumanonymous { KZipFileError, KZipFileNotFound, KZipFileIOError }
Public Member Functions
CZipFile(RFs &, const TDesC &)
virtual ~CZipFile()
IMPORT_C CZipFileMember *CaseInsensitiveMemberL(const TDesC &)
IMPORT_C CZipFileMember *CaseSensitiveOrCaseInsensitiveMemberL(const TDesC &)
IMPORT_C voidClose(void)
IMPORT_C TIntGetInputStreamL(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 TIntOpenL(void)
IMPORT_C TIntSize(TInt &)
Protected Member Functions
IMPORT_C voidConstructL(const TDesC &)
IMPORT_C voidConstructL(RFile &)
voidDeleteMemberPointers(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 &)
voidOpenFileL(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 Enumerations
CZipArchive:@62
CZipArchive:@63
CZipArchive:@64
CZipArchive:@65
CZipArchive:TCompressionMethod
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()

Detailed Description

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

Member Enumeration Documentation

Enum anonymous

ZipFile error enumeration.

EnumeratorValueDescription
KZipFileErrorKZipArchiveMinError - 1

Cannot read file directory in the archive file

KZipFileNotFoundKZipFileError - 1

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

KZipFileIOErrorKZipFileError - 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.

Constructor & Destructor Documentation

CZipFile ( RFs &, const TDesC & )

IMPORT_CCZipFile(RFs &aFs,
const TDesC &aFileName
)

Deprecatedin 7.0

~CZipFile ( )

IMPORT_C~CZipFile()[virtual]

Destructor

Member Function 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.

Parameters
aNameThe name of the file to be searched in the zipfile
Return Value
A pointer to a member object of zip file NULL If the file doesn't exist in the zipfile
Leave Codes
...Any one of the system-wide error codes for other errors.

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.

Parameters
aNameThe name of the file to be searched in the zipfile
Return Value
A pointer to a member object of zip file NULL If the file doesn't exist in the zipfile
Leave Codes
...Any one of the system-wide error codes for other errors.

Close ( void )

IMPORT_C voidClose(void)

Deprecatedin 7.0

ConstructL ( const TDesC & )

IMPORT_C voidConstructL(const TDesC &aFileName)[protected]

Second phase of construction. Used by filename using NewL overload

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

ConstructL ( RFile & )

IMPORT_C voidConstructL(RFile &aFile)[protected]

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

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

DeleteMemberPointers ( void )

voidDeleteMemberPointers(void)[protected]

FindCentralDirectoryTrailer ( TUint32 & )

TInt FindCentralDirectoryTrailer(TUint32 &offset)[protected]

FindMemberPointer ( const TDesC &, TBool )

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

GetInputStreamL ( const CZipFileMember *, RZipFileMemberReaderStream *& )

IMPORT_C TIntGetInputStreamL(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.

Parameters
aMemberThe compressed file in the archive
aStreamOn 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.
Return Value
KErrNone if successful KCompressionMethodNotSupported if compression format unsupported ... Any one of the system-wide error codes for other errors.
Leave Codes
...Any one of the system-wide error codes for other errors.

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.

Return Value
Pointer to a newly allocated CZipFileMemberIterator object
Leave Codes
...Any one of the system-wide error codes for other errors.

LoadMemberPointersL ( void )

TInt LoadMemberPointersL(void)[protected]

MakeInputStreamL ( TUint32, TUint32, TUint32, TUint32 )

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

MakeMemberL ( TInt )

CZipFileMember *MakeMemberL(TInt)[protected]

MakeMemberL ( const TMemberPointer &, const TLocalHeader & )

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

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.

Parameters
aNameThe name of the file to be searched in the zipfile
Return Value
the pointer to CZipFileMember object NULL if the file doesn't exist in the zipfile
Leave Codes
...Any one of the system-wide error codes for other errors.

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.

Parameters
aFsFile server session used for opening the zipfile
aFileFile handle to be used for accessing the zipfile
Return Value
CZipFile object associated with the zipfile if it succeeded
Leave Codes
KZipArchiveErrorIf file cannot be accessed(invalid handle, corrupt file header, etc.)
KZipFileIOErrorIf file cannot be read
KCentralDirectoryTrailerNotFoundIf zip file header doesn't contain information about files inside the archive
KCentralDirectoryTrailerInvalidIf the information about files inside the archive is corrupt
KMultiDiskArchivesNotSupportedIf zipfile is a multi disk archive
...Any one of the system-wide error codes for other errors.

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.

Parameters
aFsFile server session used for opening the zipfile
aFileNameName of the zipfile
Return Value
CZipFile object associated with the zipfile if it succeeded
Leave Codes
KZipArchiveErrorIf file cannot be accessed(invalid handle, corrupt file header, etc.)
KZipFileIOErrorIf file cannot be read
KCentralDirectoryTrailerNotFoundIf zip file header doesn't contain information about files inside the archive
KCentralDirectoryTrailerInvalidIf the information about files inside the archive is corrupt
KMultiDiskArchivesNotSupportedIf zipfile is a multi disk archive.
...Any one of the system-wide error codes for other errors.

OpenFileL ( const TDesC & )

voidOpenFileL(const TDesC &aFileName)[protected]

OpenL ( void )

IMPORT_C TIntOpenL(void)

Deprecatedin 7.0

Read ( TByte *, TUint32 )

TInt Read(TByte *,
TUint32
)[protected]

Read ( TUint16 & )

TInt Read(TUint16 &)[protected]

Read ( TUint32 & )

TInt Read(TUint32 &)[protected]

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

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

ReadCentralDirectoryTrailer ( TUint32, TCentralDirectoryTrailer & )

TInt ReadCentralDirectoryTrailer(TUint32offset,
TCentralDirectoryTrailer &
)[protected]

ReadLocalHeader ( TUint32, TLocalHeader & )

TInt ReadLocalHeader(TUint32,
TLocalHeader &
)[protected]

Seek ( TInt )

TInt Seek(TInt)[protected]

Size ( TInt & )

IMPORT_C TIntSize(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
aSizeOn return, the size of the compressed data in bytes
Return Value
KErrNotReady If object hasn't been properly constructed KErrCASizeNotDetermined If size could not be determined ... Any one of the system-wide error codes for other errors.