|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.qedeq.base.io.Path
public final class Path
A file path that leads to a directory or file and is absolute or relative. This abstraction of a file location was done to create relative file paths. This class makes some assumptions about a file path: "/" is the directory separator, "/" is also the root directory and ".." specifies the parent directory. "." is the current directory. A directory path must end with a "/" if a path ends not with a "/" it will be a file path (but the empty path "" is a directory).
Constructor Summary | |
---|---|
Path(java.lang.String filePath)
Create file with given path and name. |
|
Path(java.lang.String[] dirNames,
java.lang.String fileName)
Create file with given path and name. |
|
Path(java.lang.String dirPath,
java.lang.String fileName)
Create file with given path and name. |
Method Summary | |
---|---|
Path |
createRelative(java.lang.String filePath)
Create new file path relative to given one. |
boolean |
equals(java.lang.Object obj)
|
java.lang.String |
getDirectory()
Get directory of this path. |
java.lang.String |
getFileName()
Get filename. |
int |
hashCode()
|
boolean |
isAbsolute()
Is this an absolute path? If first path directory name is empty or ends with ":" (MS windows tribute) this is the case. |
boolean |
isDirectory()
Describes this path a directory? |
boolean |
isFile()
Describes this path a file (and not a directory)? |
boolean |
isRelative()
Is this a relative path? |
java.lang.String |
toString()
|
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public Path(java.lang.String filePath)
filePath
- Path to file with "/" as directory name separator. Relative directories
are removed from the file path if possible. Must not be
null
. Might be "" this is called the empty path.public Path(java.lang.String dirPath, java.lang.String fileName)
dirPath
- Directory path to file with "/" as directory name separator.
This value can end with a "/" but it must not be null
.fileName
- File name. It should not contain "/" but this is not checked.public Path(java.lang.String[] dirNames, java.lang.String fileName)
dirNames
- Directory names. If this is an absolute path the first
name is empty. Must not be null
.fileName
- File name. It should not contain "/" but this is not checked.Method Detail |
---|
public Path createRelative(java.lang.String filePath)
filePath
is a relative path it will return filePath
.
filePath
- Path to file relative to this
.
public boolean isDirectory()
public boolean isFile()
public boolean isAbsolute()
public boolean isRelative()
public java.lang.String getFileName()
null
.public java.lang.String getDirectory()
public java.lang.String toString()
toString
in class java.lang.Object
public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |