|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objecteu.semaine.util.SEMAINEUtils
public class SEMAINEUtils
Constructor Summary | |
---|---|
SEMAINEUtils()
|
Method Summary | |
---|---|
static java.io.File |
getConfigFile(java.lang.String configSystemProperty)
Get a config file as defined in the given system property. |
static java.lang.String |
getReaderAsString(java.io.Reader reader)
|
static java.lang.String |
getStreamAsString(java.io.InputStream inputStream,
java.lang.String encoding)
|
static java.lang.String |
locale2xmllang(java.util.Locale locale)
Convert a locale into a string that is conform with XML's xml:lang attribute. |
static float |
parseFloat(java.lang.String valueString,
float defaultValue)
Convert the given string into a float value, if possible. |
static java.util.Locale |
string2locale(java.lang.String localeString)
|
static java.util.Map<java.lang.String,java.lang.String> |
string2map(java.lang.String s,
boolean keysFirst)
For a given string containing lines of key-value pairs, construct a map of key-value pairs. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public SEMAINEUtils()
Method Detail |
---|
public static java.io.File getConfigFile(java.lang.String configSystemProperty)
configSystemProperty
- the name of a config setting containing the filename and path of the config file to load, e.g. "semaine.character-config".
public static java.lang.String getStreamAsString(java.io.InputStream inputStream, java.lang.String encoding) throws java.io.IOException
java.io.IOException
public static java.lang.String getReaderAsString(java.io.Reader reader) throws java.io.IOException
java.io.IOException
public static java.util.Locale string2locale(java.lang.String localeString)
public static java.lang.String locale2xmllang(java.util.Locale locale)
locale
- a locale, must not be null
java.lang.IllegalArgumentException
- if locale is nullpublic static java.util.Map<java.lang.String,java.lang.String> string2map(java.lang.String s, boolean keysFirst)
key1 value1
key2 value2
Leading or trailing whitespace is ignored.
If a line contains only a single field, it is treated as a key that maps to the empty string.
Empty lines are ignored.
s
- keysFirst
- if true, the first item in a line is the key, and the rest is the value; if false, the first item in the line is the value and the rest is the key.
public static float parseFloat(java.lang.String valueString, float defaultValue)
valueString
- string to be converted into a float.defaultValue
- value to use if the string cannot be converted into a float.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |