@InterfaceAudience.Private @InterfaceStability.Unstable public class PathData extends Object implements Comparable<PathData>
Modifier and Type | Class and Description |
---|---|
protected static class |
PathData.FileTypeRequirement |
protected static class |
PathData.PathType |
Modifier and Type | Field and Description |
---|---|
boolean |
exists |
FileSystem |
fs |
Path |
path |
FileStatus |
stat |
protected URI |
uri |
Constructor and Description |
---|
PathData(String pathString,
Configuration conf)
Creates an object to wrap the given parameters as fields.
|
PathData(URI localPath,
Configuration conf)
Creates an object to wrap the given parameters as fields.
|
Modifier and Type | Method and Description |
---|---|
int |
compareTo(PathData o) |
boolean |
equals(Object o) |
static PathData[] |
expandAsGlob(String pattern,
Configuration conf)
Expand the given path as a glob pattern.
|
PathData[] |
getDirectoryContents()
Returns a list of PathData objects of the items contained in the given
directory.
|
PathData |
getPathDataForChild(PathData child)
Creates a new object for a child entry in this directory
|
int |
hashCode() |
boolean |
parentExists()
Test if the parent directory exists
|
FileStatus |
refreshStatus()
Updates the paths's file status
|
boolean |
representsDirectory()
Check if the path represents a directory as determined by the basename
being "." or "..", or the path ending with a directory separator
|
PathData |
suffix(String extension)
Returns a new PathData with the given extension.
|
File |
toFile()
Get the path to a local file
|
String |
toString()
Returns the printable version of the path that is either the path
as given on the commandline, or the full path
|
protected final URI uri
public final FileSystem fs
public final Path path
public FileStatus stat
public boolean exists
public PathData(String pathString, Configuration conf) throws IOException
pathString
- a string for a pathconf
- the configuration fileIOException
- if anything goes wrong...public PathData(URI localPath, Configuration conf) throws IOException
localPath
- a local URIconf
- the configuration fileIOException
- if anything goes wrong...public FileStatus refreshStatus() throws IOException
IOException
- if anything goes wrong...public PathData suffix(String extension) throws IOException
extension
- for the suffixIOException
- shouldn't happenpublic boolean parentExists() throws IOException
IOException
- upon unexpected errorpublic boolean representsDirectory()
public PathData[] getDirectoryContents() throws IOException
IOException
- if anything else goes wrong...public PathData getPathDataForChild(PathData child) throws IOException
child
- the basename will be appended to this object's pathIOException
- if this object does not exist or is not a directorypublic static PathData[] expandAsGlob(String pattern, Configuration conf) throws IOException
pattern
- the pattern to expand as a globconf
- the hadoop configurationPathData
objects. if the pattern is not a glob,
and does not exist, the list will contain a single PathData with a null
statIOException
- anything else goes wrong...public String toString()
public File toFile()
IllegalArgumentException
- if this.fs is not the LocalFileSystempublic int compareTo(PathData o)
compareTo
in interface Comparable<PathData>
Copyright © 2013 Apache Software Foundation. All rights reserved.