diff options
author | 2015-04-02 17:19:29 +0000 | |
---|---|---|
committer | 2015-04-03 20:36:33 +0000 | |
commit | 4544389bcf149b63579c9ebb59bd0dabe1e0b381 (patch) | |
tree | 5d99202cbed590b8cf5cbfd605bc1e997b189c1c /src/java_tools/singlejar/java/com/google/devtools | |
parent | fe5754f00dab5c10437dcdf4cb50cc2ac224a42a (diff) |
Adds ZipCombiner#addZip(InputStream).
--
MOS_MIGRATED_REVID=90172709
Diffstat (limited to 'src/java_tools/singlejar/java/com/google/devtools')
-rw-r--r-- | src/java_tools/singlejar/java/com/google/devtools/build/singlejar/ZipCombiner.java | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/src/java_tools/singlejar/java/com/google/devtools/build/singlejar/ZipCombiner.java b/src/java_tools/singlejar/java/com/google/devtools/build/singlejar/ZipCombiner.java index 75dacb92ef..e64d4b82c5 100644 --- a/src/java_tools/singlejar/java/com/google/devtools/build/singlejar/ZipCombiner.java +++ b/src/java_tools/singlejar/java/com/google/devtools/build/singlejar/ZipCombiner.java @@ -32,6 +32,8 @@ import java.io.File; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; +import java.nio.file.Files; +import java.nio.file.StandardCopyOption; import java.util.Date; import java.util.HashMap; import java.util.Map; @@ -416,6 +418,22 @@ public class ZipCombiner implements AutoCloseable { * Adds the contents of a ZIP file to the combined ZIP file using the specified * {@link ZipEntryFilter} to determine the appropriate action for each file. * + * @param in the InputStream of the ZIP file to add to the combined ZIP file + * @throws IOException if there is an error reading the ZIP file or writing entries to the + * combined ZIP file + */ + @Deprecated + public void addZip(InputStream in) throws IOException { + File file = Files.createTempFile(null, null).toFile(); + Files.copy(in, file.toPath(), StandardCopyOption.REPLACE_EXISTING); + addZip(file); + file.deleteOnExit(); + } + + /** + * Adds the contents of a ZIP file to the combined ZIP file using the specified + * {@link ZipEntryFilter} to determine the appropriate action for each file. + * * @param zipFile the ZIP file to add to the combined ZIP file * @throws IOException if there is an error reading the ZIP file or writing entries to the * combined ZIP file |