Class TokenizedPath
java.lang.Object
org.apache.tools.ant.types.selectors.TokenizedPath
public class TokenizedPath
extends java.lang.Object
Container for a path that has been split into its components.
- Since:
- 1.8.0
-
Field Summary
Fields Modifier and Type Field Description static TokenizedPath
EMPTY_PATH
Instance that holds no tokens at all. -
Constructor Summary
Constructors Constructor Description TokenizedPath(java.lang.String path)
Initialize the TokenizedPath by parsing it.TokenizedPath(TokenizedPath parent, java.lang.String child)
Creates a new path as a child of another path. -
Method Summary
Modifier and Type Method Description int
depth()
The depth (or length) of a path.boolean
equals(java.lang.Object o)
true if the original paths are equal.java.io.File
findFile(java.io.File base, boolean cs)
Frombase
traverse the filesystem in order to find a file that matches the given name.int
hashCode()
boolean
isSymlink(java.io.File base)
Do we have to traverse a symlink when trying to reach path from basedir?TokenizedPattern
toPattern()
Creates a TokenizedPattern from the same tokens that make up this path.java.lang.String
toString()
-
Field Details
-
EMPTY_PATH
Instance that holds no tokens at all.
-
-
Constructor Details
-
TokenizedPath
public TokenizedPath(java.lang.String path)Initialize the TokenizedPath by parsing it.- Parameters:
path
- The path to tokenize. Must not benull
.
-
TokenizedPath
Creates a new path as a child of another path.- Parameters:
parent
- the parent pathchild
- the child, must not contain the file separator
-
-
Method Details
-
toString
public java.lang.String toString()- Overrides:
toString
in classjava.lang.Object
- Returns:
- The original path String
-
depth
public int depth()The depth (or length) of a path.- Returns:
- int
-
findFile
public java.io.File findFile(java.io.File base, boolean cs)Frombase
traverse the filesystem in order to find a file that matches the given name.- Parameters:
base
- base File (dir).cs
- whether to scan case-sensitively.- Returns:
- File object that points to the file in question or null.
-
isSymlink
public boolean isSymlink(java.io.File base)Do we have to traverse a symlink when trying to reach path from basedir?- Parameters:
base
- base File (dir).- Returns:
- boolean
-
equals
public boolean equals(java.lang.Object o)true if the original paths are equal.- Overrides:
equals
in classjava.lang.Object
- Returns:
- boolean
-
hashCode
public int hashCode()- Overrides:
hashCode
in classjava.lang.Object
-
toPattern
Creates a TokenizedPattern from the same tokens that make up this path.- Returns:
- TokenizedPattern
-