• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2007 Google Inc.
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 
17 package com.google.common.base;
18 
19 import java.nio.charset.Charset;
20 
21 /**
22  * Contains constant definitions for the six standard {@link Charset}
23  * instances, which are guaranteed to be supported by all Java platform
24  * implementations.
25  *
26  * @author Mike Bostock
27  * @since 2009.09.15 <b>tentative</b>
28  */
29 public final class Charsets {
Charsets()30   private Charsets() {}
31 
32   /**
33    * US-ASCII: seven-bit ASCII, a.k.a. ISO646-US, a.k.a the Basic Latin block of
34    * the Unicode character set.
35    */
36   public static final Charset US_ASCII = Charset.forName("US-ASCII");
37 
38   /**
39    * ISO-8859-1. ISO Latin Alphabet No. 1, a.k.a. ISO-LATIN-1.
40    */
41   public static final Charset ISO_8859_1 = Charset.forName("ISO-8859-1");
42 
43   /**
44    * UTF-8: eight-bit UCS Transformation Format.
45    */
46   public static final Charset UTF_8 = Charset.forName("UTF-8");
47 
48   /**
49    * UTF-16BE: sixteen-bit UCS Transformation Format, big-endian byte order.
50    */
51   public static final Charset UTF_16BE = Charset.forName("UTF-16BE");
52 
53   /**
54    * UTF-16LE: sixteen-bit UCS Transformation Format, little-endian byte order.
55    */
56   public static final Charset UTF_16LE = Charset.forName("UTF-16LE");
57 
58   /**
59    * UTF-16: sixteen-bit UCS Transformation Format, byte order identified by an
60    * optional byte-order mark.
61    */
62   public static final Charset UTF_16 = Charset.forName("UTF-16");
63 
64   /*
65    * Please do not add new Charset references to this class, unless those
66    * character encodings are part of the set required to be supported by all
67    * Java platform implementations! Any Charsets initialized here may cause
68    * unexpected delays when this class is loaded. See the Charset Javadocs for
69    * the list of built-in character encodings.
70    */
71 }
72