|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.hippoecm.hst.core.util.Path
public class Path
The Path object is used to standard used to standardize the creation of mutation of path-like structures. For: example /foo/bar/index.html.
Below are the rules for how the constructor interprets literal paths.
NOTE the addSegment(String)
interprets string
pathes in a somewhat different manner.
Literal Path | Interpretation | /foo/bar/index.html | foo and bar will be considered directory
segments while index.html will be considered a file segment.
This means that the baseName will be set to index and
the fileExtension will be set to .html |
---|---|
/foo/bar/, /foo/bar, foo/bar/ foo/bar |
I cases where a file has no extension you must use the
|
Field Summary | |
---|---|
static String |
PATH_SEPERATOR
|
Constructor Summary | |
---|---|
Path()
|
|
Path(String path)
|
Method Summary | |
---|---|
Path |
addSegment(String segment)
Adds this segment to the end of the path but before the current file segment, if one exists. |
boolean |
equals(Object obj)
|
String |
getBaseName()
|
Path |
getChild(Path childPath)
|
Path |
getChild(String childPath)
|
String |
getFileExtension()
|
String |
getFileName()
|
String |
getQueryString()
|
String |
getSegment(int i)
Returns the segement of the path at the specified index i . |
Path |
getSubPath(int beginAtSegment)
|
Path |
getSubPath(int beginAtSegment,
int endSegment)
|
int |
hashCode()
|
int |
length()
|
Path |
removeLastPathSegment()
Removes the last directory segment in this path. |
String |
toString()
|
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final String PATH_SEPERATOR
Constructor Detail |
---|
public Path()
public Path(String path)
Method Detail |
---|
public String getSegment(int i)
i
.
i
- index containing the segment to return.
i
ArrayIndexOutOfBoundsException
- if the index is not within the bounds of this Path.public Path addSegment(String segment)
Adds this segment to the end of the path but before the current file segment, if one exists. For consistency Segments added via this method are ALWAYS considered directories even when matching a standrad file pattern i.e. index.html
If you need to set the file segment, please use the setFileSegment() method.
segment
-
public Path getSubPath(int beginAtSegment)
public Path getSubPath(int beginAtSegment, int endSegment)
public String getBaseName()
public String getFileExtension()
public String getFileName()
public String getQueryString()
public int length()
public String toString()
toString
in class Object
public boolean equals(Object obj)
equals
in class Object
public int hashCode()
hashCode
in class Object
public Path removeLastPathSegment()
public Path getChild(String childPath)
public Path getChild(Path childPath)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |