xml/xmldomandxpath/src/xmlengineserializer/xmlenggzipbufferoutputstream.h
changeset 0 e35f40988205
equal deleted inserted replaced
-1:000000000000 0:e35f40988205
       
     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  @released
       
    24 */
       
    25 #ifndef XMLENGCGZIPBUFFEROUTPUTSTREAM_H
       
    26 #define XMLENGCGZIPBUFFEROUTPUTSTREAM_H
       
    27 
       
    28 #include <xml/dom/xmlengoutputstream.h>
       
    29 #include <ezbufman.h>   //MEZBufferManager
       
    30 #include <ezgzip.h>     //TEZGZipHeader
       
    31 
       
    32 class CEZCompressor;
       
    33 
       
    34 
       
    35 
       
    36 class CXmlEngGZIPBufferOutputStream : public CBase, public MXmlEngOutputStream, public MEZBufferManager
       
    37 	{
       
    38 	public:
       
    39         static CXmlEngGZIPBufferOutputStream* NewLC(RBuf8& aOutputBuffer);
       
    40 
       
    41         static CXmlEngGZIPBufferOutputStream* NewL(RBuf8& aOutputBuffer);
       
    42 
       
    43 	    ~CXmlEngGZIPBufferOutputStream();
       
    44 	    
       
    45 	    /**
       
    46 	     * Get last error
       
    47 	     */
       
    48 		TInt CheckError();
       
    49 
       
    50         /**
       
    51          * Implementation of MXmlEngOutputStream interface.
       
    52          */
       
    53 	    TInt Write( const TDesC8& aBuffer );
       
    54 		TInt Close();
       
    55         
       
    56         /**
       
    57          * Implementation of MEZBufferManager interface.
       
    58          */
       
    59 	    void InitializeL(CEZZStream& aZStream);
       
    60 	    void NeedInputL(CEZZStream& aZStream);
       
    61 	    void NeedOutputL(CEZZStream& aZStream);
       
    62 	    void FinalizeL(CEZZStream& aZStream);
       
    63 
       
    64 
       
    65     protected:
       
    66 	    CXmlEngGZIPBufferOutputStream(RBuf8& aOutputBuffer);
       
    67 	    void ConstructL();
       
    68 
       
    69     private:
       
    70         void WriteL(const TDesC8& aBuffer);
       
    71 		void CloseL();
       
    72 			
       
    73 	private:
       
    74 	    /**
       
    75 	     * Last error
       
    76 	     */
       
    77 	    TInt iError;
       
    78 	    
       
    79 	    /**
       
    80 	     * Default input buffers size.
       
    81 	     */
       
    82 	    static const TInt KDefaultInputBufferSize = 4096;
       
    83 	    
       
    84 	    /**
       
    85 	     * Output buffer size. It determines, how often output data will be written
       
    86 	     * to disk. (it's written to disk, when buffer is full.
       
    87 	     *
       
    88 	     */   
       
    89 	    static const TInt KOutputBufferSize = 0x8000;
       
    90 	    
       
    91 	    RBuf8 iOutputDescriptor;
       
    92 	    RBuf8 iInputDescriptor;
       
    93 	    RBuf8 iOldInputDescriptor;
       
    94 	    
       
    95 	    /**
       
    96 	     * Engine of GZiping
       
    97 	     */
       
    98 	    CEZCompressor* iCompressor;
       
    99 
       
   100 	    RBuf8& iOutputString;
       
   101         /**
       
   102          * State of the object.
       
   103          */	    
       
   104 	    TBool iNoInputNeeded;
       
   105 	    TBool iKeepGoing;
       
   106 	    TBool iCloseInvoked;
       
   107 	    
       
   108 	}; 
       
   109 
       
   110 
       
   111 
       
   112 #endif /* XMLENGCGZIPBUFFEROUTPUTSTREAM_H */