| Constructor and Description |
|---|
Path()
Default constructor for the Path class.
|
Path(String path)
Creates a Path object from String
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
equals(Object obj) |
Path |
getCanonicalPath()
This method creates a new path object that does not contains the (.) and
(..) identifiers.
|
String |
getExtension()
Gets the extension for the last component of this path.
|
String |
getFirstElement()
Gets the first element of the path.
|
String |
getName()
Gets the first element of the path.
|
Path |
getNext()
Creates a new Path object that does not contains the first element of the
current path.
|
Path |
getParent()
Creates a new Path object that represents the path to the parent object
of the current path.
|
String[] |
getPathElements()
Gets an array with the list of elements for this path.
|
int |
hashCode() |
boolean |
hasNext()
Determines if this path has any element left.
|
boolean |
isLast()
Determines if this path is the last element path.
|
boolean |
isParent()
Determines if the first element of the path is the (..) identifier witch
represents the parent folder.
|
boolean |
isRoot()
If this path is the root path "/".
|
boolean |
isSelf()
Determines if the first element of the path is the dot (.) character
witch represents the current folder.
|
Iterator<Path> |
iterator() |
Path |
join(Path path)
Obtains the concatenation with another path.
|
Path |
join(String path)
Obtains the concatenation with a string.
|
Path |
leftTrim(Path path)
Remove the given path from the current path if the given path is a prefix of this path.
|
boolean |
startsWith(Path path)
Determines when ever this path starts with the given path.
|
String |
toString()
Gets a string representation of the current path.
|
String |
toString(String pathSep)
Gets a string representation of the current path, separated by the
specified path separator.
|
clone, finalize, getClass, notify, notifyAll, wait, wait, waitforEach, spliteratorpublic Path()
public Path(String path)
path - The String object representing the pathpublic String[] getPathElements()
public String getFirstElement()
For example, if the path represented by this object equals to "usr/local", this method will return "usr".
public String getName()
For example, if the path represented by this object equals to "usr/local/somefile", this method will return "somefile".
public Path getParent()
For example, if the path represented by this object equals to "usr/local/somefile", this method will return a path object representing "usr/local".
public Path getNext()
For example, if the path represented by this object equals to "usr/local/somefile", this method will return a path object representing "/local/somefile".
public boolean hasNext()
For example, if the path represented by this object is a multiple element path like "usr/local" the this method will return true.
public boolean isRoot()
public boolean isSelf()
public boolean isParent()
public boolean isLast()
If the path represented by this object is a single element path like "usr" then this method will return true.
public Path getCanonicalPath()
For example, if the path represented by this element equals to "usr/./local/../etc", this method will return "usr/etc".
public String toString()
public String toString(String pathSep)
pathSep - The path separator to be used.public Path join(Path path)
path - the other path to concatenate.public Path join(String path)
path - the string to concatenate.public String getExtension()
public boolean startsWith(Path path)
path - The prefix path.Copyright © 2015–2018 Bridje Framework. All rights reserved.