Skip to content

Most visited

Recently visited

navigation
Added in API level 1

JarURLConnection

public abstract class JarURLConnection
extends URLConnection

java.lang.Object
   ↳ java.net.URLConnection
     ↳ java.net.JarURLConnection


This class establishes a connection to a 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:

  • Archive: jar:http://www.example.com/applets/archive.jar!/
  • File Entry: jar:http://www.example.com/applets/archive.jar!/test.class
  • Directory Entry: jar:http://www.example.com/applets/archive.jar!/applets/
  • Summary

    Fields

    protected URLConnection jarFileURLConnection

    The location part of the represented URL.

    Inherited fields

    From class java.net.URLConnection

    Protected constructors

    JarURLConnection(URL url)

    Constructs an instance of JarURLConnection that refers to the specified URL.

    Public methods

    Attributes getAttributes()

    Returns all attributes of the JarEntry referenced by this JarURLConnection.

    Certificate[] getCertificates()

    Returns all certificates of the JarEntry referenced by this JarURLConnection instance.

    String getEntryName()

    Gets the name of the entry referenced by this JarURLConnection.

    JarEntry getJarEntry()

    Gets the JarEntry object of the entry referenced by this JarURLConnection.

    abstract JarFile getJarFile()

    Gets the JarFile object referenced by this JarURLConnection.

    URL getJarFileURL()

    Gets the URL to the JAR-file referenced by this JarURLConnection.

    Attributes getMainAttributes()

    Gets all attributes of the manifest file referenced by this JarURLConnection.

    Manifest getManifest()

    Gets the manifest file associated with this JAR-URL.

    Inherited methods

    From class java.net.URLConnection
    From class java.lang.Object

    Fields

    jarFileURLConnection

    Added in API level 1
    URLConnection jarFileURLConnection

    The location part of the represented URL.

    Protected constructors

    JarURLConnection

    Added in API level 1
    JarURLConnection (URL url)

    Constructs an instance of JarURLConnection that refers to the specified URL.

    Parameters
    url URL: the URL that contains the location to connect to.
    Throws
    MalformedURLException if an invalid URL has been entered.

    Public methods

    getAttributes

    Added in API level 1
    Attributes getAttributes ()

    Returns all attributes of the JarEntry referenced by this JarURLConnection.

    Returns
    Attributes the attributes of the referenced JarEntry.
    Throws
    IOException if an I/O exception occurs while retrieving the JAR-entries.

    getCertificates

    Added in API level 1
    Certificate[] getCertificates ()

    Returns all certificates of the JarEntry referenced by this JarURLConnection instance. This method will return null until the InputStream has been completely verified.

    Returns
    Certificate[] the certificates of the JarEntry as an array.
    Throws
    IOException if there is an I/O exception occurs while getting the JarEntry.

    getEntryName

    Added in API level 1
    String getEntryName ()

    Gets the name of the entry referenced by this JarURLConnection. The return value will be null if this instance refers to a JAR file rather than an JAR file entry.

    Returns
    String the JarEntry name this instance refers to.

    getJarEntry

    Added in API level 1
    JarEntry getJarEntry ()

    Gets the JarEntry object of the entry referenced by this JarURLConnection.

    Returns
    JarEntry the referenced JarEntry object or null if no entry name is specified.
    Throws
    IOException if an error occurs while getting the file or file-entry.

    getJarFile

    Added in API level 1
    JarFile getJarFile ()

    Gets the JarFile object referenced by this JarURLConnection.

    Returns
    JarFile the referenced JarFile object.
    Throws
    IOException if an I/O exception occurs while retrieving the JAR-file.

    getJarFileURL

    Added in API level 1
    URL getJarFileURL ()

    Gets the URL to the JAR-file referenced by this JarURLConnection.

    Returns
    URL the URL to the JAR-file or null if there was an error retrieving the URL.

    getMainAttributes

    Added in API level 1
    Attributes getMainAttributes ()

    Gets all attributes of the manifest file referenced by this JarURLConnection. If this instance refers to a JAR-file rather than a JAR-file entry, null will be returned.

    Returns
    Attributes the attributes of the manifest file or null.
    Throws
    IOException if an I/O exception occurs while retrieving the JarFile.

    getManifest

    Added in API level 1
    Manifest getManifest ()

    Gets the manifest file associated with this JAR-URL.

    Returns
    Manifest the manifest of the referenced JAR-file.
    Throws
    IOException if an error occurs while getting the manifest file.
    This site uses cookies to store your preferences for site-specific language and display options.

    Hooray!

    This class requires API level or higher

    This doc is hidden because your selected API level for the documentation is . You can change the documentation API level with the selector above the left navigation.

    For more information about specifying the API level your app requires, read Supporting Different Platform Versions.