--- a/src/jdk.zipfs/share/classes/jdk/nio/zipfs/ZipFileSystem.java Tue Sep 18 22:46:35 2018 +0200
+++ b/src/jdk.zipfs/share/classes/jdk/nio/zipfs/ZipFileSystem.java Tue Sep 18 19:44:27 2018 -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();
}
}