@Stringable @InterfaceAudience.Public @InterfaceStability.Stable 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 |
CUR_DIR |
static String |
SEPARATOR
The directory separator, a slash.
|
static char |
SEPARATOR_CHAR |
static boolean |
WINDOWS |
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.
|
Path(URI aUri)
Construct a path from a URI
|
Modifier and Type | Method and Description |
---|---|
int |
compareTo(Object o) |
int |
depth()
Return the number of elements in this path.
|
boolean |
equals(Object o) |
FileSystem |
getFileSystem(Configuration conf)
Return the FileSystem that owns this Path.
|
String |
getName()
Returns the final component of this path.
|
Path |
getParent()
Returns the parent of a path or null if at root.
|
static Path |
getPathWithoutSchemeAndAuthority(Path path) |
int |
hashCode() |
boolean |
isAbsolute()
There is some ambiguity here.
|
boolean |
isAbsoluteAndSchemeAuthorityNull()
Is an absolute path (ie a slash relative path part)
AND a scheme is null AND authority is null.
|
boolean |
isRoot() |
boolean |
isUriPathAbsolute()
True if the path component (i.e.
|
static boolean |
isWindowsAbsolutePath(String pathString,
boolean slashed)
Determine whether a given path string represents an absolute path on
Windows.
|
Path |
makeQualified(FileSystem fs)
Deprecated.
|
static Path |
mergePaths(Path path1,
Path path2)
Merge 2 paths such that the second path is appended relative to the first.
|
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 static final String CUR_DIR
public static final boolean WINDOWS
public Path(String pathString) throws IllegalArgumentException
IllegalArgumentException
public static Path getPathWithoutSchemeAndAuthority(Path path)
public static Path mergePaths(Path path1, Path path2)
path1
- Path first pathpath2
- Path second path, to be appended relative to path1public static boolean isWindowsAbsolutePath(String pathString, boolean slashed)
pathString
- Supplies the path string to evaluate.slashed
- true if the given path is prefixed with "/".public FileSystem getFileSystem(Configuration conf) throws IOException
IOException
public boolean isAbsoluteAndSchemeAuthorityNull()
public boolean isUriPathAbsolute()
public boolean isAbsolute()
public boolean isRoot()
public int compareTo(Object o)
compareTo
in interface Comparable
public int depth()
@Deprecated public Path makeQualified(FileSystem fs)
makeQualified(URI, Path)
Copyright © 2016 Apache Software Foundation. All rights reserved.