A generalized path/location, including File and URIs.
coerceToPathOrNull
public static Path coerceToPathOrNull(Object path)
currentPath
public static Path currentPath()
exists
public boolean exists()
getAbsolute
public Path getAbsolute()
getAuthority
public String getAuthority()
getCanonical
public Path getCanonical()
getContentLength
public long getContentLength()
getDirectory
public Path getDirectory()
getExtension
public String getExtension()
getFragment
public String getFragment()
getHost
public String getHost()
getLast
public String getLast()
getLastModified
public abstract long getLastModified()
getParent
public Path getParent()
getPath
public abstract String getPath()
getPort
public int getPort()
getQuery
public String getQuery()
getScheme
public abstract String getScheme()
getUserInfo
public String getUserInfo()
isAbsolute
public abstract boolean isAbsolute()
isDirectory
public boolean isDirectory()
Does this path name a directory?
The default implementation returns true only if the path ends
with '/' or the separatorChar.
openInputStream
public abstract InputStream openInputStream()
throws IOException
openInputStream
public static InputStream openInputStream(Object uri)
throws IOException
openOutputStream
public abstract OutputStream openOutputStream()
throws IOException
relativize
public static String relativize(String in,
String base)
throws java.net.URISyntaxException,
java.io.IOException
Convert an absolute URI to one relatve to a given base.
This goes beyond java.net.URI.relativize in that if the arguments
have a common prefix, it can create a relative URI using "../" steps.
resolve
public abstract Path resolve(String relative)
resolve
public Path resolve(Path relative)
setCurrentPath
public static void setCurrentPath(Path path)
toURI
public abstract URI toURI()
toURIString
public String toURIString()
toURL
public abstract URL toURL()
toURL
public static URL toURL(String str)
uriSchemeLength
public static int uriSchemeLength(String uri)
Helper routine to get the scheme part of a URI.
The scheme part is "http:" or "file:" or "ftp:" most commonly.
This functions searches for the first ':' that doesn't follow a '/'.
- The length of the scheme component, not counting the colon,
(or alternatively the index of the colon), or -1 if the is no scheme.
uriSchemeSpecified
public static boolean uriSchemeSpecified(String name)
Tests if a URL has a scheme.
For convenience, we treat a 1-character "scheme" as an
MS-DOS-style "drive letter" - i.e. not a scheme.
valueOf
public static Path valueOf(Object arg)