| java.lang.Object util.AltSTokenizer
AltSTokenizer | public class AltSTokenizer implements Enumeration(Code) | | The Sun's StringTokenizer class modified to allow more
extensive functionality.
|
Method Summary | |
public int | countTokens() Count tokens. | public String | getCurrentLine() Return current line, including newline if any. | public String | getCurrentLine(boolean decorated) Return current line, including newline if any. | public int | getCurrentLineNumber() Return current source line number. | public String | getLine(int targ) Return specified line, including newline if any. | public String | getLine(int targ, boolean decorated) Return specified line, including newline if any. | public boolean | hasMoreChars() Return true or false there are more characters. | public boolean | hasMoreElements() | public boolean | hasMoreTokens() Return true or false there are more tokens. | public String | nextChar() Return the next character. | public Object | nextElement() Return the next element. | public String | nextSubstring(int endIndex) Return the next n characters. | public String | nextToken() Return the next token. | public String | nextToken(String delim) Return the next token but change the delimiter set first. | public String | peekChar() Return the next character, but don't consume the string. | public Object | peekElement() Peek at the next element. | public String | peekRemains() Return the remaining string. | public String | peekSubstring(int endIndex) Return the next n characters, but don't consume the string. | public String | peekToken() Return the next token, but only as a "peek", don't consume
the string. | public String | peekToken(String delim) Return the next token, but only as a "peek", don't consume
the string. | public boolean | respectQuotedStrings() | public void | setRespectQuotedStrings(boolean respectQuotedStrings) Respect double-quoted strings: do not attempt to tokenize
within quotes. | public int | stringRemains() Return number of characters left. | public String | toString() |
AltSTokenizer | public AltSTokenizer(String str, String delim, boolean returnTokens)(Code) | | Constructs an AltSTokenizer instance.
Parameters: str - the string Parameters: delim - the delimiters Parameters: returnTokens - returns delimiters as tokens or skips them |
AltSTokenizer | public AltSTokenizer(String str, String delim)(Code) | | Constructs an AltSTokenizer instance.
Parameters: str - the string Parameters: delim - the delimiters |
AltSTokenizer | public AltSTokenizer(String str)(Code) | | Constructs an AltSTokenizer instance.
Parameters: str - the string |
countTokens | public int countTokens()(Code) | | Count tokens.
|
getCurrentLine | public String getCurrentLine()(Code) | | Return current line, including newline if any.
Expensive call because the line number isn't currently tracked.
|
getCurrentLine | public String getCurrentLine(boolean decorated)(Code) | | Return current line, including newline if any.
Expensive call because the line number isn't currently tracked.
Parameters: decorated - with line number and brackets |
getCurrentLineNumber | public int getCurrentLineNumber()(Code) | | Return current source line number.
Expensive call because the line number isn't currently tracked.
|
getLine | public String getLine(int targ)(Code) | | Return specified line, including newline if any.
Returns null if the line number requested doesn't exist.
Parameters: targ - line number requested |
getLine | public String getLine(int targ, boolean decorated)(Code) | | Return specified line, including newline if any.
Returns null if the line number requested doesn't exist.
Parameters: targ - line number requested Parameters: decorated - with line number and brackets |
hasMoreChars | public boolean hasMoreChars()(Code) | | Return true or false there are more characters.
|
hasMoreElements | public boolean hasMoreElements()(Code) | | Are there more elements?
|
hasMoreTokens | public boolean hasMoreTokens()(Code) | | Return true or false there are more tokens.
|
nextElement | public Object nextElement()(Code) | | Return the next element.
|
nextToken | public String nextToken(String delim)(Code) | | Return the next token but change the delimiter set first.
Parameters: delim - delimiters |
peekElement | public Object peekElement()(Code) | | Peek at the next element.
|
peekRemains | public String peekRemains()(Code) | | Return the remaining string.
|
peekToken | public String peekToken()(Code) | | Return the next token, but only as a "peek", don't consume
the string.
|
peekToken | public String peekToken(String delim)(Code) | | Return the next token, but only as a "peek", don't consume
the string.
First change delimiter set.
Parameters: delim - delimiters |
respectQuotedStrings | public boolean respectQuotedStrings()(Code) | | |
setRespectQuotedStrings | public void setRespectQuotedStrings(boolean respectQuotedStrings)(Code) | | Respect double-quoted strings: do not attempt to tokenize
within quotes.
For example, if space is a token delimiter and "tree bark"
is encountered, it isn't tokenized on the space after tree
if quotes are respected.
Currently only double-quotes are respected.
If double-quotes are delimiters, the fact that they
are delimters takes precedence over quote respecting.
If the quote is not terminated, the token is the remaining line.
|
stringRemains | public int stringRemains()(Code) | | Return number of characters left.
|
|
|