Содержимое архива:
123 0 Kb (0 Kb) сжатие: 11%
1234 0 Kb (0 Kb) сжатие: 11%
file.txt 0 Kb (0 Kb) сжатие: 14%
hello/
hello world/
hello world/.classpath 0 Kb (0 Kb) сжатие: 43%
hello world/.project 0 Kb (0 Kb) сжатие: 51%
hello world/.settings/
hello world/.settings/org.eclipse.jdt.core.prefs 0 Kb (0 Kb) сжатие: 70%
hello world/bin/
hello world/src/
hello/.classpath 0 Kb (0 Kb) сжатие: 43%
hello/.project 0 Kb (0 Kb) сжатие: 51%
hello/.settings/
hello/.settings/org.eclipse.jdt.core.prefs 0 Kb (0 Kb) сжатие: 70%
hello/bin/
hello/bin/module-info.class 0 Kb (0 Kb) сжатие: 21%
hello/src/
hello/src/module-info.java 0 Kb (0 Kb) сжатие: 5%
Содержимое архива прочитано.
Вот решение которые принял Валидатор
public void extractAll(Path outputFolder) throws Exception{
if(!Files.isRegularFile(zipFile)) throw new WrongZipFileException();
if(Files.notExists(outputFolder)){
Files.createDirectories(outputFolder);
}
try(ZipInputStream zipInputStream = new ZipInputStream(Files.newInputStream(zipFile))){
ZipEntry zipEntry;
while ((zipEntry = zipInputStream.getNextEntry())!=null){
Path outPath = outputFolder.resolve(zipEntry.getName());
if(!Files.isDirectory(outPath.getParent())){
Files.createDirectories(outPath.getParent());
}
try(OutputStream outputStream = Files.newOutputStream(outPath)){
copyData(zipInputStream,outputStream);
}
}
zipInputStream.closeEntry();
}
}
Проблемы: при распаковке архива, он не создает папки