Symbian
Symbian OS Library

SYMBIAN OS V9.3

[Index] [Spacer] [Previous] [Next]



Location: zipfile.h
Link against: ezip.lib

Class CZipFile

class CZipFile : public CZipArchive;

Description

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

Derivation

Members

Defined in CZipFile:
CZipFile(), CaseInsensitiveMemberL(), CaseSensitiveOrCaseInsensitiveMemberL(), Close(), ConstructL(), ConstructL(), GetInputStreamL(), GetMembersL(), KZipFileError, KZipFileIOError, KZipFileNotFound, MemberL(), NewL(), NewL(), OpenL(), Size(), TMemberPointer, anonymous, ~CZipFile()

Inherited from CBase:
Delete(), Extension_(), operator new()

Inherited from CZipArchive:
EDeflated, EImploded, EPKWAREImploded, EReducedCFFour, EReducedCFOne, EReducedCFThree, EReducedCFTwo, EReservedOne, EReservedTwo, EShrunk, EStored, KCentralDirectoryHeaderFixedLength, KCentralDirectoryHeaderSignature, KCentralDirectorySignature, KCentralDirectoryTrailerFixedLength, KCentralDirectoryTrailerInvalid, KCentralDirectoryTrailerNotFound, KCentralFileHeaderExtraFieldLengthOffset, KCentralFileHeaderFileNameLengthOffset, KCentralFileHeaderFileNameOffset, KCompressionMethodNotSupported, KLocalHeaderFixedLength, KLocalHeaderSignature, KLocalHeaderSignatureInvalid, KMaxTrailerSearchLength, KMemberNotFound, KMultiDiskArchivesNotSupported, KSignatureLength, KZipArchiveError, KZipArchiveMinError, TCentralDirectoryHeader, TCentralDirectoryTrailer, TCompressionMethod, TLocalHeader


Construction and destruction


NewL()

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

Description

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

Parameters

RFs &aFs

File server session used for opening the zipfile

RFile &aFile

File handle to be used for accessing the zipfile

Return value

CZipFile *

CZipFile object associated with the zipfile if it succeeded

Leave codes

KZipArchiveError

If file cannot be accessed(invalid handle, corrupt file header, etc.)

KZipFileIOError

If file cannot be read

KCentralDirectoryTrailerNotFound

If zip file header doesn't contain information about files inside the archive

KCentralDirectoryTrailerInvalid

If the information about files inside the archive is corrupt

KMultiDiskArchivesNotSupported

If zipfile is a multi disk archive

...

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


NewL()

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

Description

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

RFs &aFs

File server session used for opening the zipfile

const TDesC &aFileName

Name of the zipfile

Return value

CZipFile *

CZipFile object associated with the zipfile if it succeeded

Leave codes

KZipArchiveError

If file cannot be accessed(invalid handle, corrupt file header, etc.)

KZipFileIOError

If file cannot be read

KCentralDirectoryTrailerNotFound

If zip file header doesn't contain information about files inside the archive

KCentralDirectoryTrailerInvalid

If the information about files inside the archive is corrupt

KMultiDiskArchivesNotSupported

If zipfile is a multi disk archive.

...

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


CZipFile()

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

Description

Parameters

RFs &aFs

const TDesC &aFileName


~CZipFile()

virtual IMPORT_C ~CZipFile();

Description

Destructor


ConstructL()

protected: IMPORT_C void ConstructL(const TDesC &aFileName);

Description

Second phase of construction. Used by filename using NewL overload

Parameters

const TDesC &aFileName

Leave codes

...

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


ConstructL()

protected: IMPORT_C void ConstructL(RFile &aFile);

Description

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

Parameters

RFile &aFile

Leave codes

...

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

[Top]


Member functions


OpenL()

IMPORT_C TInt OpenL(void);

Description

Return value

TInt


Close()

IMPORT_C void Close(void);

Description


Size()

IMPORT_C TInt Size(TInt &aSize) const;

Description

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

Return value

TInt

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.


MemberL()

IMPORT_C CZipFileMember *MemberL(const TDesC &aName);

Description

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

const TDesC &aName

The name of the file to be searched in the zipfile

Return value

CZipFileMember *

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.


CaseInsensitiveMemberL()

IMPORT_C CZipFileMember *CaseInsensitiveMemberL(const TDesC &aName);

Description

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

const TDesC &aName

The name of the file to be searched in the zipfile

Return value

CZipFileMember *

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()

IMPORT_C CZipFileMember *CaseSensitiveOrCaseInsensitiveMemberL(const TDesC &aName);

Description

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

const TDesC &aName

The name of the file to be searched in the zipfile

Return value

CZipFileMember *

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.


GetInputStreamL()

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

Description

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

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.

Return value

TInt

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()

IMPORT_C CZipFileMemberIterator *GetMembersL(void);

Description

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

CZipFileMemberIterator *

Pointer to a newly allocated CZipFileMemberIterator object

Leave codes

...

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

[Top]


Member structures


Struct TMemberPointer

protected: struct TMemberPointer;

Description

Internal representation of a compressed file in a zipfile

Members

Defined in CZipFile::TMemberPointer:
iCRC32, iCentralHeaderOffset, iCompressedSize, iLocalHeaderOffset, iName, iUncompressedSize

Member data


iName

TFileName * iName;

Description

the name of a compressed file


iCentralHeaderOffset

TUint32 iCentralHeaderOffset;

Description

Not used in current implementation


iLocalHeaderOffset

TUint32 iLocalHeaderOffset;

Description

The local offset of header in a compressed file


iCRC32

TUint32 iCRC32;

Description

CRC with 32 bits length in a compressed file


iCompressedSize

TUint32 iCompressedSize;

Description

The size of compressed file


iUncompressedSize

TUint32 iUncompressedSize;

Description

The size of file without compressed

[Top]


Member enumerations


Enum anonymous

n/a

Description

ZipFile error enumeration.

KZipFileError

Cannot read file directory in the archive file

KZipFileNotFound

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

KZipFileIOError

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.