|
1 // Copyright (c) 2006-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". |
|
7 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description: |
|
14 // Interface class describing class that may be used as |
|
15 // output stream for dom tree |
|
16 // |
|
17 |
|
18 |
|
19 |
|
20 /** |
|
21 @file |
|
22 @internalComponent |
|
23 @prototype |
|
24 */ |
|
25 #ifndef XMLENGCGZIPFILEOUTPUTSTREAM_H |
|
26 #define XMLENGCGZIPFILEOUTPUTSTREAM_H |
|
27 |
|
28 #include <xml/dom/xmlengoutputstream.h> |
|
29 #include <ezbufman.h> //MEZBufferManager |
|
30 |
|
31 #include <ezgzip.h> //TEZGZipHeader |
|
32 class CEZCompressor; |
|
33 |
|
34 |
|
35 |
|
36 class CXmlEngGZIPFileOutputStream : public CBase, public MXmlEngOutputStream, |
|
37 public MEZBufferManager |
|
38 { |
|
39 public: |
|
40 static CXmlEngGZIPFileOutputStream* NewLC(RFile& aOutputFile, RFs& aRFs); |
|
41 static CXmlEngGZIPFileOutputStream* NewL(RFile& aOutputFile, RFs& aRFs); |
|
42 ~CXmlEngGZIPFileOutputStream(); |
|
43 TInt CheckError(); |
|
44 |
|
45 TInt Write( const TDesC8& aBuffer ); |
|
46 TInt Close(); |
|
47 |
|
48 /** |
|
49 * Implementation of MEZBufferManager interface. |
|
50 */ |
|
51 void InitializeL(CEZZStream& aZStream); |
|
52 void NeedInputL(CEZZStream& aZStream); |
|
53 void NeedOutputL(CEZZStream& aZStream); |
|
54 void FinalizeL(CEZZStream& aZStream); |
|
55 |
|
56 protected: |
|
57 CXmlEngGZIPFileOutputStream(RFile& aOutputFile, RFs& aRFs); |
|
58 void ConstructL(); |
|
59 |
|
60 private: |
|
61 void WriteL(const TDesC8& aBuffer); |
|
62 void CloseL(); |
|
63 |
|
64 private: |
|
65 TInt iError; |
|
66 |
|
67 /** |
|
68 * Default input buffers size. |
|
69 */ |
|
70 static const TInt KDefaultInputBufferSize; |
|
71 |
|
72 /** |
|
73 * Output buffer size. It determines, how often output data will be written |
|
74 * to disk. (it's written to disk, when buffer is full. |
|
75 * |
|
76 */ |
|
77 |
|
78 |
|
79 static const TInt KOutputBufferSize; |
|
80 |
|
81 RBuf8 iOutputDescriptor; |
|
82 RBuf8 iInputDescriptor; |
|
83 RBuf8 iOldInputDescriptor; |
|
84 |
|
85 /** |
|
86 * Engine of GZiping |
|
87 */ |
|
88 CEZCompressor* iCompressor; |
|
89 TInt32 iCrc; |
|
90 TEZGZipHeader iHeader; |
|
91 TInt iUncompressedDataSize; |
|
92 RFile iOutputFile; |
|
93 RFs iRFs; |
|
94 |
|
95 /** |
|
96 * State of the object. |
|
97 */ |
|
98 TBool iNoInputNeeded; |
|
99 TBool iKeepGoing; |
|
100 TBool iCloseInvoked; |
|
101 |
|
102 }; |
|
103 |
|
104 |
|
105 |
|
106 #endif /* XMLENGCGZIPFILEOUTPUTSTREAM_H */ |