public class LocaleData extends Object
Modifier and Type | Field and Description |
---|---|
static String |
DEFAULT_DELIMITER
The default message list delimiter.
|
private Dictionary |
source |
private Object[] |
unitArray |
Constructor and Description |
---|
LocaleData(Dictionary source)
Construct a new
LocaleData object from the given
dictionary. |
LocaleData(InputStream instream)
Construct a new
LocaleData object from the given input
stream. |
Modifier and Type | Method and Description |
---|---|
String |
getMessage(String key)
Get a message for the specified key.
|
String |
getMessage(String key,
Object arg)
Get a message for the specified key, and format the message, substituting
the specified argument for the message's first placeholder.
|
String |
getMessage(String key,
Object[] args)
Get a message for the specified key, and format the message, substituting
the specified arguments for the message's placeholders.
|
String[] |
getMessageList(String key)
Get a message list for the specified key.
|
String[] |
getMessageList(String key,
String delimiter)
Get a message list for the specified key.
|
boolean |
isMessageDefined(String key)
Determine if a message is defined for the specified key.
|
public static final String DEFAULT_DELIMITER
private Dictionary source
public LocaleData(InputStream instream) throws IOException
LocaleData
object from the given input
stream.instream
- The stream to read the data from.IOException
- If an error occurred while reading from
the stream.public LocaleData(Dictionary source)
LocaleData
object from the given
dictionary.source
- A dictionary that contains the key/value pairs.public String getMessage(String key) throws ResourceNotFoundException
key
- The key.ResourceNotFoundException
- If the specified key was
not found.public String getMessage(String key, Object[] args)
{ "Joe", new Integer(12) }
would be
formatted as My name is Joe, and I am 12 years old.key
- The key.args
- An array of arguments for the message.ResourceNotFoundException
- If the specified key was
not found.public String getMessage(String key, Object arg)
"Joe"
would be formatted as My name is Joe.key
- The key.arg
- A single argument for the message.ResourceNotFoundException
- If the specified key was
not found.public String[] getMessageList(String key) throws ResourceNotFoundException
key
- The key.ResourceNotFoundException
- If the specified key was
not found.public String[] getMessageList(String key, String delimiter) throws ResourceNotFoundException
key
- The key.delimiter
- The delimiter to use.kiwi.util.ResourceNotoundException
- If the specified key was
not found.ResourceNotFoundException
public boolean isMessageDefined(String key)
key
- The key.true
if the key exists, and false
otherwise.WebARTS Library Licensed Under the GNU - General Public License. Other Libraries licensed under their respective Open Source Licenses