1 /*
2 * Licensed to the Apache Software Foundation (ASF) under one
3 * or more contributor license agreements. See the NOTICE file
4 * distributed with this work for additional information
5 * regarding copyright ownership. The ASF licenses this file
6 * to you under the Apache License, Version 2.0 (the
7 * "License"); you may not use this file except in compliance
8 * with the License. You may obtain a copy of the License at
9 *
10 * https://www.apache.org/licenses/LICENSE-2.0
11 *
12 * Unless required by applicable law or agreed to in writing,
13 * software distributed under the License is distributed on an
14 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15 * KIND, either express or implied. See the License for the
16 * specific language governing permissions and limitations
17 * under the License.
18 */
19
20 package org.apache.commons.compress.utils;
21
22 import java.nio.charset.StandardCharsets;
23
24 /**
25 * Character encoding names required of every implementation of the Java platform.
26 *
27 * From the Java documentation <a href="https://docs.oracle.com/javase/8/docs/api/java/nio/charset/Charset.html">Standard charsets</a>:
28 * <p>
29 * <cite>Every implementation of the Java platform is required to support the following character encodings. Consult the release documentation for your
30 * implementation to see if any other encodings are supported. Consult the release documentation for your implementation to see if any other encodings are
31 * supported. </cite>
32 * </p>
33 *
34 * <dl>
35 * <dt>{@code US-ASCII}</dt>
36 * <dd>Seven-bit ASCII, a.k.a. ISO646-US, a.k.a. the Basic Latin block of the Unicode character set.</dd>
37 * <dt>{@code ISO-8859-1}</dt>
38 * <dd>ISO Latin Alphabet No. 1, a.k.a. ISO-LATIN-1.</dd>
39 * <dt>{@code UTF-8}</dt>
40 * <dd>Eight-bit Unicode Transformation Format.</dd>
41 * <dt>{@code UTF-16BE}</dt>
42 * <dd>Sixteen-bit Unicode Transformation Format, big-endian byte order.</dd>
43 * <dt>{@code UTF-16LE}</dt>
44 * <dd>Sixteen-bit Unicode Transformation Format, little-endian byte order.</dd>
45 * <dt>{@code UTF-16}</dt>
46 * <dd>Sixteen-bit Unicode Transformation Format, byte order specified by a mandatory initial byte-order mark (either order accepted on input, big-endian used
47 * on output.)</dd>
48 * </dl>
49 *
50 * <p>
51 * 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
52 * depend on [lang].
53 * </p>
54 *
55 * @see <a href="https://docs.oracle.com/javase/8/docs/api/java/nio/charset/Charset.html">Standard charsets</a>
56 * @since 1.4
57 * @deprecated Use {@link StandardCharsets}.
58 */
59 @Deprecated
60 public class CharsetNames {
61 /**
62 * ISO Latin Alphabet No. 1, a.k.a. ISO-LATIN-1.
63 * <p>
64 * Every implementation of the Java platform is required to support this character encoding.
65 * </p>
66 *
67 * @see <a href="https://docs.oracle.com/javase/8/docs/api/java/nio/charset/Charset.html">Standard charsets</a>
68 */
69 public static final String ISO_8859_1 = StandardCharsets.ISO_8859_1.name();
70
71 /**
72 * <p>
73 * Seven-bit ASCII, also known as ISO646-US, also known as the Basic Latin block of the Unicode character set.
74 * </p>
75 * <p>
76 * Every implementation of the Java platform is required to support this character encoding.
77 * </p>
78 *
79 * @see <a href="https://docs.oracle.com/javase/8/docs/api/java/nio/charset/Charset.html">Standard charsets</a>
80 */
81 public static final String US_ASCII = StandardCharsets.US_ASCII.name();
82
83 /**
84 * <p>
85 * Sixteen-bit Unicode Transformation Format, The byte order specified by a mandatory initial byte-order mark (either order accepted on input, big-endian
86 * used on output)
87 * </p>
88 * <p>
89 * Every implementation of the Java platform is required to support this character encoding.
90 * </p>
91 *
92 * @see <a href="https://docs.oracle.com/javase/8/docs/api/java/nio/charset/Charset.html">Standard charsets</a>
93 */
94 public static final String UTF_16 = StandardCharsets.UTF_16.name();
95
96 /**
97 * <p>
98 * Sixteen-bit Unicode Transformation Format, big-endian byte order.
99 * </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 }