|
|
|
|
@ -365,11 +365,6 @@ public class JarFile extends java.util.jar.JarFile implements Iterable<JarEntryD
@@ -365,11 +365,6 @@ public class JarFile extends java.util.jar.JarFile implements Iterable<JarEntryD
|
|
|
|
|
throw new IllegalArgumentException("ZipEntry must be contained in this file"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public String getName() { |
|
|
|
|
return this.name; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public int size() { |
|
|
|
|
return (int) this.size; |
|
|
|
|
@ -380,11 +375,6 @@ public class JarFile extends java.util.jar.JarFile implements Iterable<JarEntryD
@@ -380,11 +375,6 @@ public class JarFile extends java.util.jar.JarFile implements Iterable<JarEntryD
|
|
|
|
|
this.rootFile.close(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public String toString() { |
|
|
|
|
return getName(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Return a URL that can be used to access this JAR file. NOTE: the specified URL |
|
|
|
|
* cannot be serialized and or cloned. |
|
|
|
|
@ -393,7 +383,26 @@ public class JarFile extends java.util.jar.JarFile implements Iterable<JarEntryD
@@ -393,7 +383,26 @@ public class JarFile extends java.util.jar.JarFile implements Iterable<JarEntryD
|
|
|
|
|
*/ |
|
|
|
|
public URL getUrl() throws MalformedURLException { |
|
|
|
|
Handler handler = new Handler(this); |
|
|
|
|
return new URL("jar", "", -1, "file:" + getName() + "!/", handler); |
|
|
|
|
String file = "file:" + getName(PathForm.SYSTEM_INDEPENDENT) + "!/"; |
|
|
|
|
return new URL("jar", "", -1, file, handler); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public String toString() { |
|
|
|
|
return getName(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public String getName() { |
|
|
|
|
return getName(PathForm.SYSTEM_DEPENDENT); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private String getName(PathForm pathForm) { |
|
|
|
|
if (pathForm == PathForm.SYSTEM_INDEPENDENT && File.separatorChar != '/') { |
|
|
|
|
return this.name.replace(File.separatorChar, '/'); |
|
|
|
|
} |
|
|
|
|
return this.name; |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
@ -420,4 +429,20 @@ public class JarFile extends java.util.jar.JarFile implements Iterable<JarEntryD
@@ -420,4 +429,20 @@ public class JarFile extends java.util.jar.JarFile implements Iterable<JarEntryD
|
|
|
|
|
// Ignore
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Different forms that paths can be returned. |
|
|
|
|
*/ |
|
|
|
|
private static enum PathForm { |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Use system dependent paths (i.e. include backslashes on Windows) |
|
|
|
|
*/ |
|
|
|
|
SYSTEM_DEPENDENT, |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Use system independent paths (i.e. replace backslashes on Windows) |
|
|
|
|
*/ |
|
|
|
|
SYSTEM_INDEPENDENT |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|