@Test(expected=IllegalArgumentException.class) public void zipWithIllegalParameters() throws IOException { Path dir = Files.createTempDirectory("DIR"); Path dir2 = Files.createTempDirectory("DIR2"); Path file2 = Files.createTempFile(dir2, "TEMP", ".txt"); try { Path zipFile = Paths.get("my.zip"); ZipUtils.create(zipFile, dir, file2); } finally { FileUtils.delete(dir); FileUtils.delete(dir2); } }
public static void create(String zipFilename, final String relativeDir, String... filenames) { Path zipFile = Paths.get(zipFilename); Path relative = Paths.get(relativeDir); Path[] files = new Path[filenames.length]; for (int i=0; i<filenames.length; i++) { files[i] = Paths.get(filenames[i]); } create(zipFile, relative, files); }
ZipUtils { public static void create(String zipFilename, final String relativeDir, String... filenames) { Path zipFile = Paths.get(zipFilename); Path relative = Paths.get(relativeDir); Path[] files = new Path[filenames.length]; for (int i=0; i<filenames.length; i++) { files[i] = Paths.get(filenames[i]); } create(zipFile, relative, files); } }
ZipUtils { public static void create(String zipFilename, final String relativeDir, String... filenames) { Path zipFile = Paths.get(zipFilename); Path relative = Paths.get(relativeDir); Path[] files = new Path[filenames.length]; for (int i=0; i<filenames.length; i++) { files[i] = Paths.get(filenames[i]); } create(zipFile, relative, files); }  }
ZipUtils { public static void create(String zipFilename, final String relativeDir, String... filenames) { Path zipFile = Paths.get(zipFilename); Path relative = Paths.get(relativeDir); Path[] files = new Path[filenames.length]; for (int i=0; i<filenames.length; i++) { files[i] = Paths.get(filenames[i]); } create(zipFile, relative, files); }  static void unzip(String zipFilename, String destDirname); static void unzip(final Path zipFile, final Path destDir); static void create(String zipFilename, final String relativeDir, String... filenames); static void create(final Path zipFile, final Path relativeDir, Path... files); static List<String> list(String zipFilename); static List<String> list(Path zipFile); }
ZipUtils { public static void create(String zipFilename, final String relativeDir, String... filenames) { Path zipFile = Paths.get(zipFilename); Path relative = Paths.get(relativeDir); Path[] files = new Path[filenames.length]; for (int i=0; i<filenames.length; i++) { files[i] = Paths.get(filenames[i]); } create(zipFile, relative, files); }  static void unzip(String zipFilename, String destDirname); static void unzip(final Path zipFile, final Path destDir); static void create(String zipFilename, final String relativeDir, String... filenames); static void create(final Path zipFile, final Path relativeDir, Path... files); static List<String> list(String zipFilename); static List<String> list(Path zipFile);  }