Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

java.net
Class JarURLConnection  view JarURLConnection download JarURLConnection.java

java.lang.Object
  extended byjava.net.URLConnection
      extended byjava.net.JarURLConnection

public abstract class JarURLConnection
extends URLConnection

This abstract class represents a common superclass for implementations of jar URL's. A jar URL is a special type of URL that allows JAR files on remote systems to be accessed. It has the form:

jar:<standard URL pointing to jar filei>!/file/within/jarfile

for example:

jar:http://www.urbanophile.com/java/foo.jar!/com/urbanophile/bar.class

That example URL points to the file /com/urbanophile/bar.class in the remote JAR file http://www.urbanophile.com/java/foo.jar. The HTTP protocol is used only as an example. Any supported remote protocol can be used.

This class currently works by retrieving the entire jar file into a local cache file, then performing standard jar operations on it. (At least this is true for the default protocol implementation).

Since:
1.2

Field Summary
private  java.lang.String entryName
          This is the jar file "entry name" or portion after the "!/" in the URL which represents the pathname inside the actual jar file.
private  URL jarFileURL
          This is the actual URL that points the remote jar file.
protected  URLConnection jarFileURLConnection
          The connection to the jar file itself.
 
Fields inherited from class java.net.URLConnection
allowUserInteraction, connected, doInput, doOutput, ifModifiedSince, url, useCaches
 
Constructor Summary
protected JarURLConnection(URL url)
          Creates a JarURLConnection from an URL object
 
Method Summary
 java.util.jar.Attributes getAttributes()
          Returns the Attributes for the Jar entry specified by the URL or null if none
 java.security.cert.Certificate[] getCertificates()
          Returns an array of Certificate objects for the jar file entry specified by this URL or null if there are none
 java.lang.String getEntryName()
          Returns the "entry name" portion of the jar URL.
 java.util.jar.JarEntry getJarEntry()
          Returns the entry in this jar file specified by the URL.
abstract  java.util.jar.JarFile getJarFile()
          Returns a read-only JarFile object for the remote jar file
 URL getJarFileURL()
          This method returns the "real" URL where the JarFile is located.
 java.util.jar.Attributes getMainAttributes()
          Returns the main Attributes for the jar file specified in the URL or null if there are none
 java.util.jar.Manifest getManifest()
          Returns a Manifest object for this jar file, or null if there is no manifest.
 
Methods inherited from class java.net.URLConnection
addRequestProperty, connect, getAllowUserInteraction, getContent, getContent, getContentEncoding, getContentLength, getContentType, getDate, getDefaultAllowUserInteraction, getDefaultRequestProperty, getDefaultUseCaches, getDoInput, getDoOutput, getExpiration, getFileNameMap, getHeaderField, getHeaderField, getHeaderFieldDate, getHeaderFieldInt, getHeaderFieldKey, getHeaderFields, getIfModifiedSince, getInputStream, getLastModified, getOutputStream, getPermission, getRequestProperties, getRequestProperty, getURL, getUseCaches, guessContentTypeFromName, guessContentTypeFromStream, setAllowUserInteraction, setContentHandlerFactory, setDefaultAllowUserInteraction, setDefaultRequestProperty, setDefaultUseCaches, setDoInput, setDoOutput, setFileNameMap, setIfModifiedSince, setRequestProperty, setUseCaches, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

jarFileURL

private final URL jarFileURL
This is the actual URL that points the remote jar file. This is parsed out of the jar URL by the constructor.


jarFileURLConnection

protected URLConnection jarFileURLConnection
The connection to the jar file itself. A JarURLConnection can represent an entry in a jar file or an entire jar file. In either case this describes just the jar file itself.


entryName

private final java.lang.String entryName
This is the jar file "entry name" or portion after the "!/" in the URL which represents the pathname inside the actual jar file.

Constructor Detail

JarURLConnection

protected JarURLConnection(URL url)
                    throws MalformedURLException
Creates a JarURLConnection from an URL object

Method Detail

getJarFileURL

public URL getJarFileURL()
This method returns the "real" URL where the JarFile is located. //****Is this right?*****


getEntryName

public java.lang.String getEntryName()
Returns the "entry name" portion of the jar URL. This is the portion after the "!/" in the jar URL that represents the pathname inside the actual jar file.


getJarEntry

public java.util.jar.JarEntry getJarEntry()
                                   throws java.io.IOException
Returns the entry in this jar file specified by the URL.


getJarFile

public abstract java.util.jar.JarFile getJarFile()
                                          throws java.io.IOException
Returns a read-only JarFile object for the remote jar file


getCertificates

public java.security.cert.Certificate[] getCertificates()
                                                 throws java.io.IOException
Returns an array of Certificate objects for the jar file entry specified by this URL or null if there are none


getMainAttributes

public java.util.jar.Attributes getMainAttributes()
                                           throws java.io.IOException
Returns the main Attributes for the jar file specified in the URL or null if there are none


getAttributes

public java.util.jar.Attributes getAttributes()
                                       throws java.io.IOException
Returns the Attributes for the Jar entry specified by the URL or null if none


getManifest

public java.util.jar.Manifest getManifest()
                                   throws java.io.IOException
Returns a Manifest object for this jar file, or null if there is no manifest.