@Public public class Path extends Object implements Comparable<Path>, Serializable
FileIO
. Path strings use slash as the directory separator.Modifier and Type | Field and Description |
---|---|
static String |
CUR_DIR
The current directory, ".".
|
static String |
SEPARATOR
The directory separator, a slash.
|
static char |
SEPARATOR_CHAR
The directory separator, a slash, as a character.
|
static boolean |
WINDOWS
Whether the current host is a Windows machine.
|
Constructor and Description |
---|
Path(Path parent,
Path child)
Create a new Path based on the child path resolved against the parent path.
|
Path(Path parent,
String child)
Create a new Path based on the child path resolved against the parent path.
|
Path(String pathString)
Construct a path from a String.
|
Path(String parent,
Path child)
Create a new Path based on the child path resolved against the parent path.
|
Path(String parent,
String child)
Create a new Path based on the child path resolved against the parent path.
|
Path(String scheme,
String authority,
String path)
Construct a Path from a scheme, an authority and a path string.
|
Path(URI aUri)
Construct a path from a URI.
|
Modifier and Type | Method and Description |
---|---|
int |
compareTo(Path that) |
Path |
createTempPath()
Create a temporary path (to be used as a copy) for this path.
|
boolean |
equals(Object o) |
String |
getName()
Returns the final component of this path, i.e., everything that follows the last separator.
|
Path |
getParent()
Returns the parent of a path or null if at root.
|
int |
hashCode() |
String |
toString() |
URI |
toUri()
Convert this Path to a URI.
|
public static final String SEPARATOR
public static final char SEPARATOR_CHAR
public static final String CUR_DIR
public static final boolean WINDOWS
public Path(String parent, String child)
parent
- the parent pathchild
- the child pathpublic Path(Path parent, String child)
parent
- the parent pathchild
- the child pathpublic Path(String parent, Path child)
parent
- the parent pathchild
- the child pathpublic Path(Path parent, Path child)
parent
- the parent pathchild
- the child pathpublic Path(String pathString)
pathString
- the path stringpublic Path(URI aUri)
aUri
- the source URIpublic URI toUri()
public String getName()
public Path createTempPath()
public Path getParent()
public int compareTo(Path that)
compareTo
in interface Comparable<Path>
Copyright © 2023–2024 The Apache Software Foundation. All rights reserved.