ZipUtil { public static void extract(Path zipFile, Path toDir) throws IOException, URISyntaxException { try (FileSystem fs = openZipFs(zipFile)) { extract(fs, toDir); } }  static void extract(Path zipFile, Path toDir); static void extract(FileSystem zipFile, Path toDir); static FileSystem openZipFs(Path path); static FileSystem createZipFs(Path path);  }
@Test public void testExtract() throws Exception { final Path output = folder.getRoot().toPath().resolve("output"); Files.createDirectories(output); Path zipFile = IO.toPath(ZipUtilTest.class.getResource("example.zip").toURI()); ZipUtil.extract(zipFile, output); assertTrue(Files.exists(output.resolve("file3.txt"))); assertTrue(Files.exists(output.resolve("zipfile/file2.txt"))); assertTrue(Files.exists(output.resolve("zipfile/file1.txt"))); assertTrue(Files.exists(output.resolve("zipfile/dir/file4.txt"))); IO.deleteFileOrDirectory(output); Files.createDirectories(output); ZipUtil.extract(zipFile, output); IO.deleteFileOrDirectory(output); Files.createDirectories(output); ZipUtil.extract(zipFile, output); }