p2pMapReduce.mapreduceModule
Class Path

java.lang.Object
  extended by p2pMapReduce.mapreduceModule.Path
All Implemented Interfaces:
java.lang.Comparable

public class Path
extends java.lang.Object
implements java.lang.Comparable

Names a file or directory in a FileSystem. Path strings use slash as the directory separator. A path string is absolute if it begins with a slash.


Field Summary
static java.lang.String CUR_DIR
           
static java.lang.String SEPARATOR
          The directory separator, a slash.
static char SEPARATOR_CHAR
           
 
Constructor Summary
Path(Path parent, Path child)
          Resolve a child path against a parent path.
Path(Path parent, java.lang.String child)
          Resolve a child path against a parent path.
Path(java.lang.String pathString)
          Construct a path from a String.
Path(java.lang.String parent, Path child)
          Resolve a child path against a parent path.
Path(java.lang.String parent, java.lang.String child)
          Resolve a child path against a parent path.
Path(java.lang.String scheme, java.lang.String authority, java.lang.String path)
          Construct a Path from components.
Path(java.net.URI aUri)
          Construct a path from a URI
 
Method Summary
 int compareTo(java.lang.Object o)
           
 int depth()
          Return the number of elements in this path.
 boolean equals(java.lang.Object o)
           
 java.lang.String getName()
          Returns the final component of this path.
 Path getParent()
          Returns the parent of a path or null if at root.
 int hashCode()
           
 boolean isAbsolute()
          There is some ambiguity here.
 boolean isUriPathAbsolute()
          True if the path component (i.e. directory) of this URI is absolute.
 Path makeQualified(java.net.URI defaultUri, Path workingDir)
          Returns a qualified path object.
 Path suffix(java.lang.String suffix)
          Adds a suffix to the final name in the path.
 java.lang.String toString()
           
 java.net.URI toUri()
          Convert this to a URI.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

SEPARATOR

public static final java.lang.String SEPARATOR
The directory separator, a slash.

See Also:
Constant Field Values

SEPARATOR_CHAR

public static final char SEPARATOR_CHAR
See Also:
Constant Field Values

CUR_DIR

public static final java.lang.String CUR_DIR
See Also:
Constant Field Values
Constructor Detail

Path

public Path(java.lang.String parent,
            java.lang.String child)
Resolve a child path against a parent path.


Path

public Path(Path parent,
            java.lang.String child)
Resolve a child path against a parent path.


Path

public Path(java.lang.String parent,
            Path child)
Resolve a child path against a parent path.


Path

public Path(Path parent,
            Path child)
Resolve a child path against a parent path.


Path

public Path(java.lang.String pathString)
Construct a path from a String. Path strings are URIs, but with unescaped elements and some additional normalization.


Path

public Path(java.net.URI aUri)
Construct a path from a URI


Path

public Path(java.lang.String scheme,
            java.lang.String authority,
            java.lang.String path)
Construct a Path from components.

Method Detail

toUri

public java.net.URI toUri()
Convert this to a URI.


isUriPathAbsolute

public boolean isUriPathAbsolute()
True if the path component (i.e. directory) of this URI is absolute.


isAbsolute

public boolean isAbsolute()
There is some ambiguity here. An absolute path is a slash relative name without a scheme or an authority. So either this method was incorrectly named or its implementation is incorrect.


getName

public java.lang.String getName()
Returns the final component of this path.


getParent

public Path getParent()
Returns the parent of a path or null if at root.


suffix

public Path suffix(java.lang.String suffix)
Adds a suffix to the final name in the path.


toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

equals

public boolean equals(java.lang.Object o)
Overrides:
equals in class java.lang.Object

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

compareTo

public int compareTo(java.lang.Object o)
Specified by:
compareTo in interface java.lang.Comparable

depth

public int depth()
Return the number of elements in this path.


makeQualified

public Path makeQualified(java.net.URI defaultUri,
                          Path workingDir)
Returns a qualified path object.