| java.nio.charset.spi | Service-provider classes for the java.nio.charset package. |
| Charset | A named mapping between sequences of sixteen-bit Unicode code units and sequences of bytes. | code | html |
| CharsetDecoder | code | html | |
| CharsetEncoder | code | html | |
| CoderResult.Cache | code | html |
| CharacterCodingException | code | html | |
| CoderMalfunctionError | Error thrown when the decodeLoop method of a CharsetDecoder , or the encodeLoop method of a CharsetEncoder , throws an unexpected exception. | code | html |
| CoderResult | A description of the result state of a coder. | code | html |
| CodingErrorAction | A typesafe enumeration for coding-error actions. | code | html |
| IllegalCharsetNameException | code | html | |
| 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. | code | html |
| UnmappableCharacterException | Checked exception thrown when an input character (or byte) sequence is valid but cannot be mapped to an output byte (or character) sequence. | code | html |
| UnsupportedCharsetException | code | html |
Class name
Description
java.nio.charset.Charset A named mapping between characters
and bytesjava.nio.charset.CharsetDecoder Decodes bytes into characters java.nio.charset.CharsetEncoder Encodes characters into bytes java.nio.charset.CoderResult Describes coder results java.nio.charset.CodingErrorAction Describes actions to take when
coding errors are detected
A charset is named mapping between sequences of sixteen-bit Unicode characters and sequences of bytes, in the sense defined in RFC 2278. A decoder is an engine which transforms bytes in a specific charset into characters, and an encoder is an engine which transforms characters into bytes. Encoders and decoders operate on byte and character buffers. They are collectively referred to as coders.
The java.nio.charset.Charset class defines methods for creating coders for a given charset and for retrieving the various names associated with a charset. It also defines static methods for testing whether a particular charset is supported, for locating charset instances by name, and for constructing a map that contains every charset for which support is available in the current Java virtual machine.
Most users will not use these classes directly; instead they will use the existing charset-related constructors and methods in the java.lang.String class, together with the existing java.io.InputStreamReader and java.io.OutputStreamWriter classes, all of whose implementations have been reworked to make use of the charset facilities defined in this package. A small number of changes have been made to the java.io.InputStreamReader and java.io.OutputStreamWriter classes in order to allow explicit charset objects to be specified in the construction of instances of those classes.
Support for new charsets can be made available via the interface defined in the java.nio.charset.spi.CharsetProvider class in the java.nio.charset.spi package.
Unless otherwise noted, passing a null argument to a constructor or method in any class or interface in this package will cause a NullPointerException to be thrown. @since 1.4 @author Mark Reinhold @author JSR-51 Expert Group