URLConnection URLConnection Class

Definition

A connection to a URL for reading or writing.

[Android.Runtime.Register("java/net/URLConnection", ApiSince=1, DoNotGenerateAcw=true)]
public abstract class URLConnection : Java.Lang.Object
type URLConnection = class
    inherit Object
Inheritance
URLConnectionURLConnection
Derived
Attributes

Remarks

Android platform documentation

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

URLConnection(IntPtr, JniHandleOwnership) URLConnection(IntPtr, JniHandleOwnership)

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

URLConnection(URL) URLConnection(URL)

Creates a new URLConnection instance pointing to the resource specified by the given URL.

Properties

AllowUserInteraction AllowUserInteraction

Returns allowUserInteraction.

Class Class

Returns the unique instance of Class that represents this object's class.

(Inherited from Object)
Connected Connected

Specifies whether this URLConnection is already connected to the remote resource.

ConnectTimeout ConnectTimeout

Returns the connect timeout in milliseconds.

Content Content

Returns an object representing the content of the resource this URLConnection is connected to.

ContentEncoding ContentEncoding

Returns the content encoding type specified by the response header field content-encoding or null if this field is not set.

ContentLength ContentLength

Returns the content length in bytes specified by the response header field content-length or -1 if this field is not set or cannot be represented as an int.

ContentLengthLong ContentLengthLong
ContentType ContentType

Returns the MIME-type of the content specified by the response header field content-type or null if type is unknown.

Date Date

Returns the timestamp when this response has been sent as a date in milliseconds since January 1, 1970 GMT or 0 if this timestamp is unknown.

DefaultAllowUserInteraction DefaultAllowUserInteraction

Returns the default value of allowUserInteraction.

DefaultUseCaches DefaultUseCaches

Returns the default setting whether this connection allows using caches.

DoInput DoInput

Returns the value of the option doInput which specifies whether this connection allows to receive data.

DoOutput DoOutput

Returns the value of the option doOutput which specifies whether this connection allows to send data.

Expiration Expiration

Returns the timestamp when this response will be expired in milliseconds since January 1, 1970 GMT or 0 if this timestamp is unknown.

FileNameMap FileNameMap

Returns the table which is used by all URLConnection instances to determine the MIME-type according to a file extension.

Handle Handle

The handle to the underlying Android instance.

(Inherited from Object)
HeaderFields HeaderFields

Returns an unmodifiable map of the response-header fields and values.

IfModifiedSince IfModifiedSince

Returns the point of time since when the data must be modified to be transmitted.

IJavaObjectEx.IsProxy IJavaObjectEx.IsProxy Inherited from Object
IJavaObjectEx.KeyHandle IJavaObjectEx.KeyHandle Inherited from Object
IJavaObjectEx.NeedsActivation IJavaObjectEx.NeedsActivation Inherited from Object
IJavaPeerable.JniManagedPeerState IJavaPeerable.JniManagedPeerState Inherited from Object
InputStream InputStream

Returns an InputStream for reading data from the resource pointed by this URLConnection.

JniIdentityHashCode JniIdentityHashCode Inherited from Object
JniPeerMembers JniPeerMembers
LastModified LastModified

Returns the value of the response header field last-modified or 0 if this value is not set.

OutputStream OutputStream

Returns an OutputStream for writing data to this URLConnection.

PeerReference PeerReference Inherited from Object
Permission Permission

Returns a Permission object representing all needed permissions to open this connection.

ReadTimeout ReadTimeout

Returns the read timeout in milliseconds, or 0 if reads never timeout.

RequestProperties RequestProperties

Returns an unmodifiable map of general request properties used by this connection.

ThresholdClass ThresholdClass

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

ThresholdType ThresholdType

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

Url Url

The URL which represents the remote target of this URLConnection.

URL URL

Returns the URL represented by this URLConnection.

UseCaches UseCaches

Returns the value of the flag which specifies whether this URLConnection allows to use caches.

Methods

AddRequestProperty(String, String) AddRequestProperty(String, String)

Adds the given property to the request header.

Clone() Clone()

Creates and returns a copy of this Object.

(Inherited from Object)
Connect() Connect()

Opens a connection to the resource.

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

Compares this instance with the specified object and indicates if they are equal.

(Inherited from Object)
GetContent(Class[]) GetContent(Class[])

Returns an object representing the content of the resource this URLConnection is connected to.

GetDefaultRequestProperty(String) GetDefaultRequestProperty(String)

Returns null.

GetHashCode() GetHashCode()

Returns an integer hash code for this object.

(Inherited from Object)
GetHeaderField(Int32) GetHeaderField(Int32)

Returns the header value at the field position pos or null if the header has fewer than pos fields.

GetHeaderField(String) GetHeaderField(String)

Returns the value of the header field specified by key or null if there is no field with this name.

GetHeaderFieldDate(String, Int64) GetHeaderFieldDate(String, Int64)

Returns the specified header value as a date in milliseconds since January 1, 1970 GMT.

GetHeaderFieldInt(String, Int32) GetHeaderFieldInt(String, Int32)

Returns the specified header value as a number.

GetHeaderFieldKey(Int32) GetHeaderFieldKey(Int32)

Returns the name of the header field at the given position posn or null if there are fewer than posn fields.

GetHeaderFieldLong(String, Int64) GetHeaderFieldLong(String, Int64)
GetRequestProperty(String) GetRequestProperty(String)

Returns the value of the request header property specified by {code field} or null if there is no field with this name.

GuessContentTypeFromName(String) GuessContentTypeFromName(String)

Determines the MIME-type of the given resource url by resolving the filename extension with the internal FileNameMap.

GuessContentTypeFromStream(Stream) GuessContentTypeFromStream(Stream)

Determines the MIME-type of the resource represented by the input stream is by reading its first few characters.

JavaFinalize() JavaFinalize()

Invoked when the garbage collector has detected that this instance is no longer reachable.

(Inherited from Object)
Notify() Notify()

Causes a thread which is waiting on this object's monitor (by means of calling one of the wait() methods) to be woken up.

(Inherited from Object)
NotifyAll() NotifyAll()

Causes all threads which are waiting on this object's monitor (by means of calling one of the wait() methods) to be woken up.

(Inherited from Object)
SetContentHandlerFactory(IContentHandlerFactory) SetContentHandlerFactory(IContentHandlerFactory)

Sets the internally used content handler factory.

SetDefaultRequestProperty(String, String) SetDefaultRequestProperty(String, String)

Does nothing.

SetHandle(IntPtr, JniHandleOwnership) SetHandle(IntPtr, JniHandleOwnership)

Sets the Handle property.

(Inherited from Object)
SetRequestProperty(String, String) SetRequestProperty(String, String)

Sets the value of the specified request header field.

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

Returns a string containing a concise, human-readable description of this object.

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

Causes the calling thread to wait until another thread calls the notify() or notifyAll() method of this object.

(Inherited from Object)
Wait(Int64) Wait(Int64)

Causes the calling thread to wait until another thread calls the notify() or notifyAll() method of this object or until the specified timeout expires.

(Inherited from Object)
Wait(Int64, Int32) Wait(Int64, Int32)

Causes the calling thread to wait until another thread calls the notify() or notifyAll() method of this object or until the specified timeout expires.

(Inherited from Object)

Explicit Interface Implementations

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

Extension Methods

JavaCast<TResult>(IJavaObject) JavaCast<TResult>(IJavaObject)

Performs an Android runtime-checked type conversion.

JavaCast<TResult>(IJavaObject) JavaCast<TResult>(IJavaObject)
GetJniTypeName(IJavaPeerable) GetJniTypeName(IJavaPeerable)

Applies to