Package java.net
Class JarURLConnection
java.lang.Object
java.net.URLConnection
java.net.JarURLConnection
- Direct Known Subclasses:
JarURLConnectionImpl
public abstract class JarURLConnection extends URLConnection
This class establishes a connection to a Archive:
File Entry:
Directory Entry:
jar: URL using the
JAR protocol. A JarURLConnection instance can refer to either a JAR
archive file or to an entry of such a file. jar: URLs are specified
as follows: jar:{archive-url}!/{entry} where "!/" is called a
separator. This separator is important to determine if an archive or an entry
of an archive is referred.
Examples:
jar:http://www.example.com/applets/archive.jar!/
jar:http://www.example.com/applets/archive.jar!/test.class
jar:http://www.example.com/applets/archive.jar!/applets/-
Field Summary
Fields Modifier and Type Field Description protected URLConnectionjarFileURLConnectionThe location part of the represented URL.Fields inherited from class java.net.URLConnection
allowUserInteraction, connected, doInput, doOutput, ifModifiedSince, url, useCaches -
Constructor Summary
Constructors Modifier Constructor Description protectedJarURLConnection(URL url)Constructs an instance ofJarURLConnectionthat refers to the specified URL. -
Method Summary
Modifier and Type Method Description AttributesgetAttributes()Returns all attributes of theJarEntryreferenced by thisJarURLConnection.Certificate[]getCertificates()Returns all certificates of theJarEntryreferenced by thisJarURLConnectioninstance.StringgetEntryName()Gets the name of the entry referenced by thisJarURLConnection.JarEntrygetJarEntry()Gets theJarEntryobject of the entry referenced by thisJarURLConnection.abstract JarFilegetJarFile()Gets theJarFileobject referenced by thisJarURLConnection.URLgetJarFileURL()Gets the URL to the JAR-file referenced by thisJarURLConnection.AttributesgetMainAttributes()Gets all attributes of the manifest file referenced by thisJarURLConnection.ManifestgetManifest()Gets the manifest file associated with this JAR-URL.Methods inherited from class java.net.URLConnection
addRequestProperty, connect, getAllowUserInteraction, getConnectTimeout, getContent, getContent, getContentEncoding, getContentLength, getContentType, getDate, getDefaultAllowUserInteraction, getDefaultRequestProperty, getDefaultUseCaches, getDoInput, getDoOutput, getExpiration, getFileNameMap, getHeaderField, getHeaderField, getHeaderFieldDate, getHeaderFieldInt, getHeaderFieldKey, getHeaderFields, getIfModifiedSince, getInputStream, getLastModified, getOutputStream, getPermission, getReadTimeout, getRequestProperties, getRequestProperty, getURL, getUseCaches, guessContentTypeFromName, guessContentTypeFromStream, setAllowUserInteraction, setConnectTimeout, setContentHandlerFactory, setDefaultAllowUserInteraction, setDefaultRequestProperty, setDefaultUseCaches, setDoInput, setDoOutput, setFileNameMap, setIfModifiedSince, setReadTimeout, setRequestProperty, setUseCaches, toString
-
Field Details
-
jarFileURLConnection
The location part of the represented URL.
-
-
Constructor Details
-
JarURLConnection
Constructs an instance ofJarURLConnectionthat refers to the specified URL.- Parameters:
url- the URL that contains the location to connect to.- Throws:
MalformedURLException- if an invalid URL has been entered.
-
-
Method Details
-
getAttributes
Returns all attributes of theJarEntryreferenced by thisJarURLConnection.- Returns:
- the attributes of the referenced
JarEntry. - Throws:
IOException- if an I/O exception occurs while retrieving the JAR-entries.
-
getCertificates
Returns all certificates of theJarEntryreferenced by thisJarURLConnectioninstance. This method will returnnulluntil theInputStreamhas been completely verified.- Returns:
- the certificates of the
JarEntryas an array. - Throws:
IOException- if there is an I/O exception occurs while getting theJarEntry.
-
getEntryName
Gets the name of the entry referenced by thisJarURLConnection. The return value will benullif this instance refers to a JAR file rather than an JAR file entry.- Returns:
- the
JarEntryname this instance refers to.
-
getJarEntry
Gets theJarEntryobject of the entry referenced by thisJarURLConnection.- Returns:
- the referenced
JarEntryobject ornullif no entry name is specified. - Throws:
IOException- if an error occurs while getting the file or file-entry.
-
getManifest
Gets the manifest file associated with this JAR-URL.- Returns:
- the manifest of the referenced JAR-file.
- Throws:
IOException- if an error occurs while getting the manifest file.
-
getJarFile
Gets theJarFileobject referenced by thisJarURLConnection.- Returns:
- the referenced JarFile object.
- Throws:
IOException- if an I/O exception occurs while retrieving the JAR-file.
-
getJarFileURL
Gets the URL to the JAR-file referenced by thisJarURLConnection.- Returns:
- the URL to the JAR-file or
nullif there was an error retrieving the URL.
-
getMainAttributes
Gets all attributes of the manifest file referenced by thisJarURLConnection. If this instance refers to a JAR-file rather than a JAR-file entry,nullwill be returned.- Returns:
- the attributes of the manifest file or
null. - Throws:
IOException- if an I/O exception occurs while retrieving theJarFile.
-