MCPcopy Create free account
hub / github.com/diffplug/goomph / unzip

Method unzip

src/main/java/com/diffplug/gradle/ZipMisc.java:177–192  ·  view source on GitHub ↗

Unzips a directory to a folder. @param input a zip file @param destinationDir where the zip will be extracted to

(File input, File destinationDir)

Source from the content-addressed store, hash-verified

175 * @param destinationDir where the zip will be extracted to
176 */
177 public static void unzip(File input, File destinationDir) throws IOException {
178 try (ZipInputStream zipInput = new ZipInputStream(new BufferedInputStream(new FileInputStream(input)))) {
179 ZipEntry entry;
180 while ((entry = zipInput.getNextEntry()) != null) {
181 File dest = new File(destinationDir, entry.getName());
182 if (entry.isDirectory()) {
183 FileMisc.mkdirs(dest);
184 } else {
185 FileMisc.mkdirs(dest.getParentFile());
186 try (OutputStream output = new BufferedOutputStream(new FileOutputStream(dest))) {
187 copy(zipInput, output);
188 }
189 }
190 }
191 }
192 }
193}

Callers 2

installMethod · 0.95
installMethod · 0.95

Calls 2

mkdirsMethod · 0.95
copyMethod · 0.95

Tested by

no test coverage detected