    001/*
    002 * Licensed to the Apache Software Foundation (ASF) under one or more
    003 * contributor license agreements.  See the NOTICE file distributed with
    004 * this work for additional information regarding copyright ownership.
    005 * The ASF licenses this file to You under the Apache License, Version 2.0
    006 * (the "License"); you may not use this file except in compliance with
    007 * the License.  You may obtain a copy of the License at
    008 *
    009 *      http://www.apache.org/licenses/LICENSE-2.0
    010 *
    011 * Unless required by applicable law or agreed to in writing, software
    012 * distributed under the License is distributed on an "AS IS" BASIS,
    013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    014 * See the License for the specific language governing permissions and
    015 * limitations under the License.
    016 */
    017
    018package org.apache.commons.codec;
    019
    020/**
    021 * Character encoding names required of every implementation of the Java platform.
    022 *
    023 * From the Java documentation <a
    024 * href="http://download.oracle.com/javase/7/docs/api/java/nio/charset/Charset.html">Standard charsets</a>:
    025 * <p>
    026 * <cite>Every implementation of the Java platform is required to support the following character encodings. Consult the
    027 * release documentation for your implementation to see if any other encodings are supported. Consult the release
    028 * documentation for your implementation to see if any other encodings are supported.</cite>
    029 * </p>
    030 *
    031 * <ul>
    032 * <li>{@code US-ASCII}<p>
    033 * Seven-bit ASCII, a.k.a. ISO646-US, a.k.a. the Basic Latin block of the Unicode character set.</p></li>
    034 * <li>{@code ISO-8859-1}<p>
    035 * ISO Latin Alphabet No. 1, a.k.a. ISO-LATIN-1.</p></li>
    036 * <li>{@code UTF-8}<p>
    037 * Eight-bit Unicode Transformation Format.</p></li>
    038 * <li>{@code UTF-16BE}<p>
    039 * Sixteen-bit Unicode Transformation Format, big-endian byte order.</p></li>
    040 * <li>{@code UTF-16LE}<p>
    041 * Sixteen-bit Unicode Transformation Format, little-endian byte order.</p></li>
    042 * <li>{@code UTF-16}<p>
    043 * Sixteen-bit Unicode Transformation Format, byte order specified by a mandatory initial byte-order mark (either order
    044 * accepted on input, big-endian used on output.)</p></li>
    045 * </ul>
    046 *
    047 * This perhaps would best belong in the [lang] project. Even if a similar interface is defined in [lang], it is not
    048 * foreseen that [codec] would be made to depend on [lang].
    049 *
    050 * <p>
    051 * This class is immutable and thread-safe.
    052 * </p>
    053 *
    054 * @see <a href="http://download.oracle.com/javase/7/docs/api/java/nio/charset/Charset.html">Standard charsets</a>
    055 * @since 1.4
    056 */
    057public class CharEncoding {
    058
    059    /**
    060     * CharEncodingISO Latin Alphabet No. 1, a.k.a. ISO-LATIN-1.
    061     * <p>
    062     * Every implementation of the Java platform is required to support this character encoding.
    063     * </p>
    064     *
    065     * @see <a href="http://download.oracle.com/javase/7/docs/api/java/nio/charset/Charset.html">Standard charsets</a>
    066     */
    067    public static final String ISO_8859_1 = "ISO-8859-1";
    068
    069    /**
    070     * Seven-bit ASCII, also known as ISO646-US, also known as the Basic Latin block of the Unicode character set.
    071     * <p>
    072     * Every implementation of the Java platform is required to support this character encoding.
    073     * </p>
    074     *
    075     * @see <a href="http://download.oracle.com/javase/7/docs/api/java/nio/charset/Charset.html">Standard charsets</a>
    076     */
    077    public static final String US_ASCII = "US-ASCII";
    078
    079    /**
    080     * Sixteen-bit Unicode Transformation Format, The byte order specified by a mandatory initial byte-order mark
    081     * (either order accepted on input, big-endian used on output)
    082     * <p>
    083     * Every implementation of the Java platform is required to support this character encoding.
    084     * </p>
    085     *
    086     * @see <a href="http://download.oracle.com/javase/7/docs/api/java/nio/charset/Charset.html">Standard charsets</a>
    087     */
    088    public static final String UTF_16 = "UTF-16";
    089
    090    /**
    091     * Sixteen-bit Unicode Transformation Format, big-endian byte order.
    092     * <p>
    093     * Every implementation of the Java platform is required to support this character encoding.
    094     * </p>
    095     *
    096     * @see <a href="http://download.oracle.com/javase/7/docs/api/java/nio/charset/Charset.html">Standard charsets</a>
    097     */
    098    public static final String UTF_16BE = "UTF-16BE";
    099
    100    /**
    101     * Sixteen-bit Unicode Transformation Format, little-endian byte order.
    102     * <p>
    103     * Every implementation of the Java platform is required to support this character encoding.
    104     * </p>
    105     *
    106     * @see <a href="http://download.oracle.com/javase/7/docs/api/java/nio/charset/Charset.html">Standard charsets</a>
    107     */
    108    public static final String UTF_16LE = "UTF-16LE";
    109
    110    /**
    111     * Eight-bit Unicode Transformation Format.
    112     * <p>
    113     * Every implementation of the Java platform is required to support this character encoding.
    114     * </p>
    115     *
    116     * @see <a href="http://download.oracle.com/javase/7/docs/api/java/nio/charset/Charset.html">Standard charsets</a>
    117     */
    118    public static final String UTF_8 = "UTF-8";
    119}