1 /** 2 ******************************************************************************* 3 * Copyright (C) 1996-2005, International Business Machines Corporation and * 4 * others. All Rights Reserved. * 5 ******************************************************************************* 6 * 7 ******************************************************************************* 8 */ 9 10 package java.nio.charset; 11 12 import libcore.icu.NativeConverter; 13 14 /** 15 * This class is used from native code associated with {@link NativeConverter}. 16 */ 17 final class CharsetICU extends Charset { 18 private final String icuCanonicalName; 19 20 protected CharsetICU(String canonicalName, String icuCanonName, String[] aliases) { 21 super(canonicalName, aliases); 22 icuCanonicalName = icuCanonName; 23 } 24 25 public CharsetDecoder newDecoder() { 26 return CharsetDecoderICU.newInstance(this, icuCanonicalName); 27 } 28 29 public CharsetEncoder newEncoder() { 30 return CharsetEncoderICU.newInstance(this, icuCanonicalName); 31 } 32 33 public boolean contains(Charset cs) { 34 if (cs == null) { 35 return false; 36 } else if (this.equals(cs)) { 37 return true; 38 } 39 return NativeConverter.contains(this.name(), cs.name()); 40 } 41 } 42