<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class="">
I have not add a chance to look or think about this yet but wanted to know I will<br class="">
<div><br class="">
<blockquote type="cite" class="">
<div class="">On Jan 19, 2023, at 2:03 PM, Eirik Bjørsnøs <<a href="mailto:eirbjo@gmail.com" class="">eirbjo@gmail.com</a>> wrote:</div>
<br class="Apple-interchange-newline">
<div class="">
<div class="">Hi,<br class="">
<br class="">
A common use case for java.util.zip in build tools involves copying<br class="">
entries from a ZipFile or ZipInputStream to a ZipOutputStream without<br class="">
actually modifying the data.<br class="">
<br class="">
Example use cases include minification (make a JAR with only the<br class="">
reachable classes) and merging (combine several JAR files into one<br class="">
uberjar).<br class="">
<br class="">
Inflating an entry just to immediately deflate it again with no<br class="">
modifications seems wasteful.<br class="">
<br class="">
The following draft PR introduces<br class="">
ZipFileInflaterInputStream.transferTo which copies compressed ZipFile<br class="">
data directly to ZipOutputStream's raw data stream:<br class="">
<br class="">
<a href="https://github.com/openjdk/jdk/pull/12099" class="">https://github.com/openjdk/jdk/pull/12099</a><br class="">
<br class="">
I'm typically seeing a 15 X improvement when copying xalan.jar to a<br class="">
ZipOutputStream backed by a buffered FileOutputStream, or 22 X when<br class="">
backed by OutputStream.nullOutputStream().<br class="">
<br class="">
The PR current stays completely on the happy path and is mostly there<br class="">
to experiment and to show the potential performance benefits. There is<br class="">
currently not much focus on validation or correctness. Copying files<br class="">
to a different path is not supported, neither is copying from a<br class="">
ZipInputStream.<br class="">
<br class="">
I initially considered creating new methods for raw copies, but opted<br class="">
to minimize changes to public APIs, that's why I'm overriding<br class="">
transferTo.<br class="">
<br class="">
The PR is not intended for regular review, but as a starting point for<br class="">
a discussion about the usefulness of the idea and the general solution<br class="">
space. If we can reach consensus on such a discussion, I'll probably<br class="">
be happy to work on a more complete PR.<br class="">
<br class="">
Cheers,<br class="">
Eirik.<br class="">
</div>
</div>
</blockquote>
</div>
<br class="">
<div class=""><span><img apple-inline="yes" id="9047F978-33F5-44E8-8903-B4730C4281D8" src="cid:E1C4E2F0-ECD0-4C9D-ADB4-B16CA7BCB7FC@home" class=""></span>
<div dir="auto" style="font-family: Helvetica; font-size: 18px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; text-decoration: none; caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0); word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class="">
<div><br class="Apple-interchange-newline">
<br class="Apple-interchange-newline">
<br class="Apple-interchange-newline">
<br class="">
<br class="">
<br class="">
Lance Andersen | Principal Member of Technical Staff | +1.781.442.2037</div>
<div>Oracle Java Engineering <br class="">
1 Network Drive <br class="">
Burlington, MA 01803<br class="">
<a href="mailto:Lance.Andersen@oracle.com" class="">Lance.Andersen@oracle.com</a></div>
</div>
<br class="Apple-interchange-newline" style="font-family: Helvetica; font-size: 18px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; text-decoration: none; caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0);">
<br class="Apple-interchange-newline" style="font-family: Helvetica; font-size: 18px; font-style: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; text-decoration: none; caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0);">
</div>
<br class="">
</body>
</html>