java 解压慢,如何在Java / Android中加快解压缩时间?

在android上解压缩文件似乎非常缓慢。起初我以为这只是模拟器,但在手机上看起来却是一样的。我尝试了不同的压缩级别,最终跌落到存储模式,但仍然需要一段时间。

无论如何,一定有原因!还有其他人有这个问题吗?我的解压缩方法如下所示:

public void unzip()

{

try{

FileInputStream fin = new FileInputStream(zipFile);

ZipInputStream zin = new ZipInputStream(fin);

File rootfolder = new File(directory);

rootfolder.mkdirs();

ZipEntry ze = null;

while ((ze = zin.getNextEntry())!=null){

if(ze.isDirectory()){

dirChecker(ze.getName());

}

else{

FileOutputStream fout = new FileOutputStream(directory+ze.getName());

for(int c = zin.read();c!=-1;c=zin.read()){

fout.write(c);

}

//Debug.out("Closing streams");

zin.closeEntry();

fout.close();

}

}

zin.close();

}

catch(Exception e){

//Debug.out("Error trying to unzip file " + zipFile);

}

}

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值