Package adams.core.management
Class CharsetHelper
- java.lang.Object
-
- adams.core.management.CharsetHelper
-
public class CharsetHelper extends Object
Helper class for charset setup.- Version:
- $Revision$
- Author:
- fracpete (fracpete at waikato dot ac dot nz)
-
-
Field Summary
Fields Modifier and Type Field Description static StringCHARSETthe charset to use.static StringCHARSET_DEFAULTthe constant for the predefined charset.static StringFILENAMEthe props file.protected booleanm_Modifiedwhether the settings got modified.protected Propertiesm_Propertiesthe properties.protected static CharsetHelperm_Singletonthe singleton.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description CharsetgetCharset()Returns the charset.static String[]getIDs()Returns all the charset IDs, includingCHARSET_DEFAULT.static CharsetHelpergetSingleton()Returns the singleton.protected voidinitialize()Initializes the helper.booleanisModified()Whether the settings got modified.voidreload()Reloads the properties file.booleansave()Saves the settings in the user's home directory.voidsetCharset(String value)Updates the charset.voidsetCharset(Charset value)Updates the charset.static StringtoString(Charset l)Returns the charset as string.static CharsetvalueOf(String str)Returns a charset generated from the string (eg en, en_US).
-
-
-
Field Detail
-
FILENAME
public static final String FILENAME
the props file.- See Also:
- Constant Field Values
-
CHARSET
public static final String CHARSET
the charset to use.- See Also:
- Constant Field Values
-
CHARSET_DEFAULT
public static final String CHARSET_DEFAULT
the constant for the predefined charset.- See Also:
- Constant Field Values
-
m_Singleton
protected static CharsetHelper m_Singleton
the singleton.
-
m_Properties
protected Properties m_Properties
the properties.
-
m_Modified
protected boolean m_Modified
whether the settings got modified.
-
-
Method Detail
-
initialize
protected void initialize()
Initializes the helper.
-
isModified
public boolean isModified()
Whether the settings got modified.- Returns:
- true if modified
-
getCharset
public Charset getCharset()
Returns the charset.- Returns:
- the charset
-
setCharset
public void setCharset(Charset value)
Updates the charset.- Parameters:
value- the charset
-
setCharset
public void setCharset(String value)
Updates the charset.- Parameters:
value- the charset
-
reload
public void reload()
Reloads the properties file. Discards any unsaved settings.
-
save
public boolean save()
Saves the settings in the user's home directory.- Returns:
- true if successfully saved
-
getSingleton
public static CharsetHelper getSingleton()
Returns the singleton.- Returns:
- the singleton
-
toString
public static String toString(Charset l)
Returns the charset as string.- Parameters:
l- the charset object to convert- Returns:
- the generated string
-
valueOf
public static Charset valueOf(String str)
Returns a charset generated from the string (eg en, en_US). In case ofCHARSET_DEFAULT,getCharset()is used.- Parameters:
str- the string to convert to a charset- Returns:
- the generated charset
-
getIDs
public static String[] getIDs()
Returns all the charset IDs, includingCHARSET_DEFAULT.- Returns:
- the IDs
-
-