1 /* 2 * Copyright (C) 2010 The Android Open Source Project 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 libcore.util; 18 19 import java.nio.charset.Charset; 20 21 /** 22 * Provides convenient access to the most important built-in charsets. Saves a hash lookup and 23 * unnecessary handling of UnsupportedEncodingException at call sites, compared to using the 24 * charset's name. 25 * 26 * Also various special-case charset conversions (for performance). 27 * 28 * @hide internal use only 29 */ 30 public final class Charsets { 31 /** 32 * A cheap and type-safe constant for the ISO-8859-1 Charset. 33 */ 34 public static final Charset ISO_8859_1 = Charset.forName("ISO-8859-1"); 35 36 /** 37 * A cheap and type-safe constant for the US-ASCII Charset. 38 */ 39 public static final Charset US_ASCII = Charset.forName("US-ASCII"); 40 41 /** 42 * A cheap and type-safe constant for the UTF-8 Charset. 43 */ 44 public static final Charset UTF_8 = Charset.forName("UTF-8"); 45 Charsets()46 private Charsets() { 47 } 48 } 49