Create a new Jar instance for the given URL. @param url the URL of the JAR file @return the new Jar instance @throws IOException if an I/O error occurs
(URL url)
| 43 | * @throws IOException if an I/O error occurs |
| 44 | */ |
| 45 | public static Jar newInstance(URL url) throws IOException { |
| 46 | String urlString = url.toString(); |
| 47 | if (urlString.startsWith("jar:file:")) { |
| 48 | if (urlString.endsWith("!/")) { |
| 49 | return new JarFileUrlJar(url, true); |
| 50 | } else { |
| 51 | return new JarFileUrlNestedJar(url); |
| 52 | } |
| 53 | } else if (urlString.startsWith("war:file:")) { |
| 54 | URL jarUrl = UriUtil.warToJar(url); |
| 55 | return new JarFileUrlNestedJar(jarUrl); |
| 56 | } else if (urlString.startsWith("file:")) { |
| 57 | return new JarFileUrlJar(url, false); |
| 58 | } else { |
| 59 | return new UrlJar(url); |
| 60 | } |
| 61 | } |
| 62 | |
| 63 | |
| 64 | /** |