public class Path extends Object implements Comparable<Path>, java.io.Serializable, java.io.ObjectInputValidation
Taken from https://github.com/apache/hadoop/blob/branch-3.3 .4/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/Path.java
| 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 components.
|
Path(java.net.URI aUri)
Construct a path from a URI
|
| Modifier and Type | Method and Description |
|---|---|
int |
compareTo(Path o) |
boolean |
equals(Object o) |
String |
getName()
Returns the final component of this path.
|
static String |
getName(String pathString) |
Path |
getParent()
Returns the parent of a path or null if at root.
|
int |
hashCode() |
boolean |
isAbsolute()
Returns true if the path component (i.e.
|
boolean |
isRoot()
Returns true if and only if this path represents the root of a file system.
|
boolean |
isUriPathAbsolute()
Returns true if the path component (i.e.
|
String |
toString() |
java.net.URI |
toUri()
Convert this Path to a URI.
|
void |
validateObject()
Validate the contents of a deserialized Path, so as to defend against malicious object streams.
|
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)
throws IllegalArgumentException
pathString - the path stringIllegalArgumentExceptionpublic Path(java.net.URI aUri)
aUri - the source URIpublic Path(String scheme,
String authority,
String path)
scheme - the schemeauthority - the authoritypath - the pathpublic java.net.URI toUri()
public boolean isUriPathAbsolute()
public boolean isAbsolute()
isUriPathAbsolute().public boolean isRoot()
public String getName()
public Path getParent()
public String toString()
toString in class Objectpublic boolean equals(Object o)
equals in class Objectpublic int hashCode()
hashCode in class Objectpublic void validateObject()
throws java.io.InvalidObjectException
validateObject in interface java.io.ObjectInputValidationjava.io.InvalidObjectException - if there's no URIpublic static String getName(String pathString)