diff -r ebc84c812384 -r 46218c8b8afa Symbian3/PDK/Source/GUID-C3086910-D7B4-5549-BF65-374C8B602E8F.dita --- a/Symbian3/PDK/Source/GUID-C3086910-D7B4-5549-BF65-374C8B602E8F.dita Thu Mar 11 15:24:26 2010 +0000 +++ b/Symbian3/PDK/Source/GUID-C3086910-D7B4-5549-BF65-374C8B602E8F.dita Thu Mar 11 18:02:22 2010 +0000 @@ -1,94 +1,94 @@ - - - - - -Compressing -and Decompressing Memory Streams The Zip Compression Library, EZLib provides stream compression -and decompression functionality for the Symbian platforms. This tutorial summarizes -the procedure involved in the compression and decompression of memory streams -by EZLib. -

The functions used -for memory stream compression and decompression are provided by the CEZCompressor class.

The -compression can be executed in single or multiple steps. This is depenedent -on the buffer size of the memory stream. Small buffers are compressed in a -single step. Larger buffers are compressed in small chunks repeatedly till -the entire buffer is compressed. Clients must respond to callbacks from the -library to provide information and resources required to complete the task.

- - -Define a buffer manager that implements MEZBufferManager. - - -Create an instance of the classs CEZCompressor. - - -Invoke CEZCompressor::CompressL() for small buffers. - - -Invoke CEZCompressor::DeflateL() repeatedly on larger -buffers until the entire buffer is compressed. - - -class CBufferManager : public CBase, public MEZBufferManager - { -public: - CBufferManager* CBufferManager::NewLC(); - CBufferManager* CBufferManager::NewL(); - ~CBufferManager(); - void InitializeL(CEZZStream &aZStream); - void NeedInputL(CEZZStream &aZStream); - void NeedOutputL(CEZZStream &aZStream); - void FinalizeL(CEZZStream &aZStream); - }; - -CBufferManager* CBufferManager::NewLC() - { - CBufferManager* bm = new (ELeave) CBufferManager(); - CleanupStack::PushL(bm); - return bm; - } - -CBufferManager* CBufferManager::NewL() - { - CBufferManager* bm = new (ELeave) CBufferManager(); - CleanupStack::PushL(bm); - CleanupStack::Pop(); - return bm; - } - -static void doExampleL() - { - - CBufferManager* bm = CBufferManager::NewLC(); - //TInt aLevel = EDefaultCompression, TInt aWindowBits = EMaxWBits, TInt aMemLevel = EDefMemLevel, TStrategy aStrategy = EDefaultStrategy); - CEZCompressor* iCEZCompressor = CEZCompressor::NewLC(*bm); // all other flag values are default in its constructer - - while(icompressor->DeflateL()) - { - } - - - CleanupStack::PopAndDestroy(2); - - } - - - -

To decompress the -memory streams:

    -
  1. Define a buffer manager -that implements MEZBufferManager.

  2. -
  3. Create an instance of -the classs CEZDecompressor.

  4. -
  5. Invoke CEZDecompressor::DecompressL() for -small buffers.

    Invoke CEZDecompressor::InflateL() repeatedly -on larger buffers until the entire buffer is compressed.

  6. -
+ + + + + +Compressing +and Decompressing Memory Streams The Zip Compression Library, EZLib provides stream compression +and decompression functionality for the Symbian platforms. This tutorial summarizes +the procedure involved in the compression and decompression of memory streams +by EZLib. +

The functions used +for memory stream compression and decompression are provided by the CEZCompressor class.

The +compression can be executed in single or multiple steps. This is depenedent +on the buffer size of the memory stream. Small buffers are compressed in a +single step. Larger buffers are compressed in small chunks repeatedly till +the entire buffer is compressed. Clients must respond to callbacks from the +library to provide information and resources required to complete the task.

+ + +Define a buffer manager that implements MEZBufferManager. + + +Create an instance of the classs CEZCompressor. + + +Invoke CEZCompressor::CompressL() for small buffers. + + +Invoke CEZCompressor::DeflateL() repeatedly on larger +buffers until the entire buffer is compressed. + + +class CBufferManager : public CBase, public MEZBufferManager + { +public: + CBufferManager* CBufferManager::NewLC(); + CBufferManager* CBufferManager::NewL(); + ~CBufferManager(); + void InitializeL(CEZZStream &aZStream); + void NeedInputL(CEZZStream &aZStream); + void NeedOutputL(CEZZStream &aZStream); + void FinalizeL(CEZZStream &aZStream); + }; + +CBufferManager* CBufferManager::NewLC() + { + CBufferManager* bm = new (ELeave) CBufferManager(); + CleanupStack::PushL(bm); + return bm; + } + +CBufferManager* CBufferManager::NewL() + { + CBufferManager* bm = new (ELeave) CBufferManager(); + CleanupStack::PushL(bm); + CleanupStack::Pop(); + return bm; + } + +static void doExampleL() + { + + CBufferManager* bm = CBufferManager::NewLC(); + //TInt aLevel = EDefaultCompression, TInt aWindowBits = EMaxWBits, TInt aMemLevel = EDefMemLevel, TStrategy aStrategy = EDefaultStrategy); + CEZCompressor* iCEZCompressor = CEZCompressor::NewLC(*bm); // all other flag values are default in its constructer + + while(icompressor->DeflateL()) + { + } + + + CleanupStack::PopAndDestroy(2); + + } + + + +

To decompress the +memory streams:

    +
  1. Define a buffer manager +that implements MEZBufferManager.

  2. +
  3. Create an instance of +the classs CEZDecompressor.

  4. +
  5. Invoke CEZDecompressor::DecompressL() for +small buffers.

    Invoke CEZDecompressor::InflateL() repeatedly +on larger buffers until the entire buffer is compressed.

  6. +
\ No newline at end of file