Home | History | Annotate | Download | only in codec
      1 /*
      2  * Licensed to the Apache Software Foundation (ASF) under one or more
      3  * contributor license agreements.  See the NOTICE file distributed with
      4  * this work for additional information regarding copyright ownership.
      5  * The ASF licenses this file to You under the Apache License, Version 2.0
      6  * (the "License"); you may not use this file except in compliance with
      7  * the License.  You may obtain a copy of the License at
      8  *
      9  *      http://www.apache.org/licenses/LICENSE-2.0
     10  *
     11  * Unless required by applicable law or agreed to in writing, software
     12  * distributed under the License is distributed on an "AS IS" BASIS,
     13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     14  * See the License for the specific language governing permissions and
     15  * limitations under the License.
     16  */
     17 
     18 package org.apache.commons.codec;
     19 
     20 /**
     21  * Character encoding names required of every implementation of the Java platform.
     22  *
     23  * From the Java documentation <a href="http://java.sun.com/j2se/1.4.2/docs/api/java/nio/charset/Charset.html">Standard
     24  * charsets</a>:
     25  * <p>
     26  * <cite>Every implementation of the Java platform is required to support the following character encodings. Consult the
     27  * release documentation for your implementation to see if any other encodings are supported. Consult the release
     28  * documentation for your implementation to see if any other encodings are supported. </cite>
     29  * </p>
     30  *
     31  * <ul>
     32  * <li><code>US-ASCII</code><br/>
     33  * Seven-bit ASCII, a.k.a. ISO646-US, a.k.a. the Basic Latin block of the Unicode character set.</li>
     34  * <li><code>ISO-8859-1</code><br/>
     35  * ISO Latin Alphabet No. 1, a.k.a. ISO-LATIN-1.</li>
     36  * <li><code>UTF-8</code><br/>
     37  * Eight-bit Unicode Transformation Format.</li>
     38  * <li><code>UTF-16BE</code><br/>
     39  * Sixteen-bit Unicode Transformation Format, big-endian byte order.</li>
     40  * <li><code>UTF-16LE</code><br/>
     41  * Sixteen-bit Unicode Transformation Format, little-endian byte order.</li>
     42  * <li><code>UTF-16</code><br/>
     43  * Sixteen-bit Unicode Transformation Format, byte order specified by a mandatory initial byte-order mark (either order
     44  * accepted on input, big-endian used on output.)</li>
     45  * </ul>
     46  *
     47  * This perhaps would best belong in the [lang] project. Even if a similar interface is defined in [lang], it is not
     48  * forseen that [codec] would be made to depend on [lang].
     49  *
     50  * @see <a href="http://java.sun.com/j2se/1.4.2/docs/api/java/nio/charset/Charset.html">Standard charsets</a>
     51  * @since 1.4
     52  * @version $Id: CharEncoding.java 797857 2009-07-25 23:43:33Z ggregory $
     53  */
     54 public class CharEncoding {
     55     /**
     56      * CharEncodingISO Latin Alphabet No. 1, a.k.a. ISO-LATIN-1. </p>
     57      * <p>
     58      * Every implementation of the Java platform is required to support this character encoding.
     59      * </p>
     60      *
     61      * @see <a href="http://java.sun.com/j2se/1.4.2/docs/api/java/nio/charset/Charset.html">Standard charsets</a>
     62      */
     63     public static final String ISO_8859_1 = "ISO-8859-1";
     64 
     65     /**
     66      * <p>
     67      * Seven-bit ASCII, also known as ISO646-US, also known as the Basic Latin block of the Unicode character set.
     68      * </p>
     69      * <p>
     70      * Every implementation of the Java platform is required to support this character encoding.
     71      * </p>
     72      *
     73      * @see <a href="http://java.sun.com/j2se/1.4.2/docs/api/java/nio/charset/Charset.html">Standard charsets</a>
     74      */
     75     public static final String US_ASCII = "US-ASCII";
     76 
     77     /**
     78      * <p>
     79      * Sixteen-bit Unicode Transformation Format, The byte order specified by a mandatory initial byte-order mark
     80      * (either order accepted on input, big-endian used on output)
     81      * </p>
     82      * <p>
     83      * Every implementation of the Java platform is required to support this character encoding.
     84      * </p>
     85      *
     86      * @see <a href="http://java.sun.com/j2se/1.4.2/docs/api/java/nio/charset/Charset.html">Standard charsets</a>
     87      */
     88     public static final String UTF_16 = "UTF-16";
     89 
     90     /**
     91      * <p>
     92      * Sixteen-bit Unicode Transformation Format, big-endian byte order.
     93      * </p>
     94      * <p>
     95      * Every implementation of the Java platform is required to support this character encoding.
     96      * </p>
     97      *
     98      * @see <a href="http://java.sun.com/j2se/1.4.2/docs/api/java/nio/charset/Charset.html">Standard charsets</a>
     99      */
    100     public static final String UTF_16BE = "UTF-16BE";
    101 
    102     /**
    103      * <p>
    104      * Sixteen-bit Unicode Transformation Format, little-endian byte order.
    105      * </p>
    106      * <p>
    107      * Every implementation of the Java platform is required to support this character encoding.
    108      * </p>
    109      *
    110      * @see <a href="http://java.sun.com/j2se/1.4.2/docs/api/java/nio/charset/Charset.html">Standard charsets</a>
    111      */
    112     public static final String UTF_16LE = "UTF-16LE";
    113 
    114     /**
    115      * <p>
    116      * Eight-bit Unicode Transformation Format.
    117      * </p>
    118      * <p>
    119      * Every implementation of the Java platform is required to support this character encoding.
    120      * </p>
    121      *
    122      * @see <a href="http://java.sun.com/j2se/1.4.2/docs/api/java/nio/charset/Charset.html">Standard charsets</a>
    123      */
    124     public static final String UTF_8 = "UTF-8";
    125 }