file
URI for this File. The URI is System dependent and may not be transferable between different operating/file systems.
@return a file
URI for this File.
new URI (this.toString())
. Note, any URL instance that complies with RFC 2396 can be converted to a URI. However, some URLs that are not strictly in compliance can not be converted to a URI. @exception URISyntaxException if this URL is not formatted strictly according toto RFC2396 and cannot be converted to a URI. @return a URI instance equivalent to this URL. @since 1.5
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.
file:
URI that represents the external form of the given pathname. Will be an absolute URI if the given path is absolute.
This code doesn't handle non-ASCII characters properly.
@param path the path in the local file system @return the URI version of the local path. @since Ant 1.6
|
|
|
|
|
|
|
|
|
|
|
|