From 63eaeed496fde719d2696cfe86f90700b6ebd3e9 Mon Sep 17 00:00:00 2001 From: modmuss50 Date: Tue, 4 Jul 2023 17:13:26 +0100 Subject: [PATCH] Add comment to ZipReprocessorUtil.appendZipEntry --- .../java/net/fabricmc/loom/util/ZipReprocessorUtil.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/main/java/net/fabricmc/loom/util/ZipReprocessorUtil.java b/src/main/java/net/fabricmc/loom/util/ZipReprocessorUtil.java index 90d486bc2..f1c8c3645 100644 --- a/src/main/java/net/fabricmc/loom/util/ZipReprocessorUtil.java +++ b/src/main/java/net/fabricmc/loom/util/ZipReprocessorUtil.java @@ -29,6 +29,7 @@ import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; +import java.nio.file.Path; import java.nio.file.attribute.FileTime; import java.util.Calendar; import java.util.Comparator; @@ -128,6 +129,11 @@ public static void reprocessZip(File file, boolean reproducibleFileOrder, boolea } } + /** + * Appends an entry to a zip file, persevering the existing entry order and time stamps. + * The new entry is added with a constant time stamp to ensure reproducibility. + * This method should only be used when a reproducible output is required, use {@link ZipUtils#add(Path, String, byte[])} normally. + */ public static void appendZipEntry(File file, String path, byte[] data) throws IOException { try (var zipFile = new ZipFile(file)) { ZipEntry[] entries = zipFile.stream().toArray(ZipEntry[]::new);