Modifier and Type | Field and Description |
---|---|
static Path |
defaultPath |
static FilePath |
userDirPath
This is equivalent to the System
"user.dir" property. |
Modifier | Constructor and Description |
---|---|
protected |
Path() |
Modifier and Type | Method and Description |
---|---|
static Path |
coerceToPathOrNull(java.lang.Object path) |
static Path |
currentPath() |
boolean |
delete() |
boolean |
exists() |
Path |
getAbsolute() |
java.lang.String |
getAuthority() |
Path |
getCanonical() |
java.lang.CharSequence |
getCharContent(boolean ignoreEncodingErrors) |
long |
getContentLength() |
Path |
getDirectory() |
java.lang.String |
getExtension() |
java.lang.String |
getFragment() |
java.lang.String |
getHost() |
java.lang.String |
getLast() |
abstract long |
getLastModified() |
java.lang.String |
getName() |
Path |
getParent() |
abstract java.lang.String |
getPath() |
int |
getPort() |
java.lang.String |
getQuery() |
abstract java.lang.String |
getScheme() |
java.lang.String |
getUserInfo() |
abstract boolean |
isAbsolute() |
boolean |
isDirectory()
Does this path name a directory?
The default implementation returns true only if the path ends
with '/' or the separatorChar.
|
abstract java.io.InputStream |
openInputStream() |
static java.io.InputStream |
openInputStream(java.lang.Object uri) |
abstract java.io.OutputStream |
openOutputStream() |
java.io.Reader |
openReader(boolean ignoreEncodingErrors) |
java.io.Writer |
openWriter() |
java.lang.String |
probeContentType() |
static java.lang.String |
relativize(java.lang.String in,
java.lang.String base)
Convert an absolute URI to one relatve to a given base.
|
Path |
resolve(Path relative) |
abstract Path |
resolve(java.lang.String relative) |
static void |
setCurrentPath(Path path) |
java.nio.file.Path |
toNPath()
Convert if possible to a
java.nio.file.Path instance. |
abstract java.net.URI |
toUri() |
java.net.URI |
toURI() |
java.lang.String |
toURIString() |
abstract java.net.URL |
toURL() |
static java.net.URL |
toURL(java.lang.String str) |
static int |
uriSchemeLength(java.lang.String uri)
Helper routine to get the scheme part of a URI.
|
static boolean |
uriSchemeSpecified(java.lang.String name)
Tests if a URL has a scheme.
|
static Path |
valueOf(java.lang.Object arg) |
public static final FilePath userDirPath
"user.dir"
property.
However, the getProperty is tracked dynamically and resolved
as needed.public static Path defaultPath
public static Path currentPath()
public static void setCurrentPath(Path path)
public static Path coerceToPathOrNull(java.lang.Object path)
public static Path valueOf(java.lang.Object arg)
public static java.net.URL toURL(java.lang.String str)
public static int uriSchemeLength(java.lang.String uri)
public static boolean uriSchemeSpecified(java.lang.String name)
public abstract boolean isAbsolute()
public boolean isDirectory()
public boolean delete()
delete
in interface javax.tools.FileObject
public boolean exists()
public abstract long getLastModified()
getLastModified
in interface javax.tools.FileObject
public long getContentLength()
public abstract java.lang.String getScheme()
public java.lang.String getAuthority()
public java.lang.String getUserInfo()
public java.lang.String getHost()
public abstract java.lang.String getPath()
public Path getDirectory()
public Path getParent()
public java.lang.String getLast()
public java.lang.String getExtension()
public int getPort()
public java.lang.String getQuery()
public java.lang.String getFragment()
public abstract java.net.URL toURL()
public abstract java.net.URI toUri()
toUri
in interface javax.tools.FileObject
public final java.net.URI toURI()
public java.lang.String toURIString()
public abstract Path resolve(java.lang.String relative)
public static java.io.InputStream openInputStream(java.lang.Object uri) throws java.io.IOException
java.io.IOException
public abstract java.io.InputStream openInputStream() throws java.io.IOException
openInputStream
in interface javax.tools.FileObject
java.io.IOException
public abstract java.io.OutputStream openOutputStream() throws java.io.IOException
openOutputStream
in interface javax.tools.FileObject
java.io.IOException
public java.io.Reader openReader(boolean ignoreEncodingErrors) throws java.io.IOException
openReader
in interface javax.tools.FileObject
java.io.IOException
public java.io.Writer openWriter() throws java.io.IOException
openWriter
in interface javax.tools.FileObject
java.io.IOException
public java.lang.CharSequence getCharContent(boolean ignoreEncodingErrors) throws java.io.IOException
getCharContent
in interface javax.tools.FileObject
java.io.IOException
public static java.lang.String relativize(java.lang.String in, java.lang.String base) throws java.net.URISyntaxException, java.io.IOException
java.net.URISyntaxException
java.io.IOException
public java.lang.String getName()
getName
in interface javax.tools.FileObject
public Path getAbsolute()
public Path getCanonical()
public java.nio.file.Path toNPath() throws java.nio.file.FileSystemNotFoundException
java.nio.file.Path
instance.
Use caution if this is a relative path and the currentPath()
is not the default path, since java.nio
assumes a relative path
is relative to the default directory.
Uses java.nio.file.Paths#get(URI)
, and thus
throws whatever that method throws.FileSystemNotFoundException
- - no nio file system provider
was found for the URI schemepublic java.lang.String probeContentType()