|
|||||||||
PREV PACKAGE NEXT PACKAGE | FRAMES NO FRAMES |
See:
Description
Class Summary | |
Formatter | Creates locale-specific renditions of data items. |
ResourceManager | Resource manager for applications. |
StringComparator | Compares two strings using locale-specific rules. |
Exception Summary | |
ResourceException | Thrown when a resource manager operation fails. |
UnsupportedLocaleException | Thrown when an operation is attempted that is not supported for the specified locale. |
Contains classes that implement the JSR-238, "Mobile Internationalization API".
The classes in this package are used by applications to manage application and device resources, format data items in a locale-specific way, and perform locale-specific comparisons of strings.
Since most of the classes in this package are immutable after construction, the implementation MAY provide thread safety by synchronization of non-atomic operations. However, multithreaded applications SHOULD provide explicit synchronization if several threads are using the same object from any class in this API.
Note that the ResourceManager class is explicitly not final, as a device resource manager is best implemented by subclassing ResourceManager.
The Formatter
class is instantiated to produce locale-specific renditions
of data items. Typically only one formatter is used in an application run,
but the application can create other instances for different locales,
provided they are supported by the implementation.
An instance of Formatter
is not needed to format
messages with replaceable parameters.
Resources are retrieved using an instance of the ResourceManager
class.
This API distinguishes between two types of resources: application resources and device resources. The former are defined by the application programmer and shipped with the application, whereas the latter are defined by the device manufacturer.
Application resources can be String objects or byte arrays, whereas device
resources can be arbitrary Java objects. All resources can be retrieved with
the getResource
method, but getString
and
getData
are provided for convenience.
Resources are grouped by base names, which can be arbitrary strings.
For better compatibility across systems the base
names SHOULD preferably contain only US-ASCII characters, and
characters typically reserved in file names SHOULD be avoided.
In the MIDP environment a base name could be the name of some
MIDlet in the currently running MIDlet suite, as indicated by the
MIDlet-n
attribute (see the MIDP 2.0
specification). If an application descriptor is not present, the value of the
MIDlet-Name
attribute can be used as the base name. However, base names
are not tied to the application suite.
A programmer-assigned name can be used to address resources which are common to all MIDlets
in the suite.
If the base name is empty, it indicates that only device-specific resources are to be retrieved using the manager in question.
Sorting text strings (also known as collation) is a locale-specific
operation facilitated by the StringComparator
class. This class
does not perform the sorting, but provides a method to compare two strings
correctly for a given locale. This result can be utilized in any standard
sorting algorithm used by the application.
|
|||||||||
PREV PACKAGE NEXT PACKAGE | FRAMES NO FRAMES |