1 // Copyright (c) 2003-2009 Nokia Corporation and/or its subsidiary(-ies).
2 // All rights reserved.
3 // This component and the accompanying materials are made available
4 // under the terms of "Eclipse Public License v1.0"
5 // which accompanies this distribution, and is available
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
8 // Initial Contributors:
9 // Nokia Corporation - initial contribution.
17 #ifndef _ZIP_FILE_MEMBER_INPUT_STREAM_H_
18 #define _ZIP_FILE_MEMBER_INPUT_STREAM_H_
21 #include <localtypes.h>
27 A RZipFileMemberReaderStream represents a input stream for compressed files in the archive.
28 This is a friend class to CZipFile. In order to create a input stream for a file in the archive,
29 CZipFile will call its member function GetInputStreamL() by passing a pointer to
30 RZipFileMemberReaderStream and the function will return the input stream for the file
31 Note: This class is actually a C class as it derives from CBase
36 class RZipFileMemberReaderStream : public CBase
38 friend class CZipFile;
42 IMPORT_C ~RZipFileMemberReaderStream();
43 IMPORT_C TInt Read(TDes16& aDes, TInt aLength);
46 Overload version of the RZipFileMemberReaderStream read method.
47 On return, contains the data read from the stream buffer.
49 @param aDes The target descriptor for the data read from the stream buffer
50 @param aLength The maximum number of bytes to be read
51 @return KErrNone If all bytes read successfully.
52 @return KErrCorrupt If reading fails.
53 @return KErrEof If end of file is reached.
54 @return ... Any one of the system-wide error codes for other errors.
56 virtual TInt Read(TDes8& aDes, TInt aLength);
59 Overload version of the RZipFileMemberReaderStream readL method.
60 On return, contains the data read from the stream buffer.
62 @param aDes The target descriptor for the data read from the stream buffer
63 @param aLength The maximum number of bytes to be read
64 @leave KErrNone If all bytes read successfully.
65 @leave KErrCorrupt If reading fails.
66 @leave KErrEof If end of file is reached.
67 @leave ... Any one of the system-wide error codes for other errors.
69 virtual void ReadL(TDes16& aDes, TInt aLength);
76 RZipFileMemberReaderStream(CZipFile&, TUint32, TUint32, TUint32, TUint32);
78 static RZipFileMemberReaderStream* NewL(CZipFile&, TUint32, TUint32, TUint32, TUint32);
79 void RZipFileMemberReaderStream::ConstructL();
81 virtual TInt Read(void);
82 virtual TInt Read(TByte*, TUint32, TUint32*);
84 TInt GetBytes(TByte*, TUint32, TUint32*);
85 TInt GetCompressedBytes(void);
86 TInt GetStoredBytes(TByte*, TUint32, TUint32*);
90 void ReadL(TDes8&, TChar);
91 void ReadL(TDes16&, TChar);
92 void ReadL(TUint8*, TInt);
93 void ReadL(TUint16*, TInt);
94 void ReadL(RWriteStream&);
95 void ReadL(RWriteStream&, TInt);
102 TUint16 ReadUint16L();
103 TUint32 ReadUint32L();
105 TReal32 ReadReal32L() __SOFTFP;
106 TReal64 ReadReal64L() __SOFTFP;
110 void Attach(MStreamBuf*);
112 MStreamBuf* Source();
119 kCompressedBytesSize = 1024
126 /** The method for compressing file*/
127 TUint32 iCompressionMethod;
131 /** The size of compressed file */
132 TUint32 iCompressedSize;
134 /** The size of uncompressed file */
135 TUint32 iUncompressedSize;
141 /** The number of bytes already read in uncompressed bytes*/
142 TUint32 iBytesLength;
144 /** To store compressed bytes read*/
145 TByte iCompressedBytes[kCompressedBytesSize];
147 /** Not used in implementation*/
148 TUint32 iCompressedBytesOffset;
152 #endif /* !_ZIP_FILE_MEMBER_INPUT_STREAM_H_ */