Symbian
Symbian OS Library

SYMBIAN OS V9.3

[Index] [Spacer] [Previous] [Next]



Location: EZCompressor.h
Link against: ezlib.lib

Class CEZCompressor

class CEZCompressor : public CEZZStream;

Description

The CEZCompressor class provides in-memory compression functions, including integrity checks of the uncompressed data. This version of the library supports only one compression method (deflation). Compression can be done in a single step (using CompressL()) if the buffers are large enough (for example if an input file is mmap'ed), or can be done by repeated calls of the DeflateL() function. The source data is compressed to the target buffer (both source and target contained within the buffer manager argument), and various other arguments distinguish the different compression settings.

Derivation

Members

Defined in CEZCompressor:
CompressL(), DeflateL(), EBestCompression, EBestSpeed, EDefMemLevel, EDefaultCompression, EDefaultStrategy, EDeflateInitlialiserError, EDeflateTerminated, EFiltered, EHuffmanOnly, EMaxWBits, ENoCompression, NewL(), NewL(), NewLC(), NewLC(), ResetL(), TStrategy, anonymous, anonymous, anonymous, anonymous

Inherited from CBase:
Delete(), Extension_(), operator new()

Inherited from CEZZStream:
Adler32(), AvailIn(), AvailOut(), EBufError, EDataError, EStreamError, EUnexpected, EVersionError, OutputDescriptor(), Progress(), SetInput(), SetOutput(), TotalIn(), TotalOut(), iOutputBufferLength, iOutputPointer, iStream


Construction and destruction


NewLC()

static IMPORT_C CEZCompressor *NewLC(MEZBufferManager &aInit, TInt aLevel=EDefaultCompression, TInt aWindowBits=EMaxWBits, TInt aMemLevel=EDefMemLevel, TStrategy aStrategy=EDefaultStrategy);

Description

Creates a new CEZCompressor object and leaves it on the CleanupStack

Parameters

MEZBufferManager &aInit

buffer manager to handle both input and output buffers

TInt aLevel

compression levels

TInt aWindowBits

the base two logarithm of the window size (the size of the history buffer). It should be in the range 8..15 for this version of the library. Larger values of this parameter result in better compression at the expense of memory usage.

TInt aMemLevel

specifies how much memory should be allocated for the internal compression state. memLevel=1 uses minimum memory but is slow and reduces compression ratio; memLevel=9 uses maximum memory for optimal speed.

TStrategy aStrategy

compression strategy - used to tune the compression algorithm. The strategy parameter only affects the compression ratio but not the correctness of the compressed output even if it is not set appropriately

Return value

CEZCompressor *

the new CEZCompressor object (on the CleanupStack)

See also:


NewL()

static IMPORT_C CEZCompressor *NewL(MEZBufferManager &aInit, TInt aLevel=EDefaultCompression, TInt aWindowBits=EMaxWBits, TInt aMemLevel=EDefMemLevel, TStrategy aStrategy=EDefaultStrategy);

Description

Creates a new CEZCompressor object

Parameters

MEZBufferManager &aInit

buffer manager to handle both input and output buffers

TInt aLevel

compression levels

TInt aWindowBits

the base two logarithm of the window size (the size of the history buffer). It should be in the range 8..15 for this version of the library. Larger values of this parameter result in better compression at the expense of memory usage.

TInt aMemLevel

specifies how much memory should be allocated for the internal compression state. memLevel=1 uses minimum memory but is slow and reduces compression ratio; memLevel=9 uses maximum memory for optimal speed.

TStrategy aStrategy

compression strategy - used to tune the compression algorithm. The strategy parameter only affects the compression ratio but not the correctness of the compressed output even if it is not set appropriately

Return value

CEZCompressor *

the new CEZCompressor object

See also:


NewLC()

static IMPORT_C CEZCompressor *NewLC(MEZBufferManager &aInit, const TDesC8 &aDictionary, TInt aLevel=EDefaultCompression, TInt aWindowBits=EMaxWBits, TInt aMemLevel=EDefMemLevel, TStrategy aStrategy=EDefaultStrategy);

Description

Overload of CEZCompressor constructor takes aDictionary argument

Parameters

MEZBufferManager &aInit

buffer manager to handle both input and output buffers

const TDesC8 &aDictionary

used to initialize the compression dictionary from the given byte sequence without producing any compressed output. The compressor and decompressor must use exactly the same dictionary. The dictionary should consist of strings (byte sequences) that are likely to be encountered later in the data to be compressed, with the most commonly used strings preferably put towards the end of the dictionary. Using a dictionary is most useful when the data to be compressed is short and can be predicted with good accuracy; the data can then be compressed better than with the default empty dictionary.

TInt aLevel

compression level

TInt aWindowBits

the base two logarithm of the window size (the size of the history buffer). It should be in the range 8..15 for this version of the library. Larger values of this parameter result in better compression at the expense of memory usage.

TInt aMemLevel

specifies how much memory should be allocated for the internal compression state. memLevel=1 uses minimum memory but is slow and reduces compression ratio; memLevel=9 uses maximum memory for optimal speed.

TStrategy aStrategy

compression strategy - used to tune the compression algorithm. The strategy parameter only affects the compression ratio but not the correctness of the compressed output even if it is not set appropriately

Return value

CEZCompressor *

the new CEZCompressor object (on the CleanupStack)

See also:


NewL()

static IMPORT_C CEZCompressor *NewL(MEZBufferManager &aInit, const TDesC8 &aDictionary, TInt aLevel=EDefaultCompression, TInt aWindowBits=EMaxWBits, TInt aMemLevel=EDefMemLevel, TStrategy aStrategy=EDefaultStrategy);

Description

Overload of CEZCompressor constructor takes aDictionary argument

Parameters

MEZBufferManager &aInit

buffer manager to handle both input and output buffers

const TDesC8 &aDictionary

used to initialize the compression dictionary from the given byte sequence without producing any compressed output. The compressor and decompressor must use exactly the same dictionary. The dictionary should consist of strings (byte sequences) that are likely to be encountered later in the data to be compressed, with the most commonly used strings preferably put towards the end of the dictionary. Using a dictionary is most useful when the data to be compressed is short and can be predicted with good accuracy; the data can then be compressed better than with the default empty dictionary.

TInt aLevel

compression level

TInt aWindowBits

the base two logarithm of the window size (the size of the history buffer). It should be in the range 8..15 for this version of the library. Larger values of this parameter result in better compression at the expense of memory usage.

TInt aMemLevel

specifies how much memory should be allocated for the internal compression state. memLevel=1 uses minimum memory but is slow and reduces compression ratio; memLevel=9 uses maximum memory for optimal speed.

TStrategy aStrategy

compression strategy - used to tune the compression algorithm. The strategy parameter only affects the compression ratio but not the correctness of the compressed output even if it is not set appropriately

Return value

CEZCompressor *

the new CEZCompressor object

See also:

[Top]


Member functions


ResetL()

IMPORT_C void ResetL(MEZBufferManager &aInit);

Description

Resets the current compression operation, with the new buffer manager

Parameters

MEZBufferManager &aInit

new buffer manager to handle the new input and output buffers

Leave codes

...

Any of the system wide error codes


DeflateL()

IMPORT_C TBool DeflateL();

Description

Compress the data to the buffer in stages, return value indicates if the compression has finalised or if further calls are necessary

Return value

TBool

ETrue if the function must be called again, EFalse if compression is finalised

Leave codes

KEZlibErrStream

There is a problem with the stream

KEZlibErrBuf

There is a problem with the buffer

KEZlibErrUnexpected

Unexpected programming error

...

Any of the System wide error codes


CompressL()

static IMPORT_C void CompressL(TDes8 &aDestination, const TDesC8 &aSource, TInt aLevel=EDefaultCompression);

Description

Compresses the data in the given buffer

Parameters

TDes8 &aDestination

the target buffer for the compressed data

const TDesC8 &aSource

the buffer containing the data to be compressed

TInt aLevel

the level of compression

Leave codes

KEZLibErrBuf

There is a problem with the buffer

KEZLIbErrStream

There is a problem with the stream

...

Any of the system wide error codes

[Top]


Member enumerations


Enum TStrategy

TStrategy

Description

Compression strategy - used to tune the compression algorithm

EDefaultStrategy

Use for normal data

EFiltered

Force Huffman encoding only (no string match)

EHuffmanOnly

Use for data produced by a filter (or predictor)


Enum anonymous

n/a

Description

Compression levels

EDefaultCompression

ENoCompression

EBestSpeed

EBestCompression


Enum anonymous

n/a

Description

Window Bits - the base two logarithm of the window size (the size of the history buffer)

EMaxWBits


Enum anonymous

n/a

Description

Memory level - specifies how much memory should be allocated for the internal compression state

EDefMemLevel


Enum anonymous

n/a

Description

Compression panic values

EDeflateInitlialiserError

EDeflateTerminated