1 /* 2 * Copyright (c) 2001, 2010, Oracle and/or its affiliates. All rights reserved. 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * This code is free software; you can redistribute it and/or modify it 6 * under the terms of the GNU General Public License version 2 only, as 7 * published by the Free Software Foundation. Oracle designates this 8 * particular file as subject to the "Classpath" exception as provided 9 * by Oracle in the LICENSE file that accompanied this code. 10 * 11 * This code is distributed in the hope that it will be useful, but WITHOUT 12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 14 * version 2 for more details (a copy is included in the LICENSE file that 15 * accompanied this code). 16 * 17 * You should have received a copy of the GNU General Public License version 18 * 2 along with this work; if not, write to the Free Software Foundation, 19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 20 * 21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 22 * or visit www.oracle.com if you need additional information or have any 23 * questions. 24 */ 25 26 /** 27 * Defines charsets, decoders, and encoders, for translating between bytes and 28 * Unicode characters. 29 * 30 * <blockquote><table cellspacing=1 cellpadding=0 summary="Summary of charsets, decoders, and encoders in this package"> 31 * <tr><th><p align="left">Class name</p></th><th><p align="left">Description</p></th></tr> 32 * <tr><td valign=top><tt>{@link java.nio.charset.Charset}</tt></td> 33 * <td>A named mapping between characters<br>and bytes</td></tr> 34 * <tr><td valign=top><tt>{@link java.nio.charset.CharsetDecoder}</tt></td> 35 * <td>Decodes bytes into characters</td></tr> 36 * <tr><td valign=top><tt>{@link java.nio.charset.CharsetEncoder} </tt></td> 37 * <td>Encodes characters into bytes</td></tr> 38 * <tr><td valign=top><tt>{@link java.nio.charset.CoderResult} </tt></td> 39 * <td>Describes coder results</td></tr> 40 * <tr><td valign=top><tt>{@link java.nio.charset.CodingErrorAction} </tt></td> 41 * <td>Describes actions to take when<br>coding errors are detected</td></tr> 42 * 43 * </table></blockquote> 44 * 45 * <p> A <i>charset</i> is named mapping between sequences of sixteen-bit Unicode 46 * characters and sequences of bytes, in the sense defined in <a 47 * href="http://www.ietf.org/rfc/rfc2278.txt"><i>RFC 2278</i></a>. A 48 * <i>decoder</i> is an engine which transforms bytes in a specific charset into 49 * characters, and an <i>encoder</i> is an engine which transforms characters into 50 * bytes. Encoders and decoders operate on byte and character buffers. They are 51 * collectively referred to as <i>coders</i>. 52 * 53 * <p> The {@link java.nio.charset.Charset} class defines methods for creating 54 * coders for a given charset and for retrieving the various names associated with 55 * a charset. It also defines static methods for testing whether a particular 56 * charset is supported, for locating charset instances by name, and for 57 * constructing a map that contains every charset for which support is available 58 * in the current Java virtual machine. 59 * 60 * <p> Most users will not use these classes directly; instead they will use the 61 * existing charset-related constructors and methods in the {@link 62 * java.lang.String} class, together with the existing {@link 63 * java.io.InputStreamReader} and {@link java.io.OutputStreamWriter} classes, all 64 * of whose implementations have been reworked to make use of the charset 65 * facilities defined in this package. A small number of changes have been made 66 * to the {@link java.io.InputStreamReader} and {@link java.io.OutputStreamWriter} 67 * classes in order to allow explicit charset objects to be specified in the 68 * construction of instances of those classes. 69 * 70 * <p> Support for new charsets can be made available via the interface defined in 71 * the {@link java.nio.charset.spi.CharsetProvider} class in the <tt>{@link 72 * java.nio.charset.spi}</tt> package. 73 * 74 * <p> Unless otherwise noted, passing a <tt>null</tt> argument to a constructor 75 * or method in any class or interface in this package will cause a {@link 76 * java.lang.NullPointerException NullPointerException} to be thrown. 77 * 78 * 79 * @since 1.4 80 * @author Mark Reinhold 81 * @author JSR-51 Expert Group 82 */ 83 84 package java.nio.charset; 85