to top
Android APIs
public abstract class

JarURLConnection

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

Class Overview

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.
    [Expand]
    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.
    [Expand]
    Inherited Methods
    From class java.net.URLConnection
    From class java.lang.Object

    Fields

    protected URLConnection jarFileURLConnection

    Added in API level 1

    The location part of the represented URL.

    Protected Constructors

    protected JarURLConnection (URL url)

    Added in API level 1

    Constructs an instance of JarURLConnection that 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.

    Public Methods

    public Attributes getAttributes ()

    Added in API level 1

    Returns all attributes of the JarEntry referenced by this JarURLConnection.

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

    public Certificate[] getCertificates ()

    Added in API level 1

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

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

    public String getEntryName ()

    Added in API level 1

    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
    • the JarEntry name this instance refers to.

    public JarEntry getJarEntry ()

    Added in API level 1

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

    Returns
    • 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.

    public abstract JarFile getJarFile ()

    Added in API level 1

    Gets the JarFile object referenced by this JarURLConnection.

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

    public URL getJarFileURL ()

    Added in API level 1

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

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

    public Attributes getMainAttributes ()

    Added in API level 1

    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
    • the attributes of the manifest file or null.
    Throws
    IOException if an I/O exception occurs while retrieving the JarFile.

    public Manifest getManifest ()

    Added in API level 1

    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.