Package org.apache.tools.ant
Class PathTokenizer
java.lang.Object
org.apache.tools.ant.PathTokenizer
public class PathTokenizer
extends java.lang.Object
A Path tokenizer takes a path and returns the components that make up
that path.
The path can use path separators of either ':' or ';' and file separators
of either '/' or '\'.
-
Constructor Summary
Constructors Constructor Description PathTokenizer(java.lang.String path)
Constructs a path tokenizer for the specified path. -
Method Summary
Modifier and Type Method Description boolean
hasMoreTokens()
Tests if there are more path elements available from this tokenizer's path.java.lang.String
nextToken()
Returns the next path element from this tokenizer.
-
Constructor Details
-
PathTokenizer
public PathTokenizer(java.lang.String path)Constructs a path tokenizer for the specified path.- Parameters:
path
- The path to tokenize. Must not benull
.
-
-
Method Details
-
hasMoreTokens
public boolean hasMoreTokens()Tests if there are more path elements available from this tokenizer's path. If this method returnstrue
, then a subsequent call to nextToken will successfully return a token.- Returns:
true
if and only if there is at least one token in the string after the current position;false
otherwise.
-
nextToken
public java.lang.String nextToken() throws java.util.NoSuchElementExceptionReturns the next path element from this tokenizer.- Returns:
- the next path element from this tokenizer.
- Throws:
java.util.NoSuchElementException
- if there are no more elements in this tokenizer's path.
-