@Override public void reset() throws IOException { closeInner(); jarInputStream = createJarInputStream(); } }
@Override public void close() { closeStream(); if (warFile != null) { try { warFile.close(); } catch (IOException e) { // Ignore } } }
public static Jar newInstance(URL url) throws IOException { String urlString = url.toString(); if (urlString.startsWith("jar:file:")) { if (urlString.endsWith("!/")) { return new JarFileUrlJar(url, true); } else { return new JarFileUrlNestedJar(url); } } else if (urlString.startsWith("war:file:")) { URL jarUrl = UriUtil.warToJar(url); return new JarFileUrlNestedJar(jarUrl); } else if (urlString.startsWith("file:")) { return new JarFileUrlJar(url, false); } else { return new UrlJar(url); } }
@Override public boolean entryExists(String name) throws IOException { reset(); JarEntry entry = jarInputStream.getNextJarEntry(); while (entry != null) { if (name.equals(entry.getName())) { break; } entry = jarInputStream.getNextJarEntry(); } return entry != null; }
@Override public InputStream getEntryInputStream() throws IOException { if (jarInputStream == null) { createJarInputStream(); } return jarInputStream; }
@Override public void close() { closeInner(); if (warFile != null) { try { warFile.close(); } catch (IOException e) { // Ignore } } }
@Override public String getURL(String entry) { StringBuilder result = new StringBuilder("jar:"); result.append(getJarFileURL().toExternalForm()); result.append("!/"); result.append(entry); return result.toString(); }
public static Jar newInstance(URL url) throws IOException { String urlString = url.toString(); if (urlString.startsWith("jar:file:")) { if (urlString.endsWith("!/")) { return new JarFileUrlJar(url, true); } else { return new JarFileUrlNestedJar(url); } } else if (urlString.startsWith("war:file:")) { URL jarUrl = UriUtil.warToJar(url); return new JarFileUrlNestedJar(jarUrl); } else if (urlString.startsWith("file:")) { return new JarFileUrlJar(url, false); } else { return new UrlJar(url); } }
@Override public boolean entryExists(String name) throws IOException { reset(); JarEntry entry = jarInputStream.getNextJarEntry(); while (entry != null) { if (name.equals(entry.getName())) { break; } entry = jarInputStream.getNextJarEntry(); } return entry != null; }
@Override public InputStream getEntryInputStream() throws IOException { if (jarInputStream == null) { jarInputStream = createJarInputStream(); } return jarInputStream; }
@Override public void close() { closeInner(); if (warFile != null) { try { warFile.close(); } catch (IOException e) { // Ignore } } }
@Override public String getURL(String entry) { StringBuilder result = new StringBuilder("jar:"); result.append(getJarFileURL().toExternalForm()); result.append("!/"); result.append(entry); return result.toString(); }
public static Jar newInstance(URL url) throws IOException { String jarUrl = url.toString(); if (jarUrl.startsWith("jar:file:")) { if (jarUrl.endsWith("!/")) { return new JarFileUrlJar(url, true); } else { return new JarFileUrlNestedJar(url); } } else if (jarUrl.startsWith("file:")) { return new JarFileUrlJar(url, false); } else { return new UrlJar(url); } }
@Override public void reset() throws IOException { closeInner(); jarInputStream = createJarInputStream(); } }
@Override public InputStream getInputStream(String name) throws IOException { reset(); JarEntry entry = jarInputStream.getNextJarEntry(); while (entry != null) { if (name.equals(entry.getName())) { break; } entry = jarInputStream.getNextJarEntry(); } if (entry == null) { return null; } else { return jarInputStream; } }
@Override public void nextEntry() { if (jarInputStream == null) { try { jarInputStream = createJarInputStream(); } catch (IOException e) { entry = null; return; } } try { entry = jarInputStream.getNextJarEntry(); } catch (IOException ioe) { entry = null; } }
@Override public void close() { closeStream(); if (warFile != null) { try { warFile.close(); } catch (IOException e) { // Ignore } } }
public static Jar newInstance(URL url) throws IOException { String jarUrl = url.toString(); if (jarUrl.startsWith("jar:file:")) { if (jarUrl.endsWith("!/")) { return new JarFileUrlJar(url, true); } else { return new JarFileUrlNestedJar(url); } } else if (jarUrl.startsWith("file:")) { return new JarFileUrlJar(url, false); } else { return new UrlJar(url); } }
@Override public InputStream getInputStream(String name) throws IOException { reset(); JarEntry entry = jarInputStream.getNextJarEntry(); while (entry != null) { if (name.equals(entry.getName())) { break; } entry = jarInputStream.getNextJarEntry(); } if (entry == null) { return null; } else { return jarInputStream; } }
@Override public void nextEntry() { if (jarInputStream == null) { try { jarInputStream = createJarInputStream(); } catch (IOException e) { entry = null; return; } } try { entry = jarInputStream.getNextJarEntry(); } catch (IOException ioe) { entry = null; } }