Как разархивировать zip архив?

Рейтинг: 2Ответов: 1Опубликовано: 18.02.2015

Добрый вечер.

Подскажите, кто знает, как правильно распаковать архив. У меня извлекает из трех файлов только один. Где у меня ошибка? Спасибо!

public void decompress(String zipFile) throws IOException {
        try {
            ZipInputStream zin = new ZipInputStream(new FileInputStream(zipFile));
            ZipEntry ze = null;
            while ((ze = zin.getNextEntry()) != null) {
                File unzipFile = new File(directory,ze.getName());
                String path = unzipFile.getAbsolutePath();
                FileOutputStream fout = new FileOutputStream(path, false);
                try {
                    for (int c = zin.read(); c != -1; c = zin.read()) {
                        fout.write(c);
                    }
                    zin.closeEntry();
                }
                finally {
                    fout.close();
                }
            }
                zin.close();
        }
        catch (Exception e) {
        }   }

Ответы

Ответов пока нет.