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