public class KeyValueListParser extends Object
Constructor and Description |
---|
KeyValueListParser(char delim)
Constructs a new KeyValueListParser.
|
Modifier and Type | Method and Description |
---|---|
float |
getFloat(String key,
float def)
Get the value for key as a float.
|
int |
getInt(String key,
int def)
Get the value for key as an int.
|
long |
getLong(String key,
long def)
Get the value for key as a long.
|
String |
getString(String key,
String def)
Get the value for key as a string.
|
void |
setString(String str)
Resets the parser with a new string to parse.
|
public KeyValueListParser(char delim)
setString(String)
.delim
- The delimiter that separates key=value pairs.public void setString(String str) throws IllegalArgumentException
key1=value,key2=value,key3=valuewhere the delimiter is a comma.
str
- the string to parse.IllegalArgumentException
- if the string is malformed.public int getInt(String key, int def)
key
- The key to lookup.def
- The value to return if the key was not found, or the value was not a long.public long getLong(String key, long def)
key
- The key to lookup.def
- The value to return if the key was not found, or the value was not a long.public float getFloat(String key, float def)
key
- The key to lookup.def
- The value to return if the key was not found, or the value was not a float.