|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnet.ponder2.Path
public class Path
A path manipulation library. Handles Unix style path names and can index separate parts of the path, extract parts of the path and normalise pathnames.
Field Summary | |
---|---|
static java.lang.String |
DOT
Default string for the current directory/domain |
static java.lang.String |
DOTDOT
Default string for a parent directory/domain |
static java.lang.String |
ROOT
Default string for the root |
static java.lang.String |
SLASH
Default string for a path separator |
Constructor Summary | |
---|---|
Path(Path path)
creates a new Path as a copy of another Path |
|
Path(Path path,
java.lang.String extra)
creates a new Path as a concatenation of a Path and a String joined with a SLASH |
|
Path(java.lang.String path)
creates a new Path based on a String value |
Method Summary | |
---|---|
void |
add(java.lang.String path)
adds a component to the end of the Path. |
java.lang.String |
child()
Returns the child part of the Path as a String |
void |
clear()
clears the content of the Path |
java.lang.Object |
clone()
|
java.lang.String |
head(int index)
returns beginning n elements of the path. |
boolean |
isAbsolute()
Checks whether the path starts from the root |
boolean |
isComplete()
Checks whether the path is complete or goes up from the current element |
boolean |
isRelative()
Checks whether the path starts from the current domain |
java.util.Iterator<java.lang.String> |
iterator()
|
Path |
parent()
Returns a new Path being the parent of the current one |
void |
set(java.lang.String path)
sets the Path to be the same as a String |
int |
size()
returns the number of elements in the path |
java.lang.String |
subpath(int start)
returns a subset of the path from the n'th element to the end. |
java.lang.String |
subpath(int start,
int end)
returns a subset of the path indexed by the start element and the end element |
java.lang.String |
tail(int index)
returns the last n elements of the Path. |
java.lang.String |
toString()
|
Methods inherited from class java.lang.Object |
---|
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final java.lang.String DOT
public static final java.lang.String SLASH
public static final java.lang.String ROOT
public static final java.lang.String DOTDOT
Constructor Detail |
---|
public Path(java.lang.String path)
path
- the String pathnamepublic Path(Path path)
path
- the Path to be copiedpublic Path(Path path, java.lang.String extra)
path
- the first component of the pathnameextra
- the last component of the pathnameMethod Detail |
---|
public java.lang.Object clone() throws java.lang.CloneNotSupportedException
clone
in class java.lang.Object
java.lang.CloneNotSupportedException
public void clear()
public boolean isComplete()
public boolean isRelative()
public boolean isAbsolute()
public java.util.Iterator<java.lang.String> iterator()
iterator
in interface java.lang.Iterable<java.lang.String>
public Path parent()
public java.lang.String child()
public void set(java.lang.String path)
path
- the new full pathnamepublic void add(java.lang.String path)
path
- public int size()
public java.lang.String head(int index)
index
- the number of elements to return
public java.lang.String tail(int index)
index
- the number of elements to return
public java.lang.String subpath(int start)
start
- the first element to copy
public java.lang.String subpath(int start, int end)
start
- the index of the first element of the substringend
- the index of the last element of the substring
public java.lang.String toString()
toString
in class java.lang.Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |