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 String
CHARSET
the charset to use.static String
CHARSET_DEFAULT
the constant for the predefined charset.static String
FILENAME
the props file.protected boolean
m_Modified
whether the settings got modified.protected Properties
m_Properties
the properties.protected static CharsetHelper
m_Singleton
the singleton.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description Charset
getCharset()
Returns the charset.static String[]
getIDs()
Returns all the charset IDs, includingCHARSET_DEFAULT
.static CharsetHelper
getSingleton()
Returns the singleton.protected void
initialize()
Initializes the helper.boolean
isModified()
Whether the settings got modified.void
reload()
Reloads the properties file.boolean
save()
Saves the settings in the user's home directory.void
setCharset(String value)
Updates the charset.void
setCharset(Charset value)
Updates the charset.static String
toString(Charset l)
Returns the charset as string.static Charset
valueOf(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
-
-