1/*
2 * Copyright (C) 2007 The Guava Authors
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17package com.google.common.base;
18
19import java.nio.charset.Charset;
20
21/**
22 * Contains constant definitions for the six standard {@link Charset} instances, which are
23 * guaranteed to be supported by all Java platform implementations.
24 *
25 * @author Mike Bostock
26 * @since 1.0
27 */
28public final class Charsets {
29  private Charsets() {}
30
31  /**
32   * US-ASCII: seven-bit ASCII, the Basic Latin block of the Unicode character set (ISO646-US).
33   */
34  public static final Charset US_ASCII = Charset.forName("US-ASCII");
35
36  /**
37   * ISO-8859-1: ISO Latin Alphabet Number 1 (ISO-LATIN-1).
38   */
39  public static final Charset ISO_8859_1 = Charset.forName("ISO-8859-1");
40
41  /**
42   * UTF-8: eight-bit UCS Transformation Format.
43   */
44  public static final Charset UTF_8 = Charset.forName("UTF-8");
45
46  /**
47   * UTF-16BE: sixteen-bit UCS Transformation Format, big-endian byte order.
48   */
49  public static final Charset UTF_16BE = Charset.forName("UTF-16BE");
50
51  /**
52   * UTF-16LE: sixteen-bit UCS Transformation Format, little-endian byte order.
53   */
54  public static final Charset UTF_16LE = Charset.forName("UTF-16LE");
55
56  /**
57   * UTF-16: sixteen-bit UCS Transformation Format, byte order identified by an optional byte-order
58   * mark.
59   */
60  public static final Charset UTF_16 = Charset.forName("UTF-16");
61
62  /*
63   * Please do not add new Charset references to this class, unless those character encodings are
64   * part of the set required to be supported by all Java platform implementations! Any Charsets
65   * initialized here may cause unexpected delays when this class is loaded. See the Charset
66   * Javadocs for the list of built-in character encodings.
67   */
68}
69