Package org.glassfish.common.util.admin
Class ParamTokenizer
- java.lang.Object
-
- org.glassfish.common.util.admin.ParamTokenizer
-
public class ParamTokenizer extends Object
Separate parameters to admin commands into tokens. Mostly used for parameters that take a list of values separated by colons.- Author:
- Bill Shannon
-
-
Field Summary
Fields Modifier and Type Field Description protected int
currentPosition
protected char
delimiter
static LocalStringManagerImpl
localStrings
protected int
maxPosition
protected String
str
protected StringBuilder
token
-
Constructor Summary
Constructors Constructor Description ParamTokenizer(String str, char delimiter)
Construct a tokenizer for the specified string.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
hasMoreTokens()
Test if there are more tokens available from this tokenizer's string.String
nextToken()
Return the next token from this tokenizer.String
nextTokenKeepEscapes()
Return the next token from this tokenizer.protected String
scanToken(boolean keep)
Return the next token starting at the current position.
-
-
-
Field Detail
-
currentPosition
protected int currentPosition
-
maxPosition
protected int maxPosition
-
str
protected String str
-
delimiter
protected char delimiter
-
token
protected StringBuilder token
-
localStrings
public static final LocalStringManagerImpl localStrings
-
-
Constructor Detail
-
ParamTokenizer
public ParamTokenizer(String str, char delimiter)
Construct a tokenizer for the specified string.- Parameters:
str
- a string to be parsed.
-
-
Method Detail
-
hasMoreTokens
public boolean hasMoreTokens()
Test if there are more tokens available from this tokenizer's string.- Returns:
true
if there are more tokens available from this tokenizer's string;false
otherwise.
-
nextToken
public String nextToken() throws NoSuchElementException
Return the next token from this tokenizer.- Returns:
- the next token from this tokenizer.
- Throws:
NoSuchElementException
- if there are no more tokens in this tokenizer's string.
-
nextTokenKeepEscapes
public String nextTokenKeepEscapes() throws NoSuchElementException
Return the next token from this tokenizer. Keep escapes and quotes intact.- Returns:
- the next token from this tokenizer.
- Throws:
NoSuchElementException
- if there are no more tokens in this tokenizer's string.
-
scanToken
protected String scanToken(boolean keep) throws IllegalArgumentException
Return the next token starting at the current position.- Throws:
IllegalArgumentException
-
-