1

我在 android 中使用Zip4j库。我正在使用密码解压缩文件,它的工作速度非常慢。

这是我的做法:

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;
  }
}

它在 88 秒内解压 8Mb 文件,我想提高解压速度。

4

1 回答 1

-1

我禁用了密码,它在 3 秒内起作用。

于 2015-09-11T13:55:25.297 回答