|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectkiwi.util.LocaleData
Locale-specific message bundle. This class serves as a lookup dictionary for localized messages, and provides some convenience methods for formatting the messages.
Field Summary | |
static java.lang.String |
DEFAULT_DELIMITER
The default message list delimiter. |
private java.util.Dictionary |
source
|
private java.lang.Object[] |
unitArray
|
Constructor Summary | |
LocaleData(java.util.Dictionary source)
Construct a new LocaleData object from the given
dictionary. |
|
LocaleData(java.io.InputStream instream)
Construct a new LocaleData object from the given input
stream. |
Method Summary | |
java.lang.String |
getMessage(java.lang.String key)
Get a message for the specified key. |
java.lang.String |
getMessage(java.lang.String key,
java.lang.Object arg)
Get a message for the specified key, and format the message, substituting the specified argument for the message's first placeholder. |
java.lang.String |
getMessage(java.lang.String key,
java.lang.Object[] args)
Get a message for the specified key, and format the message, substituting the specified arguments for the message's placeholders. |
java.lang.String[] |
getMessageList(java.lang.String key)
Get a message list for the specified key. |
java.lang.String[] |
getMessageList(java.lang.String key,
java.lang.String delimiter)
Get a message list for the specified key. |
boolean |
isMessageDefined(java.lang.String key)
Determine if a message is defined for the specified key. |
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_DELIMITER
private final java.lang.Object[] unitArray
private java.util.Dictionary source
Constructor Detail |
public LocaleData(java.io.InputStream instream) throws java.io.IOException
LocaleData
object from the given input
stream.
instream
- The stream to read the data from.
java.io.IOException
- If an error occurred while reading from
the stream.public LocaleData(java.util.Dictionary source)
LocaleData
object from the given
dictionary.
source
- A dictionary that contains the key/value pairs.Method Detail |
public java.lang.String getMessage(java.lang.String key) throws ResourceNotFoundException
key
- The key.
ResourceNotFoundException
- If the specified key was
not found.public java.lang.String getMessage(java.lang.String key, java.lang.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 java.lang.String getMessage(java.lang.String key, java.lang.Object arg)
"Joe"
would be formatted as My name is Joe.
key
- The key.
ResourceNotFoundException
- If the specified key was
not found.public java.lang.String[] getMessageList(java.lang.String key) throws ResourceNotFoundException
key
- The key.
ResourceNotFoundException
- If the specified key was
not found.public java.lang.String[] getMessageList(java.lang.String key, java.lang.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(java.lang.String key)
key
- The key.
true
if the key exists, and false
otherwise.
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |