|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.turbine.services.mimetype.util.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.
Field Summary | |
static java.lang.String |
CHARSET_RESOURCE
The name for charset mapper resources. |
static java.lang.String |
DEFAULT_CHARSET
The default charset when nothing else is applicable. |
Constructor Summary | |
CharSetMap()
Constructs a new charset map with default mappers. |
|
CharSetMap(java.io.File file)
Contructs a charset map read from a property file. |
|
CharSetMap(java.io.InputStream input)
Contructs a charset map read from a stream. |
|
CharSetMap(java.util.Properties props)
Contructs a charset map from properties. |
|
CharSetMap(java.lang.String path)
Contructs a charset map read from a property file path. |
Method Summary | |
java.lang.String |
getCharSet(java.util.Locale locale)
Gets the charset for a locale. |
java.lang.String |
getCharSet(java.util.Locale locale,
java.lang.String variant)
Gets the charset for a locale with a variant. |
java.lang.String |
getCharSet(java.lang.String key)
Gets the charset for a specified key. |
java.lang.String |
getCharSet(java.lang.String key,
java.lang.String def)
Gets the charset for a specified key. |
protected static java.util.Map |
loadFile(java.io.File file)
Loads mappings from a file. |
protected static java.util.Map |
loadPath(java.lang.String path)
Loads mappings from a file path. |
protected static java.util.Map |
loadResource(java.lang.String name)
Loads mappings from a resource. |
protected static java.util.Map |
loadStream(java.io.InputStream input)
Loads mappings from a stream. |
void |
setCharSet(java.lang.String key,
java.lang.String charset)
Sets a locale-charset mapping. |
protected void |
setCommonCharSet(java.lang.String key,
java.lang.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 java.lang.String DEFAULT_CHARSET
public static final java.lang.String CHARSET_RESOURCE
Constructor Detail |
public CharSetMap()
public CharSetMap(java.util.Properties props)
props
- charset mapping propeties.public CharSetMap(java.io.InputStream input) throws java.io.IOException
input
- an input stream.
java.io.IOException
- for an incorrect stream.public CharSetMap(java.io.File file) throws java.io.IOException
file
- a property file.
java.io.IOException
- for an incorrect property file.public CharSetMap(java.lang.String path) throws java.io.IOException
path
- a property file path.
java.io.IOException
- for an incorrect property file.Method Detail |
protected static java.util.Map loadStream(java.io.InputStream input) throws java.io.IOException
input
- an input stream.
java.io.IOException
- for an incorrect stream.protected static java.util.Map loadFile(java.io.File file) throws java.io.IOException
file
- a file.
java.io.IOException
- for an incorrect file.protected static java.util.Map loadPath(java.lang.String path) throws java.io.IOException
path
- a file path.
java.io.IOException
- for an incorrect file.protected static java.util.Map loadResource(java.lang.String name)
name
- a resource name.
public void setCharSet(java.lang.String key, java.lang.String charset)
key
- the key for the charset.charset
- the corresponding charset.public java.lang.String getCharSet(java.util.Locale locale)
locale
- the locale.
public java.lang.String getCharSet(java.util.Locale locale, java.lang.String variant)
locale
- the locale.variant
- a variant field.
public java.lang.String getCharSet(java.lang.String key)
key
- the key for the charset.
public java.lang.String getCharSet(java.lang.String key, java.lang.String def)
key
- the key for the charset.def
- the default charset if none is found.
protected void setCommonCharSet(java.lang.String key, java.lang.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 |