public class Path extends Object implements Comparable
FileSystem
.
Path strings use slash as the directory separator. A path string is
absolute if it begins with a slash.Modifier and Type | Field and Description |
---|---|
static String |
SEPARATOR
The directory separator, a slash.
|
static char |
SEPARATOR_CHAR |
Constructor and Description |
---|
Path(Path parent,
Path child)
Resolve a child path against a parent path.
|
Path(Path parent,
String child)
Resolve a child path against a parent path.
|
Path(String pathString)
Construct a path from a String.
|
Path(String parent,
Path child)
Resolve a child path against a parent path.
|
Path(String parent,
String child)
Resolve a child path against a parent path.
|
Path(String scheme,
String authority,
String path)
Construct a Path from components.
|
Modifier and Type | Method and Description |
---|---|
int |
compareTo(Object o) |
int |
depth()
Return the number of elements in this path.
|
boolean |
equals(Object o) |
String |
getName()
Returns the final component of this path.
|
Path |
getParent()
Returns the parent of a path or null if at root.
|
int |
hashCode() |
boolean |
isAbsolute()
True if the directory of this path is absolute.
|
Path |
suffix(String suffix)
Adds a suffix to the final name in the path.
|
String |
toString() |
URI |
toUri()
Convert this to a URI.
|
public static final String SEPARATOR
public static final char SEPARATOR_CHAR
public Path(String pathString)
public URI toUri()
public boolean isAbsolute()
public String getName()
public Path getParent()
public int compareTo(Object o)
compareTo
in interface Comparable
public int depth()
Copyright © 2007, 2017, Oracle and/or its affiliates. All rights reserved.