1 // Copyright (c) 1999-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.
14 // Declaration for Decompression class
18 #ifndef __EZDECOMPRESSOR_H__
19 #define __EZDECOMPRESSOR_H__
26 The CEZDecompressor class provides in-memory de-compression functions, including integrity checks of the compressed data.
27 This version of the library supports only one compression / de-compression method (deflation / inflation). De-compression
28 can be done in a single step (using DecompressL()) if the buffers are large enough (for example if an input file is mmap'ed),
29 or can be done by repeated calls of the InflateL() function. The source data is de-compressed to the target buffer (both source
30 and target contained within the buffer manager argument).
32 Note: In this version of the library a windowBits value of 8 is unsupported due to a problem with the window size being
33 set to 256 bytes. Although a value of 8 will be accepted by the CEZCompressor constructors, as it is being changed
34 internally by Zlib from 8 to 9, it will not be possible to use the same value for decompression. This is because the
35 Zlib functions called by the CEZDecompressor constructors do not make the same change internally and as a result a
36 KEZlibErrData is returned when calling InflateL(). It is therefore advised that for this version of the library
37 windowBits of 9 is used in place of 8.
42 class CEZDecompressor : public CEZZStream
45 /** Decompression panic values */
48 EInflateInitlialiserError = EUnexpected + 1,
51 EInflateDictionaryError
54 /** Window Bits - the base two logarithm of the window size (the size of the history buffer) */
63 IMPORT_C static CEZDecompressor* NewLC(MEZBufferManager& aInit, TInt aWindowBits = EMaxWBits);
64 IMPORT_C static CEZDecompressor* NewL(MEZBufferManager& aInit, TInt aWindowBits = EMaxWBits);
66 IMPORT_C static CEZDecompressor* NewLC(MEZBufferManager& aInit, const TDesC8& aDictionary, TInt aWindowBits = EMaxWBits);
67 IMPORT_C static CEZDecompressor* NewL(MEZBufferManager& aInit, const TDesC8& aDictionary, TInt aWindowBits = EMaxWBits);
70 IMPORT_C void ResetL(MEZBufferManager& aInit);
71 IMPORT_C TBool InflateL();
73 IMPORT_C static void DecompressL(TDes8 &aDestination, const TDesC8 &aSource);
84 void SetDictionaryL();
85 CEZDecompressor(MEZBufferManager* aInit);
86 CEZDecompressor(MEZBufferManager* aInit, const TUint8 *aDictionary, TInt aLength);
87 void ConstructL(TInt aWindowBits);
90 MEZBufferManager* iBufferInit;
91 TInflationState iInflationState;
92 const TUint8* iDictionary;
93 TInt iDictionaryLength;