|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.wicket.extensions.util.encoding.CharSetMap
public final class CharSetMap
This class maintains a set of mappers defining mappings between locales and the corresponding charsets. The mappings are defined as properties between locale and charset names. The definitions can be listed in property files located in user's home directory, Java home directory or the current class jar. In addition, this class maintains static default mappings and constructors support application specific mappings. This source has originally been taken from the jakarta Turbine project.
Field Summary | |
---|---|
static String |
CHARSET_RESOURCE
The name for charset mapper resources. |
static String |
DEFAULT_CHARSET
The default charset when nothing else is applicable. |
Constructor Summary | |
---|---|
CharSetMap()
Constructs a new charset map with default mappers. |
|
CharSetMap(File file)
Constructs a charset map read from a property file. |
|
CharSetMap(InputStream input)
Constructs a charset map read from a stream. |
|
CharSetMap(Properties props)
Constructs a charset map from properties. |
|
CharSetMap(String path)
Constructs a charset map read from a property file path. |
Method Summary | |
---|---|
String |
getCharSet(Locale locale)
Gets the charset for a locale. |
String |
getCharSet(Locale locale,
String variant)
Gets the charset for a locale with a variant. |
String |
getCharSet(String key)
Gets the charset for a specified key. |
String |
getCharSet(String key,
String def)
Gets the charset for a specified key. |
protected static Map<String,String> |
loadFile(File file)
Loads mappings from a file. |
protected static Map<String,String> |
loadPath(String path)
Loads mappings from a file path. |
protected static Map<String,String> |
loadResource(String name)
Loads mappings from a resource. |
protected static Map<String,String> |
loadStream(InputStream input)
Loads mappings from a stream. |
void |
setCharSet(String key,
String charset)
Sets a locale-charset mapping. |
protected void |
setCommonCharSet(String key,
String charset)
Sets a common locale-charset mapping. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final String DEFAULT_CHARSET
public static final String CHARSET_RESOURCE
Constructor Detail |
---|
public CharSetMap()
public CharSetMap(Properties props)
props
- charset mapping properties.public CharSetMap(InputStream input) throws IOException
input
- an input stream.
IOException
- for an incorrect stream.public CharSetMap(File file) throws IOException
file
- a property file.
IOException
- for an incorrect property file.public CharSetMap(String path) throws IOException
path
- a property file path.
IOException
- for an incorrect property file.Method Detail |
---|
protected static final Map<String,String> loadStream(InputStream input) throws IOException
input
- an input stream.
IOException
- for an incorrect stream.protected static final Map<String,String> loadFile(File file) throws IOException
file
- a file.
IOException
- for an incorrect file.protected static final Map<String,String> loadPath(String path) throws IOException
path
- a file path.
IOException
- for an incorrect file.protected static final Map<String,String> loadResource(String name)
name
- a resource name.
public final void setCharSet(String key, String charset)
key
- the key for the charset.charset
- the corresponding charset.public final String getCharSet(Locale locale)
locale
- the locale.
public final String getCharSet(Locale locale, String variant)
locale
- the locale.variant
- a variant field.
public final String getCharSet(String key)
key
- the key for the charset.
public final String getCharSet(String key, String def)
key
- the key for the charset.def
- the default charset if none is found.
protected final void setCommonCharSet(String key, String charset)
key
- the key for the charset.charset
- the corresponding charset.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |