public class Tokenizer extends Object
Properly treats double quotes (") as option delimiters.
Expects option names to be preceded by a double dash. We call this an "option marker".
Treats spaces as the default option tokenizer.
Any token without an option marker is considered the default. The default is returned in the Map as an element with an empty string key (""). There can only be a single default.
Constructor and Description |
---|
Tokenizer(String text) |
Tokenizer(String text,
boolean allowUnbalancedLastQuotedValue) |
Modifier and Type | Method and Description |
---|---|
String |
escape(String value)
Apply delimiter escaping to the given string, using the actual delimiter that was used for the last value.
|
char |
getLastValueDelimiter()
Return the delimiter (space or quotes) that was (or is being) used for the last value.
|
int |
getLastValueStartOffset()
Return the offset at which the last value seen started (NOT including any delimiter).
|
Map<String,String> |
getTokens() |
boolean |
lastValueIsComplete()
Return true if we know for sure that the last value has been typed in full.
|
boolean |
openingQuotesHaveNotBeenClosed()
Return whether the last value was meant to be enclosed in quotes, but the closing quote has not been typed yet.
|
void |
tokenize() |
String |
toString() |
public Tokenizer(String text)
public Tokenizer(String text, boolean allowUnbalancedLastQuotedValue)
public void tokenize()
public int getLastValueStartOffset()
public char getLastValueDelimiter()
public boolean openingQuotesHaveNotBeenClosed()
public boolean lastValueIsComplete()
public String escape(String value)