Home | History | Annotate | Download | only in charset
      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 final class CharsetICU extends Charset {
     15     private final String icuCanonicalName;
     16 
     17     protected CharsetICU(String canonicalName, String icuCanonName, String[] aliases) {
     18          super(canonicalName, aliases);
     19          icuCanonicalName = icuCanonName;
     20     }
     21 
     22     public CharsetDecoder newDecoder() {
     23         return CharsetDecoderICU.newInstance(this, icuCanonicalName);
     24     }
     25 
     26     public CharsetEncoder newEncoder() {
     27         return CharsetEncoderICU.newInstance(this, icuCanonicalName);
     28     }
     29 
     30     public boolean contains(Charset cs) {
     31         if (cs == null) {
     32             return false;
     33         } else if (this.equals(cs)) {
     34             return true;
     35         }
     36         return NativeConverter.contains(this.name(), cs.name());
     37     }
     38 }
     39