epoc32/include/zipfilememberinputstream.h
author William Roberts <williamr@symbian.org>
Tue, 16 Mar 2010 16:12:26 +0000
branchSymbian2
changeset 2 2fe1408b6811
parent 0 061f57f2323e
child 4 837f303aceeb
permissions -rw-r--r--
Final list of Symbian^2 public API header files
williamr@2
     1
// Copyright (c) 2003-2009 Nokia Corporation and/or its subsidiary(-ies).
williamr@2
     2
// All rights reserved.
williamr@2
     3
// This component and the accompanying materials are made available
williamr@2
     4
// under the terms of the License "Symbian Foundation License v1.0" to Symbian Foundation members and "Symbian Foundation End User License Agreement v1.0" to non-members
williamr@2
     5
// which accompanies this distribution, and is available
williamr@2
     6
// at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
williamr@2
     7
//
williamr@2
     8
// Initial Contributors:
williamr@2
     9
// Nokia Corporation - initial contribution.
williamr@2
    10
//
williamr@2
    11
// Contributors:
williamr@2
    12
//
williamr@2
    13
// Description:
williamr@2
    14
// $Revision: 1.2 $
williamr@2
    15
// 
williamr@2
    16
//
williamr@2
    17
williamr@2
    18
#ifndef _ZIP_FILE_MEMBER_INPUT_STREAM_H_
williamr@2
    19
#define _ZIP_FILE_MEMBER_INPUT_STREAM_H_
williamr@2
    20
williamr@2
    21
#include <ezlib.h>
williamr@2
    22
#include "localtypes.h"
williamr@2
    23
#include <s32file.h>
williamr@2
    24
williamr@2
    25
class CZipFile;
williamr@2
    26
williamr@2
    27
/**
williamr@2
    28
A RZipFileMemberReaderStream represents a input stream for compressed files in the archive. 
williamr@2
    29
This is a friend class to CZipFile. In order to create a input stream for a file in the archive,
williamr@2
    30
CZipFile will call its member function GetInputStreamL() by passing a pointer to 
williamr@2
    31
RZipFileMemberReaderStream and the function will return the input stream for the file
williamr@2
    32
Note: This class is actually a C class as it derives from CBase
williamr@2
    33
williamr@2
    34
@publishedAll
williamr@2
    35
@released
williamr@2
    36
*/
williamr@2
    37
class RZipFileMemberReaderStream : public CBase
williamr@2
    38
	{
williamr@2
    39
friend class CZipFile;
williamr@2
    40
williamr@2
    41
public:
williamr@2
    42
	
williamr@2
    43
	IMPORT_C ~RZipFileMemberReaderStream();
williamr@2
    44
	IMPORT_C TInt Read(TDes16& aDes, TInt aLength);
williamr@2
    45
	
williamr@2
    46
	/**
williamr@2
    47
	Overload version of the RZipFileMemberReaderStream read method.
williamr@2
    48
	On return, contains the data read from the stream buffer.
williamr@2
    49
	
williamr@2
    50
	@param aDes The target descriptor for the data read from the stream buffer
williamr@2
    51
	@param aLength The maximum number of bytes to be read
williamr@2
    52
	@return KErrNone If all bytes read successfully.
williamr@2
    53
	@return	KErrCorrupt If reading fails.
williamr@2
    54
	@return KErrEof If end of file is reached.
williamr@2
    55
	@return ... Any one of the system-wide error codes for other errors.
williamr@2
    56
	*/	
williamr@2
    57
	virtual TInt Read(TDes8& aDes, TInt aLength);
williamr@2
    58
	
williamr@2
    59
	/**
williamr@2
    60
	Overload version of the RZipFileMemberReaderStream readL method.
williamr@2
    61
	On return, contains the data read from the stream buffer.
williamr@2
    62
	
williamr@2
    63
	@param aDes The target descriptor for the data read from the stream buffer
williamr@2
    64
	@param aLength The maximum number of bytes to be read
williamr@2
    65
	@leave KErrNone If all bytes read successfully.
williamr@2
    66
	@leave KErrCorrupt If reading fails.
williamr@2
    67
	@leave KErrEof If end of file is reached.
williamr@2
    68
	@leave ... Any one of the system-wide error codes for other errors.
williamr@2
    69
	*/
williamr@2
    70
	virtual void ReadL(TDes16& aDes, TInt aLength);
williamr@2
    71
williamr@2
    72
williamr@2
    73
	void Release();
williamr@2
    74
	void Close();
williamr@2
    75
williamr@2
    76
private:
williamr@2
    77
	RZipFileMemberReaderStream(CZipFile&, TUint32, TUint32, TUint32, TUint32);
williamr@2
    78
	
williamr@2
    79
	static RZipFileMemberReaderStream* NewL(CZipFile&, TUint32, TUint32, TUint32, TUint32);
williamr@2
    80
	void RZipFileMemberReaderStream::ConstructL();
williamr@2
    81
	
williamr@2
    82
	virtual TInt Read(void);
williamr@2
    83
	virtual TInt Read(TByte*, TUint32, TUint32*);
williamr@2
    84
williamr@2
    85
	TInt GetBytes(TByte*, TUint32, TUint32*);
williamr@2
    86
	TInt GetCompressedBytes(void);
williamr@2
    87
	TInt GetStoredBytes(TByte*, TUint32, TUint32*);
williamr@2
    88
	
williamr@2
    89
	void ReadL(TDes8&);
williamr@2
    90
	void ReadL(TDes16&);
williamr@2
    91
	void ReadL(TDes8&, TChar);
williamr@2
    92
	void ReadL(TDes16&, TChar);
williamr@2
    93
	void ReadL(TUint8*, TInt);
williamr@2
    94
	void ReadL(TUint16*, TInt);
williamr@2
    95
	void ReadL(RWriteStream&);
williamr@2
    96
	void ReadL(RWriteStream&, TInt);
williamr@2
    97
	void ReadL(TInt);
williamr@2
    98
williamr@2
    99
	TInt8 ReadInt8L();
williamr@2
   100
	TInt16 ReadInt16L();
williamr@2
   101
	TInt32 ReadInt32L();
williamr@2
   102
	TUint8 ReadUint8L();
williamr@2
   103
	TUint16 ReadUint16L();
williamr@2
   104
	TUint32 ReadUint32L();
williamr@2
   105
williamr@2
   106
	TReal32 ReadReal32L() __SOFTFP;
williamr@2
   107
	TReal64 ReadReal64L() __SOFTFP;
williamr@2
   108
williamr@2
   109
	void PushL();
williamr@2
   110
	void Pop();
williamr@2
   111
	void Attach(MStreamBuf*);
williamr@2
   112
	void Detach();
williamr@2
   113
	MStreamBuf* Source();
williamr@2
   114
williamr@2
   115
williamr@2
   116
private:
williamr@2
   117
williamr@2
   118
	enum
williamr@2
   119
		{
williamr@2
   120
		kCompressedBytesSize = 1024
williamr@2
   121
		};
williamr@2
   122
		
williamr@2
   123
private:
williamr@2
   124
	
williamr@2
   125
	CZipFile& 	iZipFile;
williamr@2
   126
	
williamr@2
   127
	/** The method for compressing file*/ 
williamr@2
   128
	TUint32   	iCompressionMethod;
williamr@2
   129
	
williamr@2
   130
	z_stream  	iStream;
williamr@2
   131
	
williamr@2
   132
	/** The size of compressed file */
williamr@2
   133
	TUint32     iCompressedSize;
williamr@2
   134
	
williamr@2
   135
	/** The size of uncompressed file */
williamr@2
   136
	TUint32     iUncompressedSize;
williamr@2
   137
	
williamr@2
   138
	TUint32     iFileOffset;
williamr@2
   139
	TUint32     iOffset;
williamr@2
   140
	TBool       iDone;
williamr@2
   141
	
williamr@2
   142
	/** The number of bytes already read in uncompressed bytes*/
williamr@2
   143
	TUint32     iBytesLength;
williamr@2
   144
	
williamr@2
   145
	/** To store compressed bytes read*/
williamr@2
   146
	TByte       iCompressedBytes[kCompressedBytesSize];
williamr@2
   147
	
williamr@2
   148
	/** Not used in implementation*/
williamr@2
   149
	TUint32     iCompressedBytesOffset;
williamr@2
   150
	};
williamr@2
   151
williamr@2
   152
	
williamr@2
   153
#endif /* !_ZIP_FILE_MEMBER_INPUT_STREAM_H_ */