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.compress.utils; 019 020import java.nio.charset.StandardCharsets; 021 022/** 023 * Character encoding names required of every implementation of the Java platform. 024 * 025 * From the Java documentation <a href="https://docs.oracle.com/javase/8/docs/api/java/nio/charset/Charset.html">Standard charsets</a>: 026 * <p> 027 * <cite>Every implementation of the Java platform is required to support the following character encodings. Consult the release documentation for your 028 * implementation to see if any other encodings are supported. Consult the release documentation for your implementation to see if any other encodings are 029 * supported. </cite> 030 * </p> 031 * 032 * <dl> 033 * <dt>{@code US-ASCII}</dt> 034 * <dd>Seven-bit ASCII, a.k.a. ISO646-US, a.k.a. the Basic Latin block of the Unicode character set.</dd> 035 * <dt>{@code ISO-8859-1}</dt> 036 * <dd>ISO Latin Alphabet No. 1, a.k.a. ISO-LATIN-1.</dd> 037 * <dt>{@code UTF-8}</dt> 038 * <dd>Eight-bit Unicode Transformation Format.</dd> 039 * <dt>{@code UTF-16BE}</dt> 040 * <dd>Sixteen-bit Unicode Transformation Format, big-endian byte order.</dd> 041 * <dt>{@code UTF-16LE}</dt> 042 * <dd>Sixteen-bit Unicode Transformation Format, little-endian byte order.</dd> 043 * <dt>{@code UTF-16}</dt> 044 * <dd>Sixteen-bit Unicode Transformation Format, byte order specified by a mandatory initial byte-order mark (either order accepted on input, big-endian used 045 * on output.)</dd> 046 * </dl> 047 * 048 * <p> 049 * 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 050 * depend on [lang]. 051 * </p> 052 * 053 * @see <a href="https://docs.oracle.com/javase/8/docs/api/java/nio/charset/Charset.html">Standard charsets</a> 054 * @since 1.4 055 * @deprecated Use {@link StandardCharsets}. 056 */ 057@Deprecated 058public class CharsetNames { 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="https://docs.oracle.com/javase/8/docs/api/java/nio/charset/Charset.html">Standard charsets</a> 066 */ 067 public static final String ISO_8859_1 = StandardCharsets.ISO_8859_1.name(); 068 069 /** 070 * <p> 071 * Seven-bit ASCII, also known as ISO646-US, also known as the Basic Latin block of the Unicode character set. 072 * </p> 073 * <p> 074 * Every implementation of the Java platform is required to support this character encoding. 075 * </p> 076 * 077 * @see <a href="https://docs.oracle.com/javase/8/docs/api/java/nio/charset/Charset.html">Standard charsets</a> 078 */ 079 public static final String US_ASCII = StandardCharsets.US_ASCII.name(); 080 081 /** 082 * <p> 083 * Sixteen-bit Unicode Transformation Format, The byte order specified by a mandatory initial byte-order mark (either order accepted on input, big-endian 084 * used on output) 085 * </p> 086 * <p> 087 * Every implementation of the Java platform is required to support this character encoding. 088 * </p> 089 * 090 * @see <a href="https://docs.oracle.com/javase/8/docs/api/java/nio/charset/Charset.html">Standard charsets</a> 091 */ 092 public static final String UTF_16 = StandardCharsets.UTF_16.name(); 093 094 /** 095 * <p> 096 * Sixteen-bit Unicode Transformation Format, big-endian byte order. 097 * </p> 098 * <p> 099 * Every implementation of the Java platform is required to support this character encoding. 100 * </p> 101 * 102 * @see <a href="https://docs.oracle.com/javase/8/docs/api/java/nio/charset/Charset.html">Standard charsets</a> 103 */ 104 public static final String UTF_16BE = StandardCharsets.UTF_16BE.name(); 105 106 /** 107 * <p> 108 * Sixteen-bit Unicode Transformation Format, little-endian byte order. 109 * </p> 110 * <p> 111 * Every implementation of the Java platform is required to support this character encoding. 112 * </p> 113 * 114 * @see <a href="https://docs.oracle.com/javase/8/docs/api/java/nio/charset/Charset.html">Standard charsets</a> 115 */ 116 public static final String UTF_16LE = StandardCharsets.UTF_16LE.name(); 117 118 /** 119 * <p> 120 * Eight-bit Unicode Transformation Format. 121 * </p> 122 * <p> 123 * Every implementation of the Java platform is required to support this character encoding. 124 * </p> 125 * 126 * @see <a href="https://docs.oracle.com/javase/8/docs/api/java/nio/charset/Charset.html">Standard charsets</a> 127 */ 128 public static final String UTF_8 = StandardCharsets.UTF_8.name(); 129}