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

Method zip

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

Creates a single-entry zip file. @param input an uncompressed file @param pathWithinArchive the path within the archive @param output the new zip file it will be compressed into

(File input, String pathWithinArchive, File output)

Source from the content-addressed store, hash-verified

153 * @param output the new zip file it will be compressed into
154 */
155 public static void zip(File input, String pathWithinArchive, File output) throws IOException {
156 try (ZipOutputStream zipStream = new ZipOutputStream(new BufferedOutputStream(new FileOutputStream(output)))) {
157 zipStream.setMethod(ZipOutputStream.DEFLATED);
158 zipStream.setLevel(9);
159 zipStream.putNextEntry(new ZipEntry(pathWithinArchive));
160 try (BufferedInputStream inputStream = new BufferedInputStream(new FileInputStream(input))) {
161 copy(inputStream, zipStream);
162 }
163 }
164 }
165
166 /** Copies one stream into the other. */
167 private static void copy(InputStream input, OutputStream output) throws IOException {

Callers

nothing calls this directly

Calls 1

copyMethod · 0.95

Tested by

no test coverage detected