Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. how to uncompresses data byte array
Forum Updated to NodeBB v4.3 + New Features

how to uncompresses data byte array

Scheduled Pinned Locked Moved Unsolved General and Desktop
5 Posts 4 Posters 2.7k Views 2 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    ARASHz4
    wrote on last edited by
    #1

    Hi
    I have QByteArray compressed with qCompress
    how can uncompressed this data in other app not used Qt like android app written with java?

    1 Reply Last reply
    0
    • JohanSoloJ Offline
      JohanSoloJ Offline
      JohanSolo
      wrote on last edited by JohanSolo
      #2

      From the doc: "The compressionLevel parameter specifies how much compression should be used. Valid values are between 0 and 9, with 9 corresponding to the greatest compression (i.e. smaller compressed data) at the cost of using a slower algorithm. Smaller values (8, 7, ..., 1) provide successively less compression at slightly faster speeds. The value 0 corresponds to no compression at all. The default value is -1, which specifies zlib's default compression."

      You simply need a way to use zlib in java.

      Edit, for qUncompress, there is a 4 bytes offset compared to zlib's implementation.

      `They did not know it was impossible, so they did it.'
      -- Mark Twain

      A 1 Reply Last reply
      3
      • JohanSoloJ JohanSolo

        From the doc: "The compressionLevel parameter specifies how much compression should be used. Valid values are between 0 and 9, with 9 corresponding to the greatest compression (i.e. smaller compressed data) at the cost of using a slower algorithm. Smaller values (8, 7, ..., 1) provide successively less compression at slightly faster speeds. The value 0 corresponds to no compression at all. The default value is -1, which specifies zlib's default compression."

        You simply need a way to use zlib in java.

        Edit, for qUncompress, there is a 4 bytes offset compared to zlib's implementation.

        A Offline
        A Offline
        ARASHz4
        wrote on last edited by
        #3

        @JohanSolo I write QByteArray compressed to file

        saveFile.write(qCompress(byteArray));
        

        when i open this file with some app support zip format like WinRar, 7Zip but can't open this file

        raven-worxR 1 Reply Last reply
        0
        • A ARASHz4

          @JohanSolo I write QByteArray compressed to file

          saveFile.write(qCompress(byteArray));
          

          when i open this file with some app support zip format like WinRar, 7Zip but can't open this file

          raven-worxR Offline
          raven-worxR Offline
          raven-worx
          Moderators
          wrote on last edited by raven-worx
          #4

          @ARASHz4
          this has been already discussed a hundred times.

          1. qCompress doesn't generate ZIP archive data as you know it from the typical (zip-files)
          2. zlib != zip
          3. Qt has no native support for compressed archive formats

          Use a 3rd party library for this. Like QuaZip (which still should work i guess) or libzip (libzip++)

          --- SUPPORT REQUESTS VIA CHAT WILL BE IGNORED ---
          If you have a question please use the forum so others can benefit from the solution in the future

          VRoninV 1 Reply Last reply
          5
          • raven-worxR raven-worx

            @ARASHz4
            this has been already discussed a hundred times.

            1. qCompress doesn't generate ZIP archive data as you know it from the typical (zip-files)
            2. zlib != zip
            3. Qt has no native support for compressed archive formats

            Use a 3rd party library for this. Like QuaZip (which still should work i guess) or libzip (libzip++)

            VRoninV Offline
            VRoninV Offline
            VRonin
            wrote on last edited by
            #5

            @raven-worx said in how to uncompresses data byte array:

            Use a 3rd party library for this. Like QuaZip (which still should work i guess) or libzip (libzip++)

            I'd also mention KArchive which handles .tar, .gz, .zip, .7z

            Both QuaZip and KArchive are wrappers around other libraries so you are free to use zlib or bzip2 directly

            "La mort n'est rien, mais vivre vaincu et sans gloire, c'est mourir tous les jours"
            ~Napoleon Bonaparte

            On a crusade to banish setIndexWidget() from the holy land of Qt

            1 Reply Last reply
            6

            • Login

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • Users
            • Groups
            • Search
            • Get Qt Extensions
            • Unsolved