Modifier and Type | Field | Description |
---|---|---|
static Path |
ROOT |
|
static java.lang.String |
SEPARATOR |
Modifier and Type | Method | Description |
---|---|---|
java.lang.String |
absolutePath(java.lang.String path) |
Resolves the given name relative to this path.
|
Path |
absolutePath(Path path) |
|
Path |
append(Path path) |
Appends the supplied path to this path, returning the new path.
|
Path |
child(java.lang.String name) |
Creates a child of this path with the given name.
|
int |
compareTo(Path other) |
|
boolean |
equals(java.lang.Object o) |
|
java.lang.String |
getName() |
Returns the base name of this path, or null if this path is the root path.
|
Path |
getParent() |
Returns the parent of this path, or null if this path has no parent.
|
java.lang.String |
getPath() |
|
int |
hashCode() |
|
boolean |
isAbsolute() |
|
static Path |
path(java.lang.String path) |
|
java.lang.String |
relativePath(java.lang.String path) |
Calculates a path relative to this path.
|
Path |
relativePath(Path path) |
|
Path |
removeFirstSegments(int n) |
|
java.lang.String |
segment(int index) |
|
int |
segmentCount() |
|
Path |
takeFirstSegments(int n) |
Returns a
Path containing only the first n segments of this Path . |
java.lang.String |
toString() |
public static final Path ROOT
public static final java.lang.String SEPARATOR
public static Path path(@Nullable java.lang.String path)
public java.lang.String toString()
toString
in class java.lang.Object
public Path append(Path path)
path(':a:b').append(path(':c:d')) == path(':a:b:c:d') path(':a:b').append(path('c:d')) == path(':a:b:c:d') path('a:b').append(path(':c:d')) == path('a:b:c:d') path('a:b').append(path('c:d')) == path('a:b:c:d')
public java.lang.String getPath()
public boolean equals(@Nullable java.lang.Object o)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
public int compareTo(Path other)
compareTo
in interface java.lang.Comparable<Path>
@Nullable public Path getParent()
@Nullable public java.lang.String getName()
public Path child(java.lang.String name)
public java.lang.String absolutePath(java.lang.String path)
public boolean isAbsolute()
public java.lang.String relativePath(java.lang.String path)
public int segmentCount()
public Path removeFirstSegments(int n)
public java.lang.String segment(int index)
@Incubating public Path takeFirstSegments(int n)
Path
containing only the first n
segments of this Path
.
The returned Path
will be absolute if this Path
is absolute.n
- number of segments to take from this Path, must be greater than or equal to 1