public Jar openJar() throws IOException { if (entryName == null) { return null; } else { // Bug 62976 // Jar files containing tags are typically opened during initial // compilation and then closed when compilation is complete. The // reference counting wrapper is used because, when background // compilation is enabled, the Jar will need to be accessed (to // check for modifications) after it has been closed at the end // of the compilation stage. // Using a reference counted Jar enables the Jar to be re-opened, // used and then closed again rather than triggering an ISE. return new ReferenceCountedJar(url); } }
public ReferenceCountedJar(URL url) throws IOException { this.url = url; open(); }
@Override public String getEntryName() { try (ReferenceCountedJar jar = open()) { return jar.wrappedJar.getEntryName(); } catch (IOException ioe) { throw new IllegalStateException(ioe); } }
@Override public InputStream getInputStream(String name) throws IOException { try (ReferenceCountedJar jar = open()) { return jar.wrappedJar.getInputStream(name); } }
@Override public boolean exists(String name) throws IOException { try (ReferenceCountedJar jar = open()) { return jar.wrappedJar.exists(name); } }
@Override public String getURL(String entry) { try (ReferenceCountedJar jar = open()) { return jar.wrappedJar.getURL(entry); } catch (IOException ioe) { throw new IllegalStateException(ioe); } }
@Override public long getLastModified(String name) throws IOException { try (ReferenceCountedJar jar = open()) { return jar.wrappedJar.getLastModified(name); } }
@Override public void nextEntry() { try (ReferenceCountedJar jar = open()) { jar.wrappedJar.nextEntry(); } catch (IOException ioe) { throw new IllegalStateException(ioe); } }
@Override public void reset() throws IOException { try (ReferenceCountedJar jar = open()) { jar.wrappedJar.reset(); } } }
@Override public InputStream getEntryInputStream() throws IOException { try (ReferenceCountedJar jar = open()) { return jar.wrappedJar.getEntryInputStream(); } }
@Override public Manifest getManifest() throws IOException { try (ReferenceCountedJar jar = open()) { return jar.wrappedJar.getManifest(); } }