Unsolved how to uncompresses data byte array
-
Hi
I have QByteArray compressed with qCompress
how can uncompressed this data in other app not used Qt like android app written with java? -
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.
-
@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
-
@ARASHz4
this has been already discussed a hundred times.- qCompress doesn't generate ZIP archive data as you know it from the typical (zip-files)
- zlib != zip
- 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++)
-
@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