omicronapps / 7-Zip-JBinding-4Android

Android Java wrapper for 7z archiver engine
GNU Lesser General Public License v2.1
122 stars 25 forks source link

Unable to extract gzip, bzip2 files #25

Closed asthagarg2428 closed 2 years ago

asthagarg2428 commented 2 years ago

I'm unable to extract gzip, bzip2 files using 7zip-Jbinding-4Android. The same code is working fine for zip, 7zip, tar but I'm unable to extract gzip, bzip2 file.

While debugging it, I found that the data corresponding to each child item in the archive file(gzip & bzip2) is blank.

inArchive.getStringProperty(i, PropID.IS_FOLDER) as "" inArchive.getStringProperty(i, PropID.PATH) as ""

I understand that I have to extract out tar from gzip first then will get the files from tar but which PropID should I use to fetch the tar from gzip file??

Waiting for your response

@omicronapps

omicronapps commented 2 years ago

gzip and bzip2 only compress a single file. They are not file archivers and contain no information on folders or files. There is no PropID information available for that.

If you need to extract a tar-archive that has been compressed with gzip or bzip2 (file.tar.gz, etc), then you first need to decompress with gzip into the tar-archive. You could then for example use ByteArrayStream to extract the byte array of the tar archive from memory.

asthagarg2428 commented 2 years ago

Yes, done with gzip/bzip2 extraction. @omicronapps I have a sample project which I implemented as POC before actual implementation, hope it will help others to use this library in Android App. I will share the GitHub link to that project with readme doc. You can also update the existing readme doc with the Demo project link.

I hope that will help others, let me know your views