< prev index next >

jaxws/src/jdk.xml.bind/share/classes/com/sun/codemodel/internal/writer/ZipCodeWriter.java

Print this page

        

*** 1,7 **** /* ! * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this --- 1,7 ---- /* ! * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this
*** 47,77 **** */ public ZipCodeWriter( OutputStream target ) { zip = new ZipOutputStream(target); // nullify the close method. filter = new FilterOutputStream(zip){ public void close() {} }; } private final ZipOutputStream zip; private final OutputStream filter; public OutputStream openBinary(JPackage pkg, String fileName) throws IOException { ! String name = fileName; ! if(!pkg.isUnnamed()) name = toDirName(pkg)+name; ! zip.putNextEntry(new ZipEntry(name)); return filter; } /** Converts a package name to the directory name. */ private static String toDirName( JPackage pkg ) { return pkg.name().replace('.','/')+'/'; } public void close() throws IOException { zip.close(); } } --- 47,78 ---- */ public ZipCodeWriter( OutputStream target ) { zip = new ZipOutputStream(target); // nullify the close method. filter = new FilterOutputStream(zip){ + @Override public void close() {} }; } private final ZipOutputStream zip; private final OutputStream filter; + @Override public OutputStream openBinary(JPackage pkg, String fileName) throws IOException { ! final String name = pkg == null || pkg.isUnnamed() ? fileName : toDirName(pkg)+fileName; zip.putNextEntry(new ZipEntry(name)); return filter; } /** Converts a package name to the directory name. */ private static String toDirName( JPackage pkg ) { return pkg.name().replace('.','/')+'/'; } + @Override public void close() throws IOException { zip.close(); } }
< prev index next >