JarURLConnection Class

Definition

A URL Connection to a Java ARchive (JAR) file or an entry in a JAR file.

[Android.Runtime.Register("java/net/JarURLConnection", DoNotGenerateAcw=true)]
public abstract class JarURLConnection : Java.Net.URLConnection
[<Android.Runtime.Register("java/net/JarURLConnection", DoNotGenerateAcw=true)>]
type JarURLConnection = class
    inherit URLConnection
Inheritance
JarURLConnection
Attributes

Remarks

A URL Connection to a Java ARchive (JAR) file or an entry in a JAR file.

The syntax of a JAR URL is:

jar:&lt;url&gt;!/{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();

JarURLConnection instances can only be used to read from JAR files. It is not possible to get a java.io.OutputStream to modify or write to the underlying JAR file using this class.

Examples:

<dl>

<dt>A Jar entry <dd>jar:http://www.foo.com/bar/baz.jar!/COM/foo/Quux.class<dt>A Jar file <dd>jar:http://www.foo.com/bar/baz.jar!/<dt>A Jar directory <dd>jar:http://www.foo.com/bar/baz.jar!/COM/foo/</dl>

!/ is referred to as the <em>separator</em>.

When constructing a JAR url via new URL(context, spec), the following rules apply:

<ul>

<li>if there is no context URL and the specification passed to the URL constructor doesn't contain a separator, the URL is considered to refer to a JarFile.

<li>if there is a context URL, the context URL is assumed to refer to a JAR file or a Jar directory.

<li>if the specification begins with a '/', the Jar directory is ignored, and the spec is considered to be at the root of the Jar file.

Examples:

<dl>

<dt>context: <b>jar:http://www.foo.com/bar/jar.jar!/</b>, spec:<b>baz/entry.txt</b>

<dd>url:<b>jar:http://www.foo.com/bar/jar.jar!/baz/entry.txt</b>

<dt>context: <b>jar:http://www.foo.com/bar/jar.jar!/baz</b>, spec:<b>entry.txt</b>

<dd>url:<b>jar:http://www.foo.com/bar/jar.jar!/baz/entry.txt</b>

<dt>context: <b>jar:http://www.foo.com/bar/jar.jar!/baz</b>, spec:<b>/entry.txt</b>

<dd>url:<b>jar:http://www.foo.com/bar/jar.jar!/entry.txt</b>

</dl>

</ul>

Added in 1.2.

Java documentation for java.net.JarURLConnection.

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Constructors

JarURLConnection(IntPtr, JniHandleOwnership)

A constructor used when creating managed representations of JNI objects; called by the runtime.

JarURLConnection(URL)

Creates the new JarURLConnection to the specified URL.

Properties

AllowUserInteraction

Returns the value of the allowUserInteraction field for this object. -or- Set the value of the allowUserInteraction field of this URLConnection.

(Inherited from URLConnection)
Attributes

Return the Attributes object for this connection if the URL for it points to a JAR file entry, null otherwise.

Class

Returns the runtime class of this Object.

(Inherited from Object)
Connected

If false, this connection object has not created a communications link to the specified URL.

(Inherited from URLConnection)
ConnectTimeout

Returns setting for connect timeout. -or- Sets a specified timeout value, in milliseconds, to be used when opening a communications link to the resource referenced by this URLConnection.

(Inherited from URLConnection)
Content

Retrieves the contents of this URL connection.

(Inherited from URLConnection)
ContentEncoding

Returns the value of the content-encoding header field.

(Inherited from URLConnection)
ContentLength

Returns the value of the content-length header field.

(Inherited from URLConnection)
ContentLengthLong

Returns the value of the content-length header field as a long.

(Inherited from URLConnection)
ContentType

Returns the value of the content-type header field.

(Inherited from URLConnection)
Date

Returns the value of the date header field.

(Inherited from URLConnection)
DefaultUseCaches

Returns the default value of a URLConnection's useCaches flag. -or- Sets the default value of the useCaches field to the specified value.

(Inherited from URLConnection)
DoInput

Returns the value of this URLConnection's doInput flag. -or- Sets the value of the doInput field for this URLConnection to the specified value.

(Inherited from URLConnection)
DoOutput

Returns the value of this URLConnection's doOutput flag. -or- Sets the value of the doOutput field for this URLConnection to the specified value.

(Inherited from URLConnection)
EntryName

Return the entry name for this connection.

Expiration

Returns the value of the expires header field.

(Inherited from URLConnection)
Handle

The handle to the underlying Android instance.

(Inherited from Object)
HeaderFields

Returns an unmodifiable Map of the header fields.

(Inherited from URLConnection)
IfModifiedSince

Returns the value of this object's ifModifiedSince field. -or- Sets the value of the ifModifiedSince field of this URLConnection to the specified value.

(Inherited from URLConnection)
InputStream

Returns an input stream that reads from this open connection.

(Inherited from URLConnection)
JarEntry

Return the JAR entry object for this connection, if any.

JarFile

Gets the JarFile object referenced by this JarURLConnection.

JarFileURL

Returns the URL for the Jar file for this connection.

JarFileURLConnection

The connection to the JAR file URL, if the connection has been initiated.

JniIdentityHashCode (Inherited from Object)
JniPeerMembers
LastModified

Returns the value of the last-modified header field.

(Inherited from URLConnection)
MainAttributes

Returns the main Attributes for the JAR file for this connection.

Manifest

Returns the Manifest for this connection, or null if none.

OutputStream

Returns an output stream that writes to this connection.

(Inherited from URLConnection)
PeerReference (Inherited from Object)
Permission

Returns a permission object representing the permission necessary to make the connection represented by this object.

(Inherited from URLConnection)
ReadTimeout

Returns setting for read timeout. -or- Sets the read timeout to a specified timeout, in milliseconds.

(Inherited from URLConnection)
RequestProperties

Returns an unmodifiable Map of general request properties for this connection.

(Inherited from URLConnection)
ThresholdClass

This API supports the Mono for Android infrastructure and is not intended to be used directly from your code.

ThresholdType

This API supports the Mono for Android infrastructure and is not intended to be used directly from your code.

Url

The URL represents the remote object on the World Wide Web to which this connection is opened.

(Inherited from URLConnection)
URL

Returns the value of this URLConnection's URL field.

(Inherited from URLConnection)
UseCaches

Returns the value of this URLConnection's useCaches field. -or- Sets the value of the useCaches field of this URLConnection to the specified value.

(Inherited from URLConnection)

Methods

AddRequestProperty(String, String)

Adds a general request property specified by a key-value pair.

(Inherited from URLConnection)
Clone()

Creates and returns a copy of this object.

(Inherited from Object)
Connect()

Opens a communications link to the resource referenced by this URL, if such a connection has not already been established.

(Inherited from URLConnection)
ConnectAsync() (Inherited from URLConnection)
Dispose() (Inherited from Object)
Dispose(Boolean) (Inherited from Object)
Equals(Object)

Indicates whether some other object is "equal to" this one.

(Inherited from Object)
GetCertificates()

Return the Certificate object for this connection if the URL for it points to a JAR file entry, null otherwise.

GetContent(Class[])

Retrieves the contents of this URL connection.

(Inherited from URLConnection)
GetHashCode()

Returns a hash code value for the object.

(Inherited from Object)
GetHeaderField(Int32)

Returns the value for the n<sup>th</sup> header field.

(Inherited from URLConnection)
GetHeaderField(String)

Returns the value of the named header field.

(Inherited from URLConnection)
GetHeaderFieldDate(String, Int64)

Returns the value of the named field parsed as date.

(Inherited from URLConnection)
GetHeaderFieldInt(String, Int32)

Returns the value of the named field parsed as a number.

(Inherited from URLConnection)
GetHeaderFieldKey(Int32)

Returns the key for the n<sup>th</sup> header field.

(Inherited from URLConnection)
GetHeaderFieldLong(String, Int64)

Returns the value of the named field parsed as a number.

(Inherited from URLConnection)
GetRequestProperty(String)

Returns the value of the named general request property for this connection.

(Inherited from URLConnection)
JavaFinalize()

Called by the garbage collector on an object when garbage collection determines that there are no more references to the object.

(Inherited from Object)
Notify()

Wakes up a single thread that is waiting on this object's monitor.

(Inherited from Object)
NotifyAll()

Wakes up all threads that are waiting on this object's monitor.

(Inherited from Object)
SetHandle(IntPtr, JniHandleOwnership)

Sets the Handle property.

(Inherited from Object)
SetRequestProperty(String, String)

Sets the general request property.

(Inherited from URLConnection)
ToArray<T>() (Inherited from Object)
ToString()

Returns a string representation of the object.

(Inherited from Object)
UnregisterFromRuntime() (Inherited from Object)
Wait()

Causes the current thread to wait until it is awakened, typically by being <em>notified</em> or <em>interrupted</em>.

(Inherited from Object)
Wait(Int64)

Causes the current thread to wait until it is awakened, typically by being <em>notified</em> or <em>interrupted</em>, or until a certain amount of real time has elapsed.

(Inherited from Object)
Wait(Int64, Int32)

Causes the current thread to wait until it is awakened, typically by being <em>notified</em> or <em>interrupted</em>, or until a certain amount of real time has elapsed.

(Inherited from Object)

Explicit Interface Implementations

IJavaPeerable.Disposed() (Inherited from Object)
IJavaPeerable.DisposeUnlessReferenced() (Inherited from Object)
IJavaPeerable.Finalized() (Inherited from Object)
IJavaPeerable.JniManagedPeerState (Inherited from Object)
IJavaPeerable.SetJniIdentityHashCode(Int32) (Inherited from Object)
IJavaPeerable.SetJniManagedPeerState(JniManagedPeerStates) (Inherited from Object)
IJavaPeerable.SetPeerReference(JniObjectReference) (Inherited from Object)

Extension Methods

JavaCast<TResult>(IJavaObject)

Performs an Android runtime-checked type conversion.

JavaCast<TResult>(IJavaObject)
GetJniTypeName(IJavaPeerable)

Applies to