jdk/src/share/classes/sun/nio/cs/ext/ISO2022_CN_CNS.java
changeset 3623 4e71b4e83158
parent 2 90ce3da70b43
child 5506 202f599c92aa
equal deleted inserted replaced
3622:9676ac8a9bf1 3623:4e71b4e83158
    74                 Charset cset = Charset.forName("EUC_TW"); // CNS11643
    74                 Charset cset = Charset.forName("EUC_TW"); // CNS11643
    75                 ISOEncoder = cset.newEncoder();
    75                 ISOEncoder = cset.newEncoder();
    76             } catch (Exception e) { }
    76             } catch (Exception e) { }
    77         }
    77         }
    78 
    78 
       
    79         private byte[] bb = new byte[4];
       
    80         public boolean canEncode(char c) {
       
    81             int n = 0;
       
    82             return (c <= '\u007f' ||
       
    83                     (n = ((EUC_TW.Encoder)ISOEncoder).toEUC(c, bb)) == 2 ||
       
    84                     (n == 4 && bb[0] == SS2 &&
       
    85                      (bb[1] == PLANE2 || bb[1] == PLANE3)));
       
    86         }
       
    87 
    79         /*
    88         /*
    80          * Since ISO2022-CN-CNS possesses a CharsetEncoder
    89          * Since ISO2022-CN-CNS possesses a CharsetEncoder
    81          * without the corresponding CharsetDecoder half the
    90          * without the corresponding CharsetDecoder half the
    82          * default replacement check needs to be overridden
    91          * default replacement check needs to be overridden
    83          * since the parent class version attempts to
    92          * since the parent class version attempts to