×

Discussion Board

Results 1 to 12 of 12
  1. #1
    Regular Contributor
    Join Date
    Jun 2008
    Posts
    151

    Compression - decompression of files

    Hi All,

    1)I want to develop a file compression - decompression utility on symbian device which contains multiple files.

    ex:
    input : a.txt, b.txt. c.txt.

    output: abc.zip

    I found that there are api for extraction only but which api should use for compression.


    Please solve my query.

    Regards,
    Swapnil

  2. #2
    Regular Contributor
    Join Date
    Jul 2008
    Posts
    136

    Re: Compression - decompression of files

    Quote Originally Posted by swapnil_mahajan View Post
    Hi All,

    1)I want to develop a file compression - decompression utility on symbian device which contains multiple files.

    ex:
    input : a.txt, b.txt. c.txt.

    output: abc.zip

    I found that there are api for extraction only but which api should use for compression.


    Please solve my query.

    Regards,
    Swapnil
    check out CEZCompressor class in SDK and forum for the same

    Regards
    Swapnil

  3. #3
    Super Contributor
    Join Date
    Mar 2004
    Location
    Bangalore,India
    Posts
    2,146

    Re: Compression - decompression of files

    How about trying with the zip conversion library mentioned here.

    Also check the handy articles here, here and here

    There is also an Open C Libz that could be worth trying if you are interested.

    Cheers,
    Mayank

  4. #4
    Regular Contributor
    Join Date
    Jun 2008
    Posts
    151

    Re: Compression - decompression of files

    Hi,

    There is no enough information about CEZCopressor, but whatever i understood it is only used to compress single file.

    I want to copresse multiple uncompressed files or folder containing multiple files to single copressed file.

  5. #5
    Regular Contributor
    Join Date
    Jun 2008
    Posts
    151

    Re: Compression - decompression of files

    Quote Originally Posted by swapnil_mahajan View Post
    Hi,

    There is no enough information about CEZCopressor, but whatever i understood it is only used to compress single file.

    I want to copresse multiple uncompressed files or folder containing multiple files to single copressed file.
    Regards,
    Swapnil
    I am trying to transfer multiple files at a time.
    So, I want to compress them to a file and then uncompress it.

    I saw some post about using API provided by zlib.lib. A couple questions:

    1) is zlib.lib ported on all series 60 devices?
    2) what class and API is appropriate for my purpose?

    Please solve the problem.

    Regards,
    Swapnil

  6. #6
    Nokia Developer Moderator
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    28,750

    Re: Compression - decompression of files

    Check OpenC/C++, it contains zlib.

  7. #7
    Regular Contributor
    Join Date
    Oct 2008
    Posts
    135

    Re: Compression - decompression of string

    hi,

    i want to implement compression and decompression of string but it is not working on emulator

    ui.h code

    #include <EZBufman.h>

    //for compression

    class MEZBufferManager;
    class CEZCompressor;
    class CEZDecompressor;

    class CChitDemoAppUi : public CAknAppUi,public MEZBufferManager

    {
    public:
    void Compress(TInt aCompressionMethod);

    void DeCompress(TDesC8 &aInput);


    void InitializeL(CEZZStream &aZStream);

    void NeedInputL(CEZZStream &aZStream);

    void NeedOutputL(CEZZStream &aZStream);

    void FinalizeL(CEZZStream &aZStream);

    private:
    //for compress
    CEZCompressor* iCompressor;

    CEZDecompressor* iDecompressor;

    .....ui.cpp file

    #include <f32file.h>
    #include <EZCompressor.h>
    #include <EZDecompressor.h>
    #include <EZBufman.h>



    void CChitDemoAppUi::Compress(TInt aCompressionMethod)
    {
    TInt compressionMethod = 0;
    if(aCompressionMethod == 0)
    compressionMethod = Z_DEFAULT_COMPRESSION;
    else if(aCompressionMethod == 1)
    compressionMethod = Z_NO_COMPRESSION;
    else if(aCompressionMethod == 2)
    compressionMethod = Z_BEST_SPEED;
    else if(aCompressionMethod == 3)
    compressionMethod = Z_BEST_COMPRESSION;
    else
    compressionMethod = Z_DEFAULT_COMPRESSION;

    TBuf8<2> target,path;

    TBuf8<2> text;

    TBuf8<2> cipher;

    text.Copy(_L("hi"));
    /*target.Copy(aFileName);
    target.Append(_L(".gz"));
    iFs->SetSessionPath(path);
    RFile problemFile;

    TInt fileSize;
    problemFile.Open(*iFs, aFileName,EFileRead|EFileWrite|EFileShareAny|EFileStreamText);
    problemFile.Size(fileSize);
    HBufC8* tempBufferPtr = HBufC8::NewLC(fileSize);
    TPtr8 unCompressed( tempBufferPtr->Des());
    problemFile.Read(unCompressed);

    HBufC8* iCompressed=HBufC8::NewLC(fileSize * 2); // allocating space for output
    TPtr8 ptrCompressed=iCompressed->Des();*/
    iCompressor =CEZCompressor::NewLC(*this, compressionMethod);

    TRAPD(err, iCompressor->CompressL(cipher,text));

    if(err == KErrNone)
    {
    /*problemFile.Close();
    if((problemFile.Replace(*iFs,target,EFileWrite))==KErrNone )
    {
    problemFile.Write(ptrCompressed);
    }*/
    TBuf<100> mess;

    mess.Append(_L("decrypted string"));

    mess.Copy(cipher);

    CAknInformationNote* note = new (ELeave) CAknInformationNote;

    note->ExecuteLD( mess);
    }
    else
    {
    // Error
    }

    // problemFile.Close();
    CleanupStack::PopAndDestroy(3);

    }
    void CChitDemoAppUi:eCompress(TDesC8 &aInput)
    {
    TBuf<5> ext;
    TBuf8<2> dest,source;

    source.Copy(aInput);

    /*ext.Copy(aFileName.Right(3));
    ext.LowerCase();

    if(ext == _L(".gz"))
    target.Copy(aFileName.Left(aFileName.Length() - 3));
    else
    target.Copy(aFileName);

    iFs->SetSessionPath(path);
    RFile problemFile;

    TInt fileSize;
    problemFile.Open(*iFs, aFileName, EFileRead|EFileWrite|EFileShareAny|EFileStreamText);
    problemFile.Size(fileSize);
    HBufC8* iCompressed=HBufC8::NewLC(fileSize); // allocating space for output
    TPtr8 ptrCompressed=iCompressed->Des();
    problemFile.Read(ptrCompressed);

    HBufC8* ideCompressed=HBufC8::NewLC(1000000);
    TPtr8 ptrdeCompressed=ideCompressed->Des();*/
    iDecompressor=CEZDecompressor::NewLC(*this);

    TRAPD(err, iDecompressor->DecompressL(dest,source));

    if(err == KErrNone)
    {
    TBuf<100> mess;

    mess.Append(_L("decrypted string"));

    mess.Copy(dest);

    CAknInformationNote* note = new (ELeave) CAknInformationNote;

    note->ExecuteLD( mess);

    }
    else
    {
    // Error
    }

    // problemFile.Close();
    CleanupStack::PopAndDestroy(3);
    }

    void CChitDemoAppUi::InitializeL(CEZZStream &aZStream)
    {

    }

    void CChitDemoAppUi::NeedInputL(CEZZStream &aZStream)
    {

    }

    void CChitDemoAppUi::NeedOutputL(CEZZStream &aZStream)
    {

    }

    void CChitDemoAppUi::FinalizeL(CEZZStream &aZStream)
    {

    }

    // End of File

    ........................error

    code is compiled but it is not working on emulator (carbide2.0 and vista os)

  8. #8
    Registered User
    Join Date
    Jun 2007
    Location
    Mumbai, India
    Posts
    1,998

    Re: Compression - decompression of string

    "........................error

    code is compiled but it is not working on emulator (carbide2.0 and vista os)"

    What is the error you have mentioned.

  9. #9
    Super Contributor
    Join Date
    Mar 2004
    Location
    Singapore
    Posts
    9,968

    Re: Compression - decompression of files

    is your emulator starting ?

  10. #10
    Registered User
    Join Date
    Feb 2009
    Posts
    19

    Re: Compression - decompression of files

    Hi Swapnil,

    Are you able to compress multiple files and send it to the server ? If so, can you please let me know, how you are doing it.

    Thanks,
    Sreelakshmi.

  11. #11
    Super Contributor
    Join Date
    Jun 2006
    Location
    India
    Posts
    3,037

    Re: Compression - decompression of files

    Quote Originally Posted by sreelakshmir View Post
    Hi Swapnil,

    Are you able to compress multiple files and send it to the server ? If so, can you please let me know, how you are doing it.

    Thanks,
    Sreelakshmi.
    Hi,

    Had you check the link?
    Use [URL="http://qt.nokia.com/products/qt-quick/"]Qt-Quick[/URL] to make your application UI more attractive.

    [URL="http://store.ovi.com/content/271896"]http://store.ovi.com/content/271896[/URL] | [URL="http://store.ovi.com/content/276199"]http://store.ovi.com/content/276199[/URL] |[URL="http://store.ovi.com/content/276202"] http://store.ovi.com/content/276202[/URL] | [URL="http://store.ovi.com/content/280827"]http://store.ovi.com/content/280827[/URL]

  12. #12
    Registered User
    Join Date
    Apr 2009
    Posts
    29

    Re: Compression - decompression of files

    Hi Swapnil,

    I meet same problem as yours.
    can you compress multiple files into a single archive file?
    Please tell me how to do it?

Similar Threads

  1. missing header files from FP1 SDK & Plug-ins.
    By ruchirvasavada in forum Symbian Tools & SDKs
    Replies: 1
    Last Post: 2008-09-08, 20:54
  2. where do installed files 'inside' a .sis go?
    By wormangel in forum Symbian
    Replies: 3
    Last Post: 2008-08-11, 10:49
  3. Nokia UI API
    By samkri in forum Mobile Java Media (Graphics & Sounds)
    Replies: 15
    Last Post: 2005-03-08, 11:26

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×