com.continuent.tungsten.common.file
Class FilePath

java.lang.Object
  extended by com.continuent.tungsten.common.file.FilePath

public class FilePath
extends java.lang.Object

Implements a class to manipulate generic file system path structures that can apply to any type of file system-like structure including Linux, Hadoop, and in future possibly Zookeeper.


Constructor Summary
FilePath()
          Construct a path with no arguments, which creates a root path.
FilePath(FilePath base)
          Constructs a path from an existing path.
FilePath(FilePath base, java.lang.String subpath)
          Constructs a path constructed from an existing path plus a string.
FilePath(java.util.List<java.lang.String> base, boolean absolute)
          Constructs a path from a list of elements and a flag to indicate whether it is absolute.
FilePath(java.lang.String path)
          Constructs a path from a string, which may be a full or partial path.
 
Method Summary
 FilePath append(FilePath subPath)
          Appends another path to end of this one.
 FilePath append(java.util.List<java.lang.String> subElements)
          Appends 0 or more path elements to the end.
 FilePath append(java.lang.String subPath)
          Appends a string, which may consist of one or more elements.
 java.lang.String element(int i)
          Returns the i'th element in the path.
 java.util.List<java.lang.String> elements()
          Returns the elements that compose the path.
 boolean equals(java.lang.Object other)
          Returns true if the argument is a FilePath instance and denotes the same location.
 boolean isAbsolute()
          Returns true if this is an absolute path.
 java.lang.String toString()
          Returns a full path with leading "/" if absolute.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

FilePath

public FilePath()
Construct a path with no arguments, which creates a root path.


FilePath

public FilePath(java.lang.String path)
Constructs a path from a string, which may be a full or partial path.


FilePath

public FilePath(java.util.List<java.lang.String> base,
                boolean absolute)
Constructs a path from a list of elements and a flag to indicate whether it is absolute.


FilePath

public FilePath(FilePath base)
Constructs a path from an existing path.


FilePath

public FilePath(FilePath base,
                java.lang.String subpath)
Constructs a path constructed from an existing path plus a string.

Method Detail

elements

public java.util.List<java.lang.String> elements()
Returns the elements that compose the path.


element

public java.lang.String element(int i)
Returns the i'th element in the path.


isAbsolute

public boolean isAbsolute()
Returns true if this is an absolute path.


append

public FilePath append(java.lang.String subPath)
Appends a string, which may consist of one or more elements.


append

public FilePath append(FilePath subPath)
Appends another path to end of this one.


append

public FilePath append(java.util.List<java.lang.String> subElements)
Appends 0 or more path elements to the end.


toString

public java.lang.String toString()
Returns a full path with leading "/" if absolute.

Overrides:
toString in class java.lang.Object
See Also:
Object.toString()

equals

public boolean equals(java.lang.Object other)
Returns true if the argument is a FilePath instance and denotes the same location.

Overrides:
equals in class java.lang.Object
See Also:
Object.equals(java.lang.Object)