1000字范文,内容丰富有趣,学习的好帮手!
1000字范文 > android zip解压 速度 如何在Java / Android中加快解压缩时间?

android zip解压 速度 如何在Java / Android中加快解压缩时间?

时间:2019-11-19 14:26:35

相关推荐

android zip解压 速度 如何在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);

}

}

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。