Search code examples
androidzip4j

unzip is too slow in java/android zip4j


I'm using Zip4j library in android. I'm unzipping a file with password, it works very slow.

Here is how I do it:

public boolean unzipFile(){
  String path= FileController.getInstance().getAbsolutePath();

  String source = path+"/program.zip";
  String destination = path+"/cache_content/";
  String password = "123456789";

  long millis=Calendar.getInstance().getTimeInMillis();

  try {
    ZipFile zipFile = new ZipFile(source);
    if (zipFile.isEncrypted()) {
       zipFile.setPassword(password);
    }

    zipFile.extractAll(destination);
    Log.i("time_zipper",(Calendar.getInstance().getTimeInMillis()-millis)/1000+"");
    return true;
  } catch (ZipException e) {
    e.printStackTrace();
    return false;
  }
}

It's unzipping 8Mb file in 88 seconds, I want to increase the unzipping speed.


Solution

  • I've disabled the password and it worked in 3 seconds.