<html><head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body>
<p>I think that's a fine idea Eirik. Definitely has its use cases
like you mention.<br>
</p>
<p>Some jarsigner operations would also benefit from this. I've
created <a class="moz-txt-link-freetext" href="https://bugs.openjdk.org/browse/JDK-8303960">https://bugs.openjdk.org/browse/JDK-8303960</a> to track it.</p>
<p>regards,<br>
Sean.</p>
<p></p>
<div class="moz-cite-prefix">On 31/01/2023 23:41, Lance Andersen
wrote:<br>
</div>
<blockquote type="cite" cite="mid:8E935EC2-9958-4043-863F-13F27B3D50F9@oracle.com">
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="moz-txt-link-freetext" moz-do-not-send="true">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="moz-txt-link-freetext" moz-do-not-send="true">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:part1.KkdcAe2j.GtcsRARk@oracle.com" 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="moz-txt-link-freetext" moz-do-not-send="true">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="">
</blockquote>
</body>
</html>