<html><head><meta http-equiv="Content-Type" content="text/html; charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class="">Hi Christoph<br class=""><div><br class=""><blockquote type="cite" class=""><div class="">On Feb 17, 2020, at 11:26 AM, Langer, Christoph <<a href="mailto:christoph.langer@sap.com" class="">christoph.langer@sap.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div class="">Hi Jaikiran, Lance,<br class=""><br class="">I'm a bit late to the game. It occurred to me, whether we could maybe use the streams API to process the inodes. Something like this:<br class=""><br class="">diff --git a/src/jdk.zipfs/share/classes/jdk/nio/zipfs/ZipFileSystem.java b/src/jdk.zipfs/share/classes/jdk/nio/zipfs/ZipFileSystem.java<br class="">--- a/src/jdk.zipfs/share/classes/jdk/nio/zipfs/ZipFileSystem.java<br class="">+++ b/src/jdk.zipfs/share/classes/jdk/nio/zipfs/ZipFileSystem.java<br class="">@@ -56,6 +56,7 @@<br class=""> import java.util.jar.Attributes;<br class=""> import java.util.jar.Manifest;<br class=""> import java.util.regex.Pattern;<br class="">+import java.util.stream.Stream;<br class=""> import java.util.zip.CRC32;<br class=""> import java.util.zip.Deflater;<br class=""> import java.util.zip.DeflaterOutputStream;<br class="">@@ -1730,7 +1731,17 @@<br class=""> Entry e;<br class=""><br class=""> // write loc<br class="">- for (IndexNode inode : inodes.values()) {<br class="">+<br class="">+ // write the manifest inode (if any) first in the loc so that the<br class="">+ // java.util.jar.JarInputStream can find it, since it expects it to be<br class="">+ // the first or second entry in the jar<br class="">+ final IndexNode manifestInode = getInode(getBytes("/META-INF/MANIFEST.MF"));<br class="">+ final Stream<IndexNode> inodeStream = manifestInode == null ?<br class="">+ inodes.values().stream() :<br class="">+ Stream.concat(Stream.of(manifestInode),<br class="">+ inodes.values().stream().filter(node -> !manifestInode.equals(node)));<br class="">+<br class="">+ for (IndexNode inode : (Iterable<IndexNode>)inodeStream::iterator) {<br class=""> if (inode instanceof Entry) { // an updated inode<br class=""> e = (Entry)inode;<br class=""> try {<br class=""><br class="">What do you think?</div></div></blockquote><div><br class=""></div>I am not sure the use of Streams will help us too much here as in your proposed example I believe you would end out traversing the entire list of IndexNodes twice in the case of a Manifest existing. Once when building the Stream and the other when you are walking through the IndexNodes to write them out.</div><div><br class=""></div><div>Best</div><div>Lance<br class=""><blockquote type="cite" class=""><div class=""><div class=""><br class="">I didn't have time yet to have a closer look to the testcase. Will do tomorrow.<br class=""><br class="">Cheers<br class="">Christoph<br class=""><br class=""><blockquote type="cite" class="">-----Original Message-----<br class="">From: nio-dev <<a href="mailto:nio-dev-bounces@openjdk.java.net" class="">nio-dev-bounces@openjdk.java.net</a>> On Behalf Of Jaikiran<br class="">Pai<br class="">Sent: Montag, 17. Februar 2020 03:56<br class="">To: Lance Andersen <<a href="mailto:lance.andersen@oracle.com" class="">lance.andersen@oracle.com</a>><br class="">Cc: <a href="mailto:nio-dev@openjdk.java.net" class="">nio-dev@openjdk.java.net</a>; <a href="mailto:core-libs-dev@openjdk.java.net" class="">core-libs-dev@openjdk.java.net</a><br class="">Subject: Re: RFR: 8211917: (zipfs) Creating or updating a JAR file system<br class="">should put the MANIFEST.MF at the start<br class=""><br class="">Hello Lance,<br class=""><br class="">On 15/02/20 2:27 am, Lance Andersen wrote:<br class=""><blockquote type="cite" class="">Hi Jaikiran,<br class=""><br class="">I think the changes to ZipFileSystem are OK.<br class=""><br class="">The test overall is good. I am going to streamline it a bit and<br class="">remove the long lines (we try to keep lines to around 80 characters).<br class=""><br class=""></blockquote>I'll keep that in mind for future changes. Thank you for taking care of<br class="">this.<br class=""><br class="">-Jaikiran<br class=""></blockquote><br class=""></div></div></blockquote></div><br class=""><div class="">
<div class=""><span class="Apple-style-span" style="border-collapse: separate; border-spacing: 0px; "><span class="Apple-style-span" style="color: rgb(102, 102, 102); font-family: Verdana, Arial, Helvetica, sans-serif; font-size: small; "><a href="http://oracle.com/us/design/oracle-email-sig-198324.gif" class=""><span><img apple-inline="yes" id="28634A56-C2BF-4919-B568-0ECAF30DB503" src="cid:E1C4E2F0-ECD0-4C9D-ADB4-B16CA7BCB7FC@home" class=""></span></a><div style="color: rgb(0, 0, 0); font-family: Helvetica; font-size: medium; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; " class=""><a href="http://oracle.com/us/design/oracle-email-sig-198324.gif" class=""><span class="Apple-style-span" style="border-collapse: separate; border-spacing: 0px; "><span class="Apple-style-span" style="color: rgb(102, 102, 102); font-family: Verdana, Arial, Helvetica, sans-serif; font-size: small; "></span></span></a><a href="http://oracle.com/us/design/oracle-email-sig-198324.gif" class=""><span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; border-spacing: 0px; -webkit-text-decorations-in-effect: none; "><span class="Apple-style-span" style="color: rgb(102, 102, 102); font-family: Verdana, Arial, Helvetica, sans-serif; font-size: small; "><span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; border-spacing: 0px; -webkit-text-decorations-in-effect: none; "></span></span></span></a><a href="http://oracle.com/us/design/oracle-email-sig-198324.gif" class=""><br class=""></a><span style="color: rgb(102, 102, 102); font-family: Verdana, Arial, Helvetica, sans-serif; font-size: small; " class="">Lance Andersen| Principal Member of Technical Staff | +1.781.442.2037</span><br style="color: rgb(102, 102, 102); font-family: Verdana, Arial, Helvetica, sans-serif; font-size: small; " class=""><font color="#FF0000" style="font-family: Verdana, Arial, Helvetica, sans-serif; font-size: small; " class="">Oracle</font><span style="color: rgb(102, 102, 102); font-family: Verdana, Arial, Helvetica, sans-serif; font-size: small; " class=""> Java Engineering </span><br style="color: rgb(102, 102, 102); font-family: Verdana, Arial, Helvetica, sans-serif; font-size: small; " class=""><span style="color: rgb(102, 102, 102); font-family: Verdana, Arial, Helvetica, sans-serif; font-size: small; " class="">1 Network Drive </span><br style="color: rgb(102, 102, 102); font-family: Verdana, Arial, Helvetica, sans-serif; font-size: small; " class=""><span style="color: rgb(102, 102, 102); font-family: Verdana, Arial, Helvetica, sans-serif; font-size: small; " class="">Burlington, MA 01803</span><br style="color: rgb(102, 102, 102); font-family: Verdana, Arial, Helvetica, sans-serif; font-size: small; " class=""><a href="mailto:Lance.Andersen@oracle.com" style="font-family: Verdana, Arial, Helvetica, sans-serif; font-size: small; " class="">Lance.Andersen@oracle.com</a></div><div style="color: rgb(0, 0, 0); font-family: Helvetica; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; " class=""><br class=""></div><br class="Apple-interchange-newline">
</span></span></div>
</div><br class=""></body></html>