| java.lang.Object com.ecyrd.jspwiki.dav.DavPath
DavPath | public class DavPath (Code) | | The DavPath represents an abstract path to any resource within the WebDav
system. Since the file tree displayed by the DAV storage may be different
from the actual representation, this component is needed.
You instantiate a new DavPath simply by saying
DavPath dp = new DavPath("/path/to/my/object");
If the path ends in a slash, it is understood to be a directory. If not,
it represents a file.
author: jalkanen |
Constructor Summary | |
public | DavPath(DavPath dp) Creates a new DavPath from an old one. | public | DavPath(String path) Creates a new DavPath object. |
Method Summary | |
public void | append(DavPath dp) Adds another path to the end of this path. | public void | append(String path) Adds another path to the end of this path. | public String | filePart() Returns the file part of the DavPath. | public String | get(int idx) Returns the 'idx' component of the path, zero being the first component. | public String | getName() Returns the name of the last component of the DavPath. | public String | getPath() Returns the entire path as a String. | public boolean | isDirectory() Returns true, if the path represents a directory. | public boolean | isRoot() Returns true, if the path represents the top-level entity. | public int | length() Exactly equivalent to size(). | public String | pathPart() Returns the directory part of the DavPath. | public int | size() Exactly equivalent to length(). | public DavPath | subPath(int idx) Returns a new DavPath object that is a sub-path of this path. | public String | toString() Returns a human-readable version of the path. |
DavPath | public DavPath(DavPath dp)(Code) | | Creates a new DavPath from an old one.
Parameters: dp - the dav path |
DavPath | public DavPath(String path)(Code) | | Creates a new DavPath object. The path parameter should be
an arbitrary string with components separated with slashes.
Parameters: path - |
append | public void append(DavPath dp)(Code) | | Adds another path to the end of this path.
Parameters: dp - the current dav path |
append | public void append(String path)(Code) | | Adds another path to the end of this path. The "path" parameter
may contain a slash-separated path (e.g. "foo/bar/blog.txt").
Parameters: path - the current dav path |
filePart | public String filePart()(Code) | | Returns the file part of the DavPath. The method returns the last component
of the path, unless the path is a directory, in which case it returns an
empty string.
the file name, or an empty string |
get | public String get(int idx)(Code) | | Returns the 'idx' component of the path, zero being the first component.
If there is no such component,
it will simply return null.
Parameters: idx - The component to return. Zero is the first element. A part of the path. |
getName | public String getName()(Code) | | Returns the name of the last component of the DavPath. This is either
the name of a directory, or the name of a file.
the name of the right-most portion of the dav path |
getPath | public String getPath()(Code) | | Returns the entire path as a String.
the entire dav path |
isDirectory | public boolean isDirectory()(Code) | | Returns true, if the path represents a directory.
true if the path is a directory; false otherwise |
isRoot | public boolean isRoot()(Code) | | Returns true, if the path represents the top-level entity. This is true,
if the path is "/" or it is empty.
True or false. |
length | public int length()(Code) | | Exactly equivalent to size(). I'm too lazy to remember whether it's length() or size(),
so I'll provide both...
the size of the path |
pathPart | public String pathPart()(Code) | | Returns the directory part of the DavPath.
the directory portion of the path |
size | public int size()(Code) | | Exactly equivalent to length().
The length of the path. |
subPath | public DavPath subPath(int idx)(Code) | | Returns a new DavPath object that is a sub-path of this path. E.g. if
the path is "/foo/bar/blog.txt", subPath(1) would return "bar/blog.txt".
Notice that the resulting path is not absolute in this case.
Parameters: idx - Start from this part. A sub-path of this path. |
toString | public String toString()(Code) | | Returns a human-readable version of the path. Please use getPath() instead
of toString(), as this method is only good for debugging purposes.
the String representation of the path |
|
|