Path.Of Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Overloads
| Name | Description |
|---|---|
| Of(URI) |
Obsolete.
Returns a |
| Of(String, String[]) |
Obsolete.
Creates a path in the default file system from one or more strings. |
Of(URI)
Caution
Use 'Java.Nio.FileNio.IPath.Of'. This class will be removed in a future release.
Returns a Path by converting a URI.
[Android.Runtime.Register("of", "(Ljava/net/URI;)Ljava/nio/file/Path;", "", ApiSince=34)]
[System.Obsolete("Use 'Java.Nio.FileNio.IPath.Of'. This class will be removed in a future release.")]
public static Java.Nio.FileNio.IPath? Of(Java.Net.URI? uri);
[<Android.Runtime.Register("of", "(Ljava/net/URI;)Ljava/nio/file/Path;", "", ApiSince=34)>]
[<System.Obsolete("Use 'Java.Nio.FileNio.IPath.Of'. This class will be removed in a future release.")>]
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[])
Caution
Use 'Java.Nio.FileNio.IPath.Of'. This class will be removed in a future release.
Creates a path in the default file system from one or more strings.
[Android.Runtime.Register("of", "(Ljava/lang/String;[Ljava/lang/String;)Ljava/nio/file/Path;", "", ApiSince=34)]
[System.Obsolete("Use 'Java.Nio.FileNio.IPath.Of'. This class will be removed in a future release.")]
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)>]
[<System.Obsolete("Use 'Java.Nio.FileNio.IPath.Of'. This class will be removed in a future release.")>]
static member Of : string * string[] -> Java.Nio.FileNio.IPath
Parameters
- first
- String
The path string, or the first part of the path when more parts are supplied.
- more
- String[]
Additional path strings to join with first.
Returns
A path that represents the combined path string.
- Attributes
Remarks
With no additional strings, first is the path string. Otherwise, the default file system provider joins the nonempty strings in first and more according to its path rules, usually with its name separator.
If all supplied strings are empty, the result is an empty path. Creating a path object does not create a file or directory.
This method uses the default file system. Code that must work with other file systems can instead resolve a path relative to an existing IPath.
This class is obsolete. Use Of(String, String[]) instead.
Java reference for java.nio.file.Path.of.