Results 1 to 5 of 5

Thread: How to archieve files with QtIOCompressor?

  1. #1
    Join Date
    Nov 2009
    Location
    US, Midwest
    Posts
    215
    Thanks
    62
    Thanked 4 Times in 4 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default How to archieve files with QtIOCompressor?

    I can't figure out how to create an archieve of several files using QtIOCompressor (Qt solution). It is quite clear how to store bytearray, and samples also show how to extract the files from the archieve.

    But it is unclear how to store files in the archieve.

    Please mention here if there is another way of creating archieves in Qt. The only thing I found is QtIOCompressor, and for extracting files it does what I need.

    Any help/hints will be greatly appreciated. Thanks.

  2. #2
    Join Date
    Nov 2010
    Posts
    4
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows Symbian S60

    Default Re: How to archieve files with QtIOCompressor?

    That something you would need to implement yourself of use a 3rd party program. There is plenty of those.

  3. #3
    Join Date
    Nov 2009
    Location
    US, Midwest
    Posts
    215
    Thanks
    62
    Thanked 4 Times in 4 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: How to archieve files with QtIOCompressor?

    What's confusing is that "qt solution" provides the way to read the zip archive and extract files from it, but is silent on creating the archive from files. I tried reading a standard zip file and it worked. I can store the files in the archive just by doing steps in reverse, like the example shows, so "rolling your own" is not a problem. I just expected "qt solution" to be a solution for these basic operations of extracting/storing files.

  4. #4
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: How to archieve files with QtIOCompressor?

    The QtIOCompressor class can read and write streams written using the compression methods supported by zlib, i.e. what gzip uses and not PKZIP. Zlib compresses a single stream and normally you would use some other method to catenate multiple files inside the stream, e.g. tar, so that multiple files can be extracted after the stream is decompressed at the other end.

    As the docs say, the compressor can produce a compression compatible with what PKZIP does to a single file within an archive but it does not produce the PKZIP internal file indexes: that is up to you if you want to read/write PKZIP files. The "ziplist" example referred to in the docs should give you help (if it is part of the sources).

  5. The following user says thank you to ChrisW67 for this useful post:

    TorAn (11th November 2010)

  6. #5
    Join Date
    Nov 2009
    Location
    US, Midwest
    Posts
    215
    Thanks
    62
    Thanked 4 Times in 4 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: How to archieve files with QtIOCompressor?

    Yes, the sample shows the way. At the same time it is confusing from the standpoint of a developer who is seeing the reading sample, but can't find writing sample. That led to my question in the first place, I assumed that I am missing something. It turns out that I am not. Reading sample for multiple files exists, but writing multiple files is left as an "excersise" for the developer, although QtIOCompressor is presented as a "Qt Solution". I find it strange.

Similar Threads

  1. QtIOCompressor fix for Mac (Debian Linux?)
    By qdm in forum Qt Programming
    Replies: 0
    Last Post: 23rd June 2010, 02:17
  2. Replies: 9
    Last Post: 28th April 2010, 09:18
  3. Replies: 12
    Last Post: 17th June 2009, 05:34
  4. visual studio project files - adding extra files
    By luf in forum Qt Programming
    Replies: 3
    Last Post: 13th June 2008, 21:05
  5. how to save sequences of text files and sound files
    By nagpalma in forum Qt Programming
    Replies: 8
    Last Post: 3rd July 2007, 00:06

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.