使用Android解压缩大文件

时间:2012-01-17 08:28:08

标签: android

我正在尝试使用以下代码解压缩存储在SD卡上的zip文件:

private void UnzipFile(String zipFilePath) {
    try {

        FileInputStream fin = new FileInputStream(new File(zipFilePath));
        ZipInputStream zin = new ZipInputStream(fin);
        ZipEntry ze = null;
        while ((ze = zin.getNextEntry()) != null) {

            FileOutputStream fout = new FileOutputStream(
                    GetFilesDirectory() + ze.getName());
            for (int c = zin.read(); c != -1; c = zin.read()) {
                fout.write(c);
            }

            zin.closeEntry();
            fout.close();

        }
        zin.close();
    } catch (Exception e) {
    }
}

这适用于小于5 MB的文件,但是如果文件大于5 MB,则无法正常工作,还有其他方法吗?

注意:大型Zip文件并不一定意味着需要大量数据

由于

0 个答案:

没有答案