public class ExtendedStringTokenizer extends StringTokenizer
| Constructor and Description |
|---|
ExtendedStringTokenizer(String str)
Constructor.
|
ExtendedStringTokenizer(String str,
String delim)
Constructor.
|
ExtendedStringTokenizer(String str,
String delim,
boolean returnDelims)
Constructor.
|
ExtendedStringTokenizer(String str,
String delim,
boolean returnDelims,
boolean keepEmptyTokens)
Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
int |
countTokens()
Calculates the number of times that this tokenizer's
nextToken method can be called before it generates an exception. |
boolean |
hasMoreElements()
Returns the same value as the
hasMoreTokens method. |
boolean |
hasMoreTokens()
Tests if there are more tokens available from this tokenizers string.
|
boolean |
isKeepingEmptyTokens()
Return true if empty tokens should be returned by the
nextToken() or nextElement() methods, and used by the
countTokens() method. |
boolean |
keepEmptyTokens(boolean keepEmptyTokens)
Set if empty tokens should be returned by the
nextToken() or nextElement() methods, and used by the
countTokens() method. |
Object |
nextElement()
Returns the same value as the
nextToken method, except that its declared return value is Object rather than
String. |
String |
nextToken()
Returns the next token from this string tokenizer.
|
String |
nextToken(String delim)
Returns the next token in this string tokenizer's string.
|
public ExtendedStringTokenizer(String str)
str - the stringpublic ExtendedStringTokenizer(String str, String delim)
str - the stringdelim - the delimiterpublic ExtendedStringTokenizer(String str, String delim, boolean returnDelims)
str - the stringdelim - the delimiterreturnDelims - true if the delimiters should be returnedpublic ExtendedStringTokenizer(String str, String delim, boolean returnDelims, boolean keepEmptyTokens)
str - the stringdelim - the delimiterreturnDelims - true if the delimiters should be returnedkeepEmptyTokens - true if empty tokens should be returnedpublic boolean keepEmptyTokens(boolean keepEmptyTokens)
nextToken() or nextElement() methods, and used by the
countTokens() method. If the argument is true, the he default implementation of the StringTokenizer class will
be used.
This method will not change the value of isKeepingEmptyTokens() if the tokenizer has been started.keepEmptyTokens - true if empty tokens should be usedpublic boolean isKeepingEmptyTokens()
nextToken() or nextElement() methods, and used by the
countTokens() method. If the argument is true, the he default implementation of the StringTokenizer class will
be used.public Object nextElement()
nextToken method, except that its declared return value is Object rather than
String.
Note that if isKeepingEmptyTokens() returns false, the default implementation of the
StringTokenizer class will be used.nextElement in interface Enumeration<Object>nextElement in class StringTokenizerNoSuchElementException - if there are no more tokens in this tokenizer's string.public String nextToken()
isKeepingEmptyTokens() returns false, the default implementation of the
StringTokenizer class will be used.nextToken in class StringTokenizerNoSuchElementException - if there are no more tokens in this tokenizer's string.public boolean hasMoreElements()
hasMoreTokens method.hasMoreElements in interface Enumeration<Object>hasMoreElements in class StringTokenizertrue if there are more tokens, false otherwise.hasMoreTokens()public boolean hasMoreTokens()
isKeepingEmptyTokens() returns false, the default implementation of the
StringTokenizer class will be used.hasMoreTokens in class StringTokenizertrue if and only if there is at least one token in the string after the current position; false
otherwise.public String nextToken(String delim)
StringTokenizer class will be
used.nextToken in class StringTokenizerdelim - the new delimitersUnsupportedOperationException - if isKeepingEmptyTokens() returns trueNoSuchElementException - if there are no more tokens in this tokenizer's string.NullPointerException - if delim is nullpublic int countTokens()
nextToken method can be called before it generates an exception. The
current position is not advanced.
Note that if isKeepingEmptyTokens() returns false, the default implementation of the
StringTokenizer class will be used.countTokens in class StringTokenizer