Returns a URI to represent this path.
This method constructs an absolute {@link URI} with a {@link URI#getScheme() scheme} equal to the URI scheme that identifies theprovider. The exact form of the scheme specific part is highly provider dependent.
In the case of the default provider, the URI is hierarchical with a {@link URI#getPath() path} component that is absolute. The query andfragment components are undefined. Whether the authority component is defined or not is implementation dependent. There is no guarantee that the {@code URI} may be used to construct a {@link java.io.File java.io.File}. In particular, if this path represents a Universal Naming Convention (UNC) path, then the UNC server name may be encoded in the authority component of the resulting URI. In the case of the default provider, and the file exists, and it can be determined that the file is a directory, then the resulting {@code URI} will end with a slash.
The default provider provides a similar round-trip guarantee to the {@link java.io.File} class. For a given {@code Path} p itis guaranteed that
{@link Paths#get(URI) Paths.get}(p.toUri()).equals(p . {@link #toAbsolutePath() toAbsolutePath}())
so long as the original {@code Path}, the {@code URI}, and the new {@code Path} are all created in (possibly different invocations of) the sameJava virtual machine. Whether other providers make any guarantees is provider specific and therefore unspecified.
When a file system is constructed to access the contents of a file as a file system then it is highly implementation specific if the returned URI represents the given path in the file system or it represents a compound URI that encodes the URI of the enclosing file system. A format for compound URIs is not defined in this release; such a scheme may be added in a future release.
@return the URI representing this path
@throws java.io.IOError if an I/O error occurs obtaining the absolute path, or where a file system is constructed to access the contents of a file as a file system, and the URI of the enclosing file system cannot be obtained
@throws SecurityException In the case of the default provider, and a security manager is installed, the {@link #toAbsolutePath toAbsolutePath} methodthrows a security exception.