Does anyone know how to use the Zlib compression library for Series 60 2.0? I've peeped at the various header files, such as ezcompressor.h etc, but they are way too difficult to understand for me.
I am looking for a routine which does decompress the "deflated" content, which I receive via a HTTP response. However, until now I could not get my code to work. I have studied your code example above, and am a bit confused about your DecompressL() usage. Since DecompressL is a static method, it is AFAIK not necessary to instatiate such an object with NewL...
Or am I wrong, and this is the reason why my code does not work?
Forum posts: 50
For compression
TBuf8<100> Source;
TBuf8<100> Dest;
_LIT(Path,"C:\\Nokia\\Others\\Problem.txt");
_LIT(Path1,"C:\\Nokia\\Others\\comProblem.txt");
_LIT(Path2,"C:\\Nokia\\Others\\decomProblem.txt");
CEZCompressor* iCompressor=CEZCompressor::NewLC(*this,Z_DEFAULT_COMPRESSION);
RFs fs;
User :: LeaveIfError (fs.Connect());
RFile ProblemFile;
HBufC8* tempBufferPtr = HBufC8::NewLC( 2000);
TPtr8 unCompressed( tempBufferPtr->Des());
if((ProblemFile.Open(fs,Path,EFileRead|EFileWrite|EFileShareAny|EFileStreamText))==KErrNone )
{
ProblemFile.Read(unCompressed);
}
ProblemFile.Close();
HBufC8* iCompressed=HBufC8::NewL(20000); // allocating space for output
TPtr8 ptrCompressed=iCompressed->Des();
iCompressor->CompressL(ptrCompressed,unCompressed);
if((ProblemFile.Replace(fs,Path1,EFileWrite))==KErrNone )
{
ProblemFile.Write(ptrCompressed);
}
ProblemFile.Close();
For decompression
HBufC8* ideCompressed=HBufC8::NewL(20000); // allocating space for output
TPtr8 ptrdeCompressed=ideCompressed->Des();
iDecompressor->DecompressL(ptrdeCompressed,ptrCompressed);
if((ProblemFile.Replace(fs,Path2,EFileWrite))==KErrNone )
{
ProblemFile.Write(ptrdeCompressed);
}
ProblemFile.Close();
fs.Close();
TBool def=iCompressor->DeflateL();
}
Forum posts: 109
I am looking for a routine which does decompress the "deflated" content, which I receive via a HTTP response. However, until now I could not get my code to work. I have studied your code example above, and am a bit confused about your DecompressL() usage. Since DecompressL is a static method, it is AFAIK not necessary to instatiate such an object with NewL...
Or am I wrong, and this is the reason why my code does not work?
Thanks for any hint, Marcel