public class Messages extends Object
It is used by the system classes to provide national language support, by
looking up messages in the
org.apache.harmony.security.internal.nls.messages
resource bundle. Note that if this file is not available, or an invalid key
is looked up, or resource bundle support is not available, the key itself
will be returned as the associated message. This means that the KEY
should a reasonable human-readable (english) string.
Constructor and Description |
---|
Messages() |
Modifier and Type | Method and Description |
---|---|
static String |
format(String format,
Object[] args)
Generates a formatted text string given a source string containing
"argument markers" of the form "{argNum}" where each argNum must be in
the range 0..9.
|
static String |
getString(String msg)
Retrieves a message which has no arguments.
|
static String |
getString(String msg,
char arg)
Retrieves a message which takes 1 character argument.
|
static String |
getString(String msg,
int arg)
Retrieves a message which takes 1 integer argument.
|
static String |
getString(String msg,
Object arg)
Retrieves a message which takes 1 argument.
|
static String |
getString(String msg,
Object[] args)
Retrieves a message which takes several arguments.
|
static String |
getString(String msg,
Object arg1,
Object arg2)
Retrieves a message which takes 2 arguments.
|
static ResourceBundle |
setLocale(Locale locale,
String resource)
Changes the locale of the messages.
|
public static String getString(String msg)
msg
- String the key to look up.public static String getString(String msg, Object arg)
msg
- String the key to look up.arg
- Object the object to insert in the formatted output.public static String getString(String msg, int arg)
msg
- String the key to look up.arg
- int the integer to insert in the formatted output.public static String getString(String msg, char arg)
msg
- String the key to look up.arg
- char the character to insert in the formatted output.public static String getString(String msg, Object arg1, Object arg2)
msg
- String the key to look up.arg1
- Object an object to insert in the formatted output.arg2
- Object another object to insert in the formatted output.public static String getString(String msg, Object[] args)
msg
- String the key to look up.args
- Object[] the objects to insert in the formatted output.public static String format(String format, Object[] args)
To insert the "{" character into the output, use a single backslash character to escape it (i.e. "\{"). The "}" character does not need to be escaped.
format
- String the format to use when printing.args
- Object[] the arguments to use.public static ResourceBundle setLocale(Locale locale, String resource)
locale
- Locale the locale to change to.Copyright © 2016–2018 The Apache Software Foundation. All rights reserved.