public class QuotedTokenizer extends Object
SimpleTokenizer
Modifier and Type | Field and Description |
---|---|
protected int |
maxPosition |
protected int |
position |
protected String |
text |
Constructor and Description |
---|
QuotedTokenizer(String text,
char delimiter)
Constructs a tokenizer for the specified string.
|
Modifier and Type | Method and Description |
---|---|
List |
getAllTokens()
Tokenize the remaining text and return all the tokens
|
String |
getRemainder()
Get the text that has not yet been tokenized.
|
boolean |
hasMoreTokens()
Tests if there are more tokens available from this tokenizer.
|
static void |
main(String[] args) |
String |
nextToken()
Returns the next token from this tokenizer.
|
String |
nextToken(int tokenCount)
Returns the nth token from the current position of this tokenizer.
|
protected String |
parseToken()
Handle parsing of a quoted token here.
|
void |
setDelimiter(String delimiter)
Set the delimiter for the next token.
|
void |
setText(String text)
Set the text to be tokenized.
|
protected String text
protected int position
protected int maxPosition
public QuotedTokenizer(String text, char delimiter)
text
- a string to be tokenized.delimiter
- the delimiter.public void setDelimiter(String delimiter)
delimiter
- the delimiter.protected String parseToken()
public static void main(String[] args)
public void setText(String text)
text
- a string to be tokenized.public boolean hasMoreTokens()
true
when there is at least one token remaining;
false
otherwise.public String nextToken()
NoSuchElementException
- if there are no more tokenspublic String nextToken(int tokenCount)
tokenCount
- the relative position of the token requestedNoSuchElementException
- if there are no more tokenspublic String getRemainder()
public List getAllTokens()
Copyright © 2004–2020 Ideaconsult Ltd.. All rights reserved.