diff -r ebc84c812384 -r 46218c8b8afa Symbian3/PDK/Source/GUID-548CC331-8E38-5627-A925-EA386BE90258.dita --- a/Symbian3/PDK/Source/GUID-548CC331-8E38-5627-A925-EA386BE90258.dita Thu Mar 11 15:24:26 2010 +0000 +++ b/Symbian3/PDK/Source/GUID-548CC331-8E38-5627-A925-EA386BE90258.dita Thu Mar 11 18:02:22 2010 +0000 @@ -1,121 +1,121 @@ - - - - - -Compressing -and Decompressing File - GZip Format The Zip Compression Library, EZLib provides file compression -and decompression functionality for the Symbian platforms. The files can be -compressed to two formats namely zip and gzip. gzip is normally used to compress -single files.

-

Compression and -Decompression are performed iteratively, till the completion of required task.

- - -Input the source file and the name of the target gzip file to an instance -of the CEZFileToGZip class. - - - CEZFileToGZip::DeflateL() is used to compress the -file. - - -

The code below depicts how the source file "input.doc" file is -converted to target file "output.gz".

/* - * If input and output file names are not specified then it is assumed that - * the file names are contained in a provided .ini file. - */ - -void CEZlibEZipTests::DoEZlibGZipDeflateL() - { - - - RFs iFs; - iFS.connect(); - - - //Open the source file in read mode -_LIT(KInputFileLocation, "c:\\private\\E80000B7\\zip\\input\\input.doc"); -TFileName inputFile(KInputFileLocation); - - RFile input; - err = input.Open(iFS, inputFile, EFileStream | EFileRead | EFileShareExclusive); - - if(err != KErrNone) - { - INFO_PRINTF1(KOpenFileError); - User::Leave(err); - } - - - //create a target file - -_LIT(KOutputFileLocation, "c:\\private\\E80000B7\\zip\\input\\output.gz"); -TFileName outputFile(KOutputFileLocation); - - - - CEZFileToGZip *compressor = CEZFileToGZip::NewLC(iFs, outputFile, input); - - - while(compressor->DeflateL()) - { - } -input.Close(); - iFS.Close(); - - - } -
-

The decompression of a gzip file can be achieved through the following -the steps:

    -
  1. Pass the file to the -constructor of the CEZGZipToFile class.

  2. -
  3. CEZGZipToFile::InflateL() is -called repeatedly to complete the decompression.

  4. -

The code below depicts how "output.gz" is decompressed to "input.doc".

/* - * If input and output file names are not specified then it is assumed that - * the file names are contained in a provided .ini file. - */ -void CEZlibEZipTests::DoEZlibGZipInflateL() - { - RFs iFs; - iFS.connect(); - - - //open output file - -_LIT(KOutputFile, "c:\\private\\E80000B7\\zip\\input\\input.doc"); -TFileName outputFile(KOutputFile); - RFile output; - err = output.Replace(iFs, outputFile, EFileStream | EFileWrite | EFileShareExclusive); - if(err != KErrNone) - { - INFO_PRINTF1(KCreateFileError); - User::Leave(err); - } - - -//input file - - -_LIT(KInputFileLocation, "c:\\private\\E80000B7\\zip\\input\\output.gz"); -TFileName inputFile(KInputFileLocation); - - CEZGZipToFile *decompressor = CEZGZipToFile::NewLC(iFs, inputFile, output); - - while(decompressor->InflateL()) - { - } - - output.Close(); - iFS.Close(); - ; - }
+ + + + + +Compressing +and Decompressing File - GZip Format The Zip Compression Library, EZLib provides file compression +and decompression functionality for the Symbian platforms. The files can be +compressed to two formats namely zip and gzip. gzip is normally used to compress +single files.

+

Compression and +Decompression are performed iteratively, till the completion of required task.

+ + +Input the source file and the name of the target gzip file to an instance +of the CEZFileToGZip class. + + + CEZFileToGZip::DeflateL() is used to compress the +file. + + +

The code below depicts how the source file "input.doc" file is +converted to target file "output.gz".

/* + * If input and output file names are not specified then it is assumed that + * the file names are contained in a provided .ini file. + */ + +void CEZlibEZipTests::DoEZlibGZipDeflateL() + { + + + RFs iFs; + iFS.connect(); + + + //Open the source file in read mode +_LIT(KInputFileLocation, "c:\\private\\E80000B7\\zip\\input\\input.doc"); +TFileName inputFile(KInputFileLocation); + + RFile input; + err = input.Open(iFS, inputFile, EFileStream | EFileRead | EFileShareExclusive); + + if(err != KErrNone) + { + INFO_PRINTF1(KOpenFileError); + User::Leave(err); + } + + + //create a target file + +_LIT(KOutputFileLocation, "c:\\private\\E80000B7\\zip\\input\\output.gz"); +TFileName outputFile(KOutputFileLocation); + + + + CEZFileToGZip *compressor = CEZFileToGZip::NewLC(iFs, outputFile, input); + + + while(compressor->DeflateL()) + { + } +input.Close(); + iFS.Close(); + + + } +
+

The decompression of a gzip file can be achieved through the following +the steps:

    +
  1. Pass the file to the +constructor of the CEZGZipToFile class.

  2. +
  3. CEZGZipToFile::InflateL() is +called repeatedly to complete the decompression.

  4. +

The code below depicts how "output.gz" is decompressed to "input.doc".

/* + * If input and output file names are not specified then it is assumed that + * the file names are contained in a provided .ini file. + */ +void CEZlibEZipTests::DoEZlibGZipInflateL() + { + RFs iFs; + iFS.connect(); + + + //open output file + +_LIT(KOutputFile, "c:\\private\\E80000B7\\zip\\input\\input.doc"); +TFileName outputFile(KOutputFile); + RFile output; + err = output.Replace(iFs, outputFile, EFileStream | EFileWrite | EFileShareExclusive); + if(err != KErrNone) + { + INFO_PRINTF1(KCreateFileError); + User::Leave(err); + } + + +//input file + + +_LIT(KInputFileLocation, "c:\\private\\E80000B7\\zip\\input\\output.gz"); +TFileName inputFile(KInputFileLocation); + + CEZGZipToFile *decompressor = CEZGZipToFile::NewLC(iFs, inputFile, output); + + while(decompressor->InflateL()) + { + } + + output.Close(); + iFS.Close(); + ; + }
\ No newline at end of file