--- old/src/jdk.zipfs/share/classes/jdk/nio/zipfs/ZipFileSystem.java 2018-09-18 17:11:25.450452026 -0700 +++ new/src/jdk.zipfs/share/classes/jdk/nio/zipfs/ZipFileSystem.java 2018-09-18 17:11:25.077418118 -0700 @@ -612,6 +612,10 @@ } } + private int getCompressMethod(FileAttribute... attrs) { + return defaultMethod; + } + // Returns a Writable/ReadByteChannel for now. Might consdier to use // newFileChannel() instead, which dump the entry data into a regular // file on the default file system and create a FileChannel on top of @@ -653,7 +657,7 @@ throw new NoSuchFileException(getString(path)); checkParents(path); return new EntryOutputChannel( - new Entry(path, Entry.NEW, false, defaultMethod)); + new Entry(path, Entry.NEW, false, getCompressMethod(attrs))); } finally { endRead(); @@ -721,7 +725,7 @@ final Entry u = isFCH ? e : new Entry(path, tmpfile, Entry.FILECH); if (forWrite) { u.flag = FLAG_DATADESCR; - u.method = METHOD_DEFLATED; + u.method = getCompressMethod(attrs); } // is there a better way to hook into the FileChannel's close method? return new FileChannel() { @@ -1407,7 +1411,7 @@ return; isClosed = true; e.size = e.csize = written; - e.size = crc.getValue(); + e.crc = crc.getValue(); } }