Udostępnij za pośrednictwem


File.ToURL Method

Definition

Caution

deprecated

Converts this abstract pathname into a file: URL.

[Android.Runtime.Register("toURL", "()Ljava/net/URL;", "GetToURLHandler")]
[System.Obsolete("deprecated")]
public virtual Java.Net.URL ToURL ();
[<Android.Runtime.Register("toURL", "()Ljava/net/URL;", "GetToURLHandler")>]
[<System.Obsolete("deprecated")>]
abstract member ToURL : unit -> Java.Net.URL
override this.ToURL : unit -> Java.Net.URL

Returns

URL

A URL object representing the equivalent file URL

Attributes

Exceptions

if the path cannot be transformed into a URL.

Remarks

Converts this abstract pathname into a file: URL. The exact form of the URL is system-dependent. If it can be determined that the file denoted by this abstract pathname is a directory, then the resulting URL will end with a slash.

Added in 1.2.

This member is deprecated. This method does not automatically escape characters that are illegal in URLs. It is recommended that new code convert an abstract pathname into a URL by first converting it into a URI, via the #toURI() toURI method, and then converting the URI into a URL via the java.net.URI#toURL() URI.toURL method.

Java documentation for java.io.File.toURL().

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