|
Purple Code | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Object | +--com.purpletech.util.Path
File name parser. Immutable. Always uses '/' as separator. Directories must always end with '/' or they're considered files, with possible bad effect wrt creating relative paths and figuring out parents.
path = "/foo/bar/baz.gif" -> parent = "/foo/bar/" name = "baz.gif" base = "baz" ext = "gif"
| Constructor Summary | |
Path(java.io.File f)
make a new path from the given File. |
|
Path(Path f,
java.lang.String s)
make a new path relative to the given path |
|
Path(java.lang.String fullpath)
make a new path. |
|
| Method Summary | |
java.lang.String |
getBase()
|
java.lang.String |
getExt()
|
java.lang.String |
getName()
|
java.lang.String |
getParent()
|
java.lang.String |
getPath()
|
java.lang.String |
getPathTo(Path target)
Get a string representing the path from this path to the given path (or rather, from the directory of this path) |
java.lang.String |
getPathTo(java.lang.String target)
|
protected void |
init(java.lang.String fullpath)
|
boolean |
isAbsolute()
|
boolean |
isDirectory()
|
static void |
main(java.lang.String[] args)
|
boolean |
makeUnique(java.io.File dir)
make a unique file name in a given directory |
Path |
toDirectory()
|
java.io.File |
toFile()
|
java.lang.String |
toParts()
|
java.lang.String |
toString()
|
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
public Path(Path f,
java.lang.String s)
throws BadPathException
public Path(java.io.File f)
throws BadPathException
public Path(java.lang.String fullpath)
throws BadPathException
| Method Detail |
protected void init(java.lang.String fullpath)
throws BadPathException
BadPathExceptionpublic java.lang.String getPath()
public java.lang.String getParent()
public java.lang.String getName()
public java.lang.String getBase()
public java.lang.String getExt()
public boolean isDirectory()
public boolean isAbsolute()
public java.lang.String getPathTo(java.lang.String target)
throws BadPathException
BadPathExceptionpublic java.lang.String getPathTo(Path target)
e.g. from "foo/bar/com/jguru/meats" to "foo/bar/com/microsoft/vegetables" => "../../microsoft/vegetables"
Does the right thing (hopefully) with file-to-directory and so forth
target - another pathpublic boolean makeUnique(java.io.File dir)
public java.lang.String toString()
toString in class java.lang.Objectpublic java.lang.String toParts()
public Path toDirectory()
throws BadPathException
BadPathExceptionpublic java.io.File toFile()
public static void main(java.lang.String[] args)
throws BadPathException
BadPathException
|
Documentation generated March 5 2003 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||