To unzip the zip file, I used the classes from the java.util.zip * package, referring to this , and it works correctly, however, to unzip a 40 MB file for 59 seconds. When I tried the same zip file in the iPhone project (we are developing an application for both platforms - Android and iPone and which have the ability to unzip the zip file and save the unpacked content to SDCARD-Android or the document directory - iPhone), it takes only 14 seconds. The iphone application uses ziparchive .
So my question is:
1. Compared to the experiment, it clears that unpacking and writing the file to the SDCARD in Java consumes more time than the iPhone application, so I decided to use the unlock at the C / C ++ level and the file write operation using the NDK. Is it correct?
2. I searched google, stackoverflow, and some suggested using minizip , but there is not enough help on how to use minizip in android. Is anyboday an attempt to minizip for android?
3. I also tried developing the NDK for libz to achieve my goal, since Libz has been added to the NDK but is not getting how to use it. Has anyone tried libz in the NDK?
4. Is there any other Framework in Java or C / C ++ that decompresses a large ZIP file and writes them to SDCARD in less time?
Please help me.
Here is my Unzip code for Java:
public String unzip() { String result; try { FileInputStream fin = new FileInputStream(this.filePath); ZipInputStream zin = new ZipInputStream(fin); ZipEntry ze = null; while ((ze = zin.getNextEntry()) != null) { Log.v("Unzip", "Unzipping " + ze.getName()); if (ze.isDirectory()) { _dirChecker(ze.getName()); } else { // Read 16 k at a time byte[] buffer = new byte[16*1024]; int read; FileOutputStream fout = new FileOutputStream(this.location+ "/" + ze.getName()); while ((read = zin.read(buffer)) != -1) { fout.write(buffer, 0, read); } zin.closeEntry(); fout.close(); } } zin.close(); result = "success"; } catch (Exception e) { Log.e("unzip", "unzip", e); result = "failure"; } return result; }
sachin003
source share