src/share/classes/com/sun/java/util/jar/pack/Utils.java

Print this page
rev 3516 : 7021582: convert jar/zip code and tests to use try-with-resources
Reviewed-by: XXX

*** 266,287 **** } static void copyJarFile(JarInputStream in, OutputStream out) throws IOException { // 4947205 : Peformance is slow when using pack-effort=0 out = new BufferedOutputStream(out); out = new NonCloser(out); // protect from JarOutputStream.close() ! JarOutputStream jout = new JarOutputStream(out); copyJarFile(in, jout); ! jout.close(); } static void copyJarFile(JarFile in, OutputStream out) throws IOException { // 4947205 : Peformance is slow when using pack-effort=0 out = new BufferedOutputStream(out); out = new NonCloser(out); // protect from JarOutputStream.close() ! JarOutputStream jout = new JarOutputStream(out); copyJarFile(in, jout); ! jout.close(); } // Wrapper to prevent closing of client-supplied stream. static private class NonCloser extends FilterOutputStream { NonCloser(OutputStream out) { super(out); } --- 266,287 ---- } static void copyJarFile(JarInputStream in, OutputStream out) throws IOException { // 4947205 : Peformance is slow when using pack-effort=0 out = new BufferedOutputStream(out); out = new NonCloser(out); // protect from JarOutputStream.close() ! try (JarOutputStream jout = new JarOutputStream(out)) { copyJarFile(in, jout); ! } } static void copyJarFile(JarFile in, OutputStream out) throws IOException { // 4947205 : Peformance is slow when using pack-effort=0 out = new BufferedOutputStream(out); out = new NonCloser(out); // protect from JarOutputStream.close() ! try (JarOutputStream jout = new JarOutputStream(out)) { copyJarFile(in, jout); ! } } // Wrapper to prevent closing of client-supplied stream. static private class NonCloser extends FilterOutputStream { NonCloser(OutputStream out) { super(out); }