zip compress/decompress question...

Login to reply to this topic.
Wed, 2006-01-04 16:27
Joined: 2003-11-28
Forum posts: 35
Hello,

I want to compress and decompress a string buffer. I've used the following code to do that:

in my header file I have:

#include <EZBufman.h>
......
and I derive my class from MEZBufferManager

...........

private:
void InitializeL(CEZZStream &aZStream);
void NeedInputL(CEZZStream &aZStream);
void NeedOutputL(CEZZStream &aZStream);
void FinalizeL(CEZZStream &aZStream);

............


In my cpp file I have:


#include <ezcompressor.h>
#include <ezdecompressor.h>

.....................

TBuf8<256> buffer=_L8("This is a test to see if the zip compression/decompression is working!");

TO COMPRESS
......................................
TBuf8<256> outBuffer;
TBuf8<256> inBuffer;
inBuffer.Copy(buffer);
CEZCompressor* iCompressor=CEZCompressor::NewL(*this,CEZCompressor::EBestCompression,CEZCompressor::EMaxWBits,CEZCompressor::EDefMemLevel,CEZCompressor::EHuffmanOnly);
CleanupStack::PushL(iCompressor);
iCompressor->CompressL(outBuffer,inBuffer);

CleanupStack::PopAndDestroy();
.......................................


TO DECOMPRESS

...................................
TBuf8<256> inBuffer;
inBuffer.Copy(buffer);
TBuf8<256> outBuffer;

CEZDecompressor* iDecompressor=CEZDecompressor::NewL(*this);
CleanupStack::PushL(iDecompressor);
iDecompressor->DecompressL(outBuffer,inBuffer);
CleanupStack::PopAndDestroy();




My problem is that the compressed string has almost the same size as the uncompressed string.

What's wrong with my code ?

Thanks!

Thu, 2006-01-05 08:14
Joined: 2004-10-12
Forum posts: 44
Re: zip compress/decompress question...
Have you tried with larger amount of data? Compressing your data into a .zip from .txt file actually makes the file larger than the original.
Fri, 2006-03-03 12:55
Joined: 2004-12-09
Forum posts: 78
Re: zip compress/decompress question...
Hi
   I wanted to know that when we compress the input files and when we create the output file do we get the .Zip file as out put.? And if its the zip file can we open it WINZIP  for the windows.
Regards
Girish 
  • Login to reply to this topic.