|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--java.net.URLConnection | +--java.net.JarURLConnection
Untamed: A URL Connection to a Java ARchive (JAR) file or an entry in a JAR file.
The syntax of a JAR URL is:
jar:<url>!/{entry}
for example:
jar:http://www.foo.com/bar/baz.jar!/COM/foo/Quux.class
Jar URLs should be used to refer to a JAR file or entries in
a JAR file. The example above is a JAR URL which refers to a JAR
entry. If the entry name is omitted, the URL refers to the whole
JAR file:
jar:http://www.foo.com/bar/baz.jar!/
Users should cast the generic URLConnection to a JarURLConnection when they know that the URL they created is a JAR URL, and they need JAR-specific functionality. For example:
URL url = new URL("jar:file:/home/duke/duke.jar!/"); JarURLConnection jarConnection = (JarURLConnection)url.openConnection(); Manifest manifest = jarConnection.getManifest();
Examples:
jar:http://www.foo.com/bar/baz.jar!/COM/foo/Quux.class
jar:http://www.foo.com/bar/baz.jar!/
jar:http://www.foo.com/bar/baz.jar!/COM/foo/
!/
is refered to as the separator.
When constructing a JAR url via new URL(context, spec)
,
the following rules apply:
Examples:
java.net.URL
,
java.net.URLConnection
,
java.util.jar.JarFile
,
java.util.jar.JarInputStream
,
java.util.jar.Manifest
,
java.util.zip.ZipEntry
Field Summary | |
private String |
entryName
|
private URL |
jarFileURL
|
protected URLConnection |
jarFileURLConnection
The connection to the JAR file URL, if the connection has been initiated. |
Fields inherited from class java.net.URLConnection |
allowUserInteraction, connected, doInput, doOutput, factory, ifModifiedSince, url, useCaches |
Constructor Summary | |
protected |
JarURLConnection(URL url)
Creates the new JarURLConnection to the specified URL. |
Method Summary | |
java.util.jar.Attributes |
getAttributes()
Enabled: Return the Attributes object for this connection if the URL for it points to a JAR file entry, null otherwise. |
java.security.cert.Certificate[] |
getCertificates()
Enabled: Return the Certificate object for this connection if the URL for it points to a JAR file entry, null otherwise. |
String |
getEntryName()
Enabled: Return the entry name for this connection. |
java.util.jar.JarEntry |
getJarEntry()
Enabled: Return the JAR entry object for this connection, if any. |
abstract java.util.jar.JarFile |
getJarFile()
Enabled: Return the JAR file for this connection. |
URL |
getJarFileURL()
Enabled: Returns the URL for the Jar file for this connection. |
java.util.jar.Attributes |
getMainAttributes()
Enabled: Returns the main Attributes for the JAR file for this connection. |
java.util.jar.Manifest |
getManifest()
Enabled: Returns the Manifest for this connection, or null if none. |
private void |
parseSpecs(URL url)
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
private URL jarFileURL
private String entryName
protected URLConnection jarFileURLConnection
Constructor Detail |
protected JarURLConnection(URL url) throws MalformedURLException
url
- the URL
MalformedURLException
- if no legal protocol
could be found in a specification string or the
string could not be parsed.Method Detail |
private void parseSpecs(URL url) throws MalformedURLException
MalformedURLException
public URL getJarFileURL()
public String getEntryName()
public abstract java.util.jar.JarFile getJarFile() throws IOException
IOException
URLConnection.connect()
public java.util.jar.Manifest getManifest() throws IOException
IOException
getJarFile()
public java.util.jar.JarEntry getJarEntry() throws IOException
IOException
getJarFile()
,
getJarEntry()
public java.util.jar.Attributes getAttributes() throws IOException
IOException
getJarEntry()
public java.util.jar.Attributes getMainAttributes() throws IOException
IOException
getJarFile()
,
getManifest()
public java.security.cert.Certificate[] getCertificates() throws IOException
null
IOException
getJarEntry()
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |