|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.jetspeed.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 | |
---|---|
private String |
baseName
|
private static HashMap |
childrenMap
|
private static String[] |
EMPTY_SEGMENTS
|
private String |
fileExtension
|
private String |
fileName
|
private int |
hashCode
|
private String |
path
|
static String |
PATH_SEPERATOR
|
private String |
queryString
|
private String[] |
segments
|
private static long |
serialVersionUID
The serial version uid. |
Constructor Summary | |
---|---|
|
Path()
|
private |
Path(Path parent)
|
private |
Path(Path parent,
String[] children,
boolean pathOnly)
|
private |
Path(Path parent,
String childSegment,
boolean pathOnly)
|
|
Path(String path)
|
private |
Path(String[] segments,
int offset,
int count)
|
Method Summary | |
---|---|
Path |
addSegment(String segment)
Adds this segment to the end of the path but before the current file segment, if one exists. |
private String |
buildPath()
|
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. |
private static String[] |
split(String str,
int start,
int length,
char separator)
|
private static String[] |
splitPath(String path)
|
String |
toString()
|
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
private static final long serialVersionUID
public static final String PATH_SEPERATOR
private static final String[] EMPTY_SEGMENTS
private static HashMap childrenMap
private final String path
private final String[] segments
private final String fileName
private final String baseName
private final String fileExtension
private final String queryString
private final int hashCode
Constructor Detail |
---|
public Path()
private Path(Path parent, String childSegment, boolean pathOnly)
private Path(Path parent, String[] children, boolean pathOnly)
private Path(Path parent)
private Path(String[] segments, int offset, int count)
public Path(String path)
Method Detail |
---|
private static String[] splitPath(String path)
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
private String buildPath()
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)
private static String[] split(String str, int start, int length, char separator)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |