| A charset defines a mapping between a Unicode character sequence and a byte
sequence. It facilitate the encoding from a Unicode character sequence into a
byte sequence, and the decoding from a byte sequence into a Unicode character
sequence.
A charset has a canonical name, which are usually in uppercase. Typically it
also has one or more aliases. The name string can only consist of the
following characters: '0' - '9', 'A' - 'Z', 'a' - 'z', '.', ':'. '-' and '_'.
The first character of the name must be a digit or a letter.
The following charsets should be supported by any java platforms: US-ASCII,
ISO-8859-1, UTF-8, UTF-16BE, UTF-16LE, UTF-16.
Additional charsets can be made available by configuring one or more charset
providers through provider configuration files. Such files are always named
as "java.nio.charset.spi.CharsetProvider" and located in the
"META-INF/services" sub folder of one or more classpaths. The files should be
encoded in "UTF-8". Each line of their content specifies the class name of a
charset provider which extends java.nio.spi.CharsetProvider .
A line should ends with '\r', '\n' or '\r\n'. Leading and trailing
whitespaces are trimmed. Blank lines, and lines (after trimmed) starting with
"#" which are regarded as comments, are both ignored. Duplicates of already
appeared names are also ignored. Both the configuration files and the
provider classes will be loaded using the thread context class loader.
This class is thread-safe.
See Also: java.nio.charset.spi.CharsetProvider |