See: Description
Class | Description |
---|---|
Charset | A named mapping between sequences of sixteen-bit Unicodecode units and sequences of bytes. |
CharsetDecoder | An engine that can transform a sequence of bytes in a specific charset into a sequence of sixteen-bit Unicode characters. |
CharsetEncoder | An engine that can transform a sequence of sixteen-bit Unicode characters into a sequence of bytes in a specific charset. |
CoderResult | A description of the result state of a coder. |
CodingErrorAction | A typesafe enumeration for coding-error actions. |
StandardCharsets | Constant definitions for the standard Charsets . |
Exception | Description |
---|---|
CharacterCodingException | Checked exception thrown when a character encoding or decoding error occurs. |
IllegalCharsetNameException | Unchecked exception thrown when a string that is not alegal charset name is used as such. |
MalformedInputException | Checked exception thrown when an input byte sequence is not legal for given charset, or an input character sequence is not a legal sixteen-bit Unicode sequence. |
UnmappableCharacterException | Checked exception thrown when an input character (or byte) sequence is valid but cannot be mapped to an output byte (or character) sequence. |
UnsupportedCharsetException | Unchecked exception thrown when no support is available for a requested charset. |
Error | Description |
---|---|
CoderMalfunctionError | Error thrown when the decodeLoop method of aCharsetDecoder , or theencodeLoop method of aCharsetEncoder , throws an unexpected exception. |
Class name
Description
Charset
A named mapping between characters
and bytesCharsetDecoder
Decodes bytes into characters CharsetEncoder
Encodes characters into bytes CoderResult
Describes coder results CodingErrorAction
Describes actions to take when
coding errors are detected
Acharset is named mapping between sequences of sixteen-bit Unicodecharacters and sequences of bytes, in the sense defined inRFC 2278. Adecoder is an engine which transforms bytes in a specific charset intocharacters, and anencoder is an engine which transforms characters intobytes. Encoders and decoders operate on byte and character buffers. They arecollectively referred to ascoders.
TheCharset
class defines methods for creatingcoders for a given charset and for retrieving the various names associated witha charset. It also defines static methods for testing whether a particularcharset is supported, for locating charset instances by name, and forconstructing a map that contains every charset for which support is availablein the current Java virtual machine.
Most users will not use these classes directly; instead they will use theexisting charset-related constructors and methods in theString
class, together with the existingInputStreamReader
andOutputStreamWriter
classes, allof whose implementations have been reworked to make use of the charsetfacilities defined in this package. A small number of changes have been madeto theInputStreamReader
andOutputStreamWriter
classes in order to allow explicit charset objects to be specified in theconstruction of instances of those classes.
Support for new charsets can be made available via the interface defined intheCharsetProvider
class in thejava.nio.charset.spi
package.
Unless otherwise noted, passing anull argument to a constructoror method in any class or interface in this package will cause aNullPointerException
to be thrown.