URLStreamHandler.OpenConnection Method

Definition

Overloads

OpenConnection(URL, Proxy)

Same as openConnection(URL), except that the connection will be made through the specified proxy; Protocol handlers that do not support proxying will ignore the proxy parameter and make a normal connection.

OpenConnection(URL)

Opens a connection to the object referenced by the URL argument.

OpenConnection(URL, Proxy)

Same as openConnection(URL), except that the connection will be made through the specified proxy; Protocol handlers that do not support proxying will ignore the proxy parameter and make a normal connection.

[Android.Runtime.Register("openConnection", "(Ljava/net/URL;Ljava/net/Proxy;)Ljava/net/URLConnection;", "GetOpenConnection_Ljava_net_URL_Ljava_net_Proxy_Handler")]
protected virtual Java.Net.URLConnection? OpenConnection (Java.Net.URL? u, Java.Net.Proxy? p);
[<Android.Runtime.Register("openConnection", "(Ljava/net/URL;Ljava/net/Proxy;)Ljava/net/URLConnection;", "GetOpenConnection_Ljava_net_URL_Ljava_net_Proxy_Handler")>]
abstract member OpenConnection : Java.Net.URL * Java.Net.Proxy -> Java.Net.URLConnection
override this.OpenConnection : Java.Net.URL * Java.Net.Proxy -> Java.Net.URLConnection

Parameters

u
URL

the URL that this connects to.

p
Proxy

the proxy through which the connection will be made. If direct connection is desired, Proxy.NO_PROXY should be specified.

Returns

a URLConnection object for the URL.

Attributes

Exceptions

if an I/O error occurs during opening the connection.

if any argument is null or the type of proxy is wrong.

if the protocol handler doesn't support this method.

Remarks

Same as openConnection(URL), except that the connection will be made through the specified proxy; Protocol handlers that do not support proxying will ignore the proxy parameter and make a normal connection.

Calling this method preempts the system's default ProxySelector settings.

Added in 1.5.

Java documentation for java.net.URLStreamHandler.openConnection(java.net.URL, java.net.Proxy).

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.

Applies to

OpenConnection(URL)

Opens a connection to the object referenced by the URL argument.

[Android.Runtime.Register("openConnection", "(Ljava/net/URL;)Ljava/net/URLConnection;", "GetOpenConnection_Ljava_net_URL_Handler")]
protected abstract Java.Net.URLConnection? OpenConnection (Java.Net.URL? u);
[<Android.Runtime.Register("openConnection", "(Ljava/net/URL;)Ljava/net/URLConnection;", "GetOpenConnection_Ljava_net_URL_Handler")>]
abstract member OpenConnection : Java.Net.URL -> Java.Net.URLConnection

Parameters

u
URL

the URL that this connects to.

Returns

a URLConnection object for the URL.

Attributes

Exceptions

if an I/O error occurs during opening the connection.

Remarks

Opens a connection to the object referenced by the URL argument. This method should be overridden by a subclass.

If for the handler's protocol (such as HTTP or JAR), there exists a public, specialized URLConnection subclass belonging to one of the following packages or one of their subpackages: java.lang, java.io, java.util, java.net, the connection returned will be of that subclass. For example, for HTTP an HttpURLConnection will be returned, and for JAR a JarURLConnection will be returned.

Java documentation for java.net.URLStreamHandler.openConnection(java.net.URL).

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.

Applies to