Language

IPath.Of Method

Definition

Overloads

Name Description
Of(URI)

Returns a Path by converting a URI.

Of(String, String[])

Returns a Path by converting a path string, or a sequence of strings that when joined form a path string.

Of(URI)

Returns a Path by converting a URI.

[Android.Runtime.Register("of", "(Ljava/net/URI;)Ljava/nio/file/Path;", "", ApiSince=34)]
public static Java.Nio.FileNio.IPath? Of(Java.Net.URI? uri);
[<Android.Runtime.Register("of", "(Ljava/net/URI;)Ljava/nio/file/Path;", "", ApiSince=34)>]
static member Of : Java.Net.URI -> Java.Nio.FileNio.IPath

Parameters

uri
URI

the URI to convert

Returns

the resulting Path

Attributes

Remarks

Returns a Path by converting a URI.

This method iterates over the FileSystemProvider#installedProviders() installed providers to locate the provider that is identified by the URI URI#getScheme scheme of the given URI. URI schemes are compared without regard to case. If the provider is found then its FileSystemProvider#getPath getPath method is invoked to convert the URI.

In the case of the default provider, identified by the URI scheme "file", the given URI has a non-empty path component, and undefined query and fragment components. Whether the authority component may be present is platform specific. The returned Path is associated with the FileSystems#getDefault default file system.

The default provider provides a similar <em>round-trip</em> guarantee to the java.io.File class. For a given Pathp it is guaranteed that <blockquote>Path.of(p.Path#toUri() toUri()).equals(p.Path#toAbsolutePath() toAbsolutePath())</blockquote> so long as the original Path, the URI, and the new Path are all created in (possibly different invocations of) the same Java virtual machine. Whether other providers make any guarantees is provider specific and therefore unspecified.

Added in 11.

Java documentation for java.nio.file.Path.of(java.net.URI).

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

Of(String, String[])

Returns a Path by converting a path string, or a sequence of strings that when joined form a path string.

[Android.Runtime.Register("of", "(Ljava/lang/String;[Ljava/lang/String;)Ljava/nio/file/Path;", "", ApiSince=34)]
public static Java.Nio.FileNio.IPath? Of(string? first, params string[]? more);
[<Android.Runtime.Register("of", "(Ljava/lang/String;[Ljava/lang/String;)Ljava/nio/file/Path;", "", ApiSince=34)>]
static member Of : string * string[] -> Java.Nio.FileNio.IPath

Parameters

first
String

the path string or initial part of the path string

more
String[]

additional strings to be joined to form the path string

Returns

the resulting Path

Attributes

Remarks

Returns a Path by converting a path string, or a sequence of strings that when joined form a path string. If more does not specify any elements then the value of the first parameter is the path string to convert. If more specifies one or more elements then each non-empty string, including first, is considered to be a sequence of name elements and is joined to form a path string. The details as to how the Strings are joined is provider specific but typically they will be joined using the name-separator as the separator. For example, if the name separator is "/" and getPath("/foo","bar","gus") is invoked, then the path string "/foo/bar/gus" is converted to a Path. A Path representing an empty path is returned if first is the empty string and more does not contain any non-empty strings. The Path is obtained by invoking the getPath method of the default FileSystem. Note that while this method is very convenient, using it will imply an assumed reference to the default FileSystem and limit the utility of the calling code. Hence it should not be used in library code intended for flexible reuse. A more flexible alternative is to use an existing Path instance as an anchor, such as:

Path dir = ...
Path path = dir.resolve("file");

Java reference for java.nio.file.Path.of.

Applies to