jdk/test/sun/nio/cs/X11CNS11643.java
author never
Mon, 12 Jul 2010 22:27:18 -0700
changeset 5926 a36f90d986b6
parent 5506 202f599c92aa
child 21596 0e3a39f29dbc
permissions -rw-r--r--
6968385: malformed xml in sweeper logging Reviewed-by: kvn
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2914
1375969fd02e 6843079: Putback for the new EUC_TW is not complete
sherman
parents:
diff changeset
     1
/*
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2914
diff changeset
     2
 * Copyright (c) 2001, 2005, Oracle and/or its affiliates. All rights reserved.
2914
1375969fd02e 6843079: Putback for the new EUC_TW is not complete
sherman
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
1375969fd02e 6843079: Putback for the new EUC_TW is not complete
sherman
parents:
diff changeset
     4
 *
1375969fd02e 6843079: Putback for the new EUC_TW is not complete
sherman
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
1375969fd02e 6843079: Putback for the new EUC_TW is not complete
sherman
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2914
diff changeset
     7
 * published by the Free Software Foundation.  Oracle designates this
2914
1375969fd02e 6843079: Putback for the new EUC_TW is not complete
sherman
parents:
diff changeset
     8
 * particular file as subject to the "Classpath" exception as provided
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2914
diff changeset
     9
 * by Oracle in the LICENSE file that accompanied this code.
2914
1375969fd02e 6843079: Putback for the new EUC_TW is not complete
sherman
parents:
diff changeset
    10
 *
1375969fd02e 6843079: Putback for the new EUC_TW is not complete
sherman
parents:
diff changeset
    11
 * This code is distributed in the hope that it will be useful, but WITHOUT
1375969fd02e 6843079: Putback for the new EUC_TW is not complete
sherman
parents:
diff changeset
    12
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
1375969fd02e 6843079: Putback for the new EUC_TW is not complete
sherman
parents:
diff changeset
    13
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
1375969fd02e 6843079: Putback for the new EUC_TW is not complete
sherman
parents:
diff changeset
    14
 * version 2 for more details (a copy is included in the LICENSE file that
1375969fd02e 6843079: Putback for the new EUC_TW is not complete
sherman
parents:
diff changeset
    15
 * accompanied this code).
1375969fd02e 6843079: Putback for the new EUC_TW is not complete
sherman
parents:
diff changeset
    16
 *
1375969fd02e 6843079: Putback for the new EUC_TW is not complete
sherman
parents:
diff changeset
    17
 * You should have received a copy of the GNU General Public License version
1375969fd02e 6843079: Putback for the new EUC_TW is not complete
sherman
parents:
diff changeset
    18
 * 2 along with this work; if not, write to the Free Software Foundation,
1375969fd02e 6843079: Putback for the new EUC_TW is not complete
sherman
parents:
diff changeset
    19
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
1375969fd02e 6843079: Putback for the new EUC_TW is not complete
sherman
parents:
diff changeset
    20
 *
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2914
diff changeset
    21
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2914
diff changeset
    22
 * or visit www.oracle.com if you need additional information or have any
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2914
diff changeset
    23
 * questions.
2914
1375969fd02e 6843079: Putback for the new EUC_TW is not complete
sherman
parents:
diff changeset
    24
 */
1375969fd02e 6843079: Putback for the new EUC_TW is not complete
sherman
parents:
diff changeset
    25
1375969fd02e 6843079: Putback for the new EUC_TW is not complete
sherman
parents:
diff changeset
    26
import java.nio.CharBuffer;
1375969fd02e 6843079: Putback for the new EUC_TW is not complete
sherman
parents:
diff changeset
    27
import java.nio.ByteBuffer;
1375969fd02e 6843079: Putback for the new EUC_TW is not complete
sherman
parents:
diff changeset
    28
import java.nio.charset.*;
1375969fd02e 6843079: Putback for the new EUC_TW is not complete
sherman
parents:
diff changeset
    29
import sun.nio.cs.ext.EUC_TW;
1375969fd02e 6843079: Putback for the new EUC_TW is not complete
sherman
parents:
diff changeset
    30
1375969fd02e 6843079: Putback for the new EUC_TW is not complete
sherman
parents:
diff changeset
    31
public abstract class X11CNS11643 extends Charset {
1375969fd02e 6843079: Putback for the new EUC_TW is not complete
sherman
parents:
diff changeset
    32
    private final int plane;
1375969fd02e 6843079: Putback for the new EUC_TW is not complete
sherman
parents:
diff changeset
    33
    public X11CNS11643 (int plane, String name) {
1375969fd02e 6843079: Putback for the new EUC_TW is not complete
sherman
parents:
diff changeset
    34
        super(name, null);
1375969fd02e 6843079: Putback for the new EUC_TW is not complete
sherman
parents:
diff changeset
    35
        switch (plane) {
1375969fd02e 6843079: Putback for the new EUC_TW is not complete
sherman
parents:
diff changeset
    36
        case 1:
1375969fd02e 6843079: Putback for the new EUC_TW is not complete
sherman
parents:
diff changeset
    37
            this.plane = 0; // CS1
1375969fd02e 6843079: Putback for the new EUC_TW is not complete
sherman
parents:
diff changeset
    38
            break;
1375969fd02e 6843079: Putback for the new EUC_TW is not complete
sherman
parents:
diff changeset
    39
        case 2:
1375969fd02e 6843079: Putback for the new EUC_TW is not complete
sherman
parents:
diff changeset
    40
        case 3:
1375969fd02e 6843079: Putback for the new EUC_TW is not complete
sherman
parents:
diff changeset
    41
            this.plane = plane;
1375969fd02e 6843079: Putback for the new EUC_TW is not complete
sherman
parents:
diff changeset
    42
            break;
1375969fd02e 6843079: Putback for the new EUC_TW is not complete
sherman
parents:
diff changeset
    43
        default:
1375969fd02e 6843079: Putback for the new EUC_TW is not complete
sherman
parents:
diff changeset
    44
            throw new IllegalArgumentException
1375969fd02e 6843079: Putback for the new EUC_TW is not complete
sherman
parents:
diff changeset
    45
                ("Only planes 1, 2, and 3 supported");
1375969fd02e 6843079: Putback for the new EUC_TW is not complete
sherman
parents:
diff changeset
    46
        }
1375969fd02e 6843079: Putback for the new EUC_TW is not complete
sherman
parents:
diff changeset
    47
    }
1375969fd02e 6843079: Putback for the new EUC_TW is not complete
sherman
parents:
diff changeset
    48
1375969fd02e 6843079: Putback for the new EUC_TW is not complete
sherman
parents:
diff changeset
    49
    public CharsetEncoder newEncoder() {
1375969fd02e 6843079: Putback for the new EUC_TW is not complete
sherman
parents:
diff changeset
    50
        return new Encoder(this, plane);
1375969fd02e 6843079: Putback for the new EUC_TW is not complete
sherman
parents:
diff changeset
    51
    }
1375969fd02e 6843079: Putback for the new EUC_TW is not complete
sherman
parents:
diff changeset
    52
1375969fd02e 6843079: Putback for the new EUC_TW is not complete
sherman
parents:
diff changeset
    53
    public CharsetDecoder newDecoder() {
1375969fd02e 6843079: Putback for the new EUC_TW is not complete
sherman
parents:
diff changeset
    54
        return new Decoder(this, plane);
1375969fd02e 6843079: Putback for the new EUC_TW is not complete
sherman
parents:
diff changeset
    55
    }
1375969fd02e 6843079: Putback for the new EUC_TW is not complete
sherman
parents:
diff changeset
    56
1375969fd02e 6843079: Putback for the new EUC_TW is not complete
sherman
parents:
diff changeset
    57
    public boolean contains(Charset cs) {
1375969fd02e 6843079: Putback for the new EUC_TW is not complete
sherman
parents:
diff changeset
    58
        return cs instanceof X11CNS11643;
1375969fd02e 6843079: Putback for the new EUC_TW is not complete
sherman
parents:
diff changeset
    59
    }
1375969fd02e 6843079: Putback for the new EUC_TW is not complete
sherman
parents:
diff changeset
    60
1375969fd02e 6843079: Putback for the new EUC_TW is not complete
sherman
parents:
diff changeset
    61
    private class Encoder extends EUC_TW_OLD.Encoder {
1375969fd02e 6843079: Putback for the new EUC_TW is not complete
sherman
parents:
diff changeset
    62
        private int plane;
1375969fd02e 6843079: Putback for the new EUC_TW is not complete
sherman
parents:
diff changeset
    63
        public Encoder(Charset cs, int plane) {
1375969fd02e 6843079: Putback for the new EUC_TW is not complete
sherman
parents:
diff changeset
    64
            super(cs);
1375969fd02e 6843079: Putback for the new EUC_TW is not complete
sherman
parents:
diff changeset
    65
            this.plane = plane;
1375969fd02e 6843079: Putback for the new EUC_TW is not complete
sherman
parents:
diff changeset
    66
        }
1375969fd02e 6843079: Putback for the new EUC_TW is not complete
sherman
parents:
diff changeset
    67
        public boolean canEncode(char c) {
1375969fd02e 6843079: Putback for the new EUC_TW is not complete
sherman
parents:
diff changeset
    68
            if (c <= 0x7F) {
1375969fd02e 6843079: Putback for the new EUC_TW is not complete
sherman
parents:
diff changeset
    69
                return false;
1375969fd02e 6843079: Putback for the new EUC_TW is not complete
sherman
parents:
diff changeset
    70
            }
1375969fd02e 6843079: Putback for the new EUC_TW is not complete
sherman
parents:
diff changeset
    71
            int p = getNative(c) >> 16;
1375969fd02e 6843079: Putback for the new EUC_TW is not complete
sherman
parents:
diff changeset
    72
            if (p == 1 && plane == 0 ||
1375969fd02e 6843079: Putback for the new EUC_TW is not complete
sherman
parents:
diff changeset
    73
                p == 2 && plane == 2 ||
1375969fd02e 6843079: Putback for the new EUC_TW is not complete
sherman
parents:
diff changeset
    74
                p == 3 && plane == 3)
1375969fd02e 6843079: Putback for the new EUC_TW is not complete
sherman
parents:
diff changeset
    75
                return true;
1375969fd02e 6843079: Putback for the new EUC_TW is not complete
sherman
parents:
diff changeset
    76
            return false;
1375969fd02e 6843079: Putback for the new EUC_TW is not complete
sherman
parents:
diff changeset
    77
        }
1375969fd02e 6843079: Putback for the new EUC_TW is not complete
sherman
parents:
diff changeset
    78
1375969fd02e 6843079: Putback for the new EUC_TW is not complete
sherman
parents:
diff changeset
    79
        public boolean isLegalReplacement(byte[] repl) {
1375969fd02e 6843079: Putback for the new EUC_TW is not complete
sherman
parents:
diff changeset
    80
            return true;
1375969fd02e 6843079: Putback for the new EUC_TW is not complete
sherman
parents:
diff changeset
    81
        }
1375969fd02e 6843079: Putback for the new EUC_TW is not complete
sherman
parents:
diff changeset
    82
1375969fd02e 6843079: Putback for the new EUC_TW is not complete
sherman
parents:
diff changeset
    83
        protected CoderResult encodeLoop(CharBuffer src, ByteBuffer dst) {
1375969fd02e 6843079: Putback for the new EUC_TW is not complete
sherman
parents:
diff changeset
    84
            char[] sa = src.array();
1375969fd02e 6843079: Putback for the new EUC_TW is not complete
sherman
parents:
diff changeset
    85
            int sp = src.arrayOffset() + src.position();
1375969fd02e 6843079: Putback for the new EUC_TW is not complete
sherman
parents:
diff changeset
    86
            int sl = src.arrayOffset() + src.limit();
1375969fd02e 6843079: Putback for the new EUC_TW is not complete
sherman
parents:
diff changeset
    87
            byte[] da = dst.array();
1375969fd02e 6843079: Putback for the new EUC_TW is not complete
sherman
parents:
diff changeset
    88
            int dp = dst.arrayOffset() + dst.position();
1375969fd02e 6843079: Putback for the new EUC_TW is not complete
sherman
parents:
diff changeset
    89
            int dl = dst.arrayOffset() + dst.limit();
1375969fd02e 6843079: Putback for the new EUC_TW is not complete
sherman
parents:
diff changeset
    90
1375969fd02e 6843079: Putback for the new EUC_TW is not complete
sherman
parents:
diff changeset
    91
            try {
1375969fd02e 6843079: Putback for the new EUC_TW is not complete
sherman
parents:
diff changeset
    92
                while (sp < sl) {
1375969fd02e 6843079: Putback for the new EUC_TW is not complete
sherman
parents:
diff changeset
    93
                    char c = sa[sp];
1375969fd02e 6843079: Putback for the new EUC_TW is not complete
sherman
parents:
diff changeset
    94
                    if (c >= '\uFFFE' || c <= '\u007f')
1375969fd02e 6843079: Putback for the new EUC_TW is not complete
sherman
parents:
diff changeset
    95
                        return CoderResult.unmappableForLength(1);
1375969fd02e 6843079: Putback for the new EUC_TW is not complete
sherman
parents:
diff changeset
    96
                    int cns = getNative(c);
1375969fd02e 6843079: Putback for the new EUC_TW is not complete
sherman
parents:
diff changeset
    97
                    int p = cns >> 16;
1375969fd02e 6843079: Putback for the new EUC_TW is not complete
sherman
parents:
diff changeset
    98
                    if (p == 1 && plane == 0 ||
1375969fd02e 6843079: Putback for the new EUC_TW is not complete
sherman
parents:
diff changeset
    99
                        p == 2 && plane == 2 ||
1375969fd02e 6843079: Putback for the new EUC_TW is not complete
sherman
parents:
diff changeset
   100
                        p == 3 && plane == 3) {
1375969fd02e 6843079: Putback for the new EUC_TW is not complete
sherman
parents:
diff changeset
   101
                        if (dl - dp < 2)
1375969fd02e 6843079: Putback for the new EUC_TW is not complete
sherman
parents:
diff changeset
   102
                            return CoderResult.OVERFLOW;
1375969fd02e 6843079: Putback for the new EUC_TW is not complete
sherman
parents:
diff changeset
   103
                        da[dp++] = (byte) ((cns  >> 8) & 0x7f);
1375969fd02e 6843079: Putback for the new EUC_TW is not complete
sherman
parents:
diff changeset
   104
                        da[dp++] = (byte) (cns & 0x7f);
1375969fd02e 6843079: Putback for the new EUC_TW is not complete
sherman
parents:
diff changeset
   105
                        sp++;
1375969fd02e 6843079: Putback for the new EUC_TW is not complete
sherman
parents:
diff changeset
   106
                        continue;
1375969fd02e 6843079: Putback for the new EUC_TW is not complete
sherman
parents:
diff changeset
   107
                    }
1375969fd02e 6843079: Putback for the new EUC_TW is not complete
sherman
parents:
diff changeset
   108
                    return CoderResult.unmappableForLength(1);
1375969fd02e 6843079: Putback for the new EUC_TW is not complete
sherman
parents:
diff changeset
   109
                }
1375969fd02e 6843079: Putback for the new EUC_TW is not complete
sherman
parents:
diff changeset
   110
                return CoderResult.UNDERFLOW;
1375969fd02e 6843079: Putback for the new EUC_TW is not complete
sherman
parents:
diff changeset
   111
            } finally {
1375969fd02e 6843079: Putback for the new EUC_TW is not complete
sherman
parents:
diff changeset
   112
                src.position(sp - src.arrayOffset());
1375969fd02e 6843079: Putback for the new EUC_TW is not complete
sherman
parents:
diff changeset
   113
                dst.position(dp - dst.arrayOffset());
1375969fd02e 6843079: Putback for the new EUC_TW is not complete
sherman
parents:
diff changeset
   114
            }
1375969fd02e 6843079: Putback for the new EUC_TW is not complete
sherman
parents:
diff changeset
   115
        }
1375969fd02e 6843079: Putback for the new EUC_TW is not complete
sherman
parents:
diff changeset
   116
    }
1375969fd02e 6843079: Putback for the new EUC_TW is not complete
sherman
parents:
diff changeset
   117
1375969fd02e 6843079: Putback for the new EUC_TW is not complete
sherman
parents:
diff changeset
   118
    private class Decoder extends EUC_TW_OLD.Decoder {
1375969fd02e 6843079: Putback for the new EUC_TW is not complete
sherman
parents:
diff changeset
   119
        private String table;
1375969fd02e 6843079: Putback for the new EUC_TW is not complete
sherman
parents:
diff changeset
   120
        protected Decoder(Charset cs, int plane) {
1375969fd02e 6843079: Putback for the new EUC_TW is not complete
sherman
parents:
diff changeset
   121
            super(cs);
1375969fd02e 6843079: Putback for the new EUC_TW is not complete
sherman
parents:
diff changeset
   122
            switch (plane) {
1375969fd02e 6843079: Putback for the new EUC_TW is not complete
sherman
parents:
diff changeset
   123
            case 0:
1375969fd02e 6843079: Putback for the new EUC_TW is not complete
sherman
parents:
diff changeset
   124
                table = unicodeCNS1;
1375969fd02e 6843079: Putback for the new EUC_TW is not complete
sherman
parents:
diff changeset
   125
                break;
1375969fd02e 6843079: Putback for the new EUC_TW is not complete
sherman
parents:
diff changeset
   126
            case 2:
1375969fd02e 6843079: Putback for the new EUC_TW is not complete
sherman
parents:
diff changeset
   127
                table = unicodeCNS2;
1375969fd02e 6843079: Putback for the new EUC_TW is not complete
sherman
parents:
diff changeset
   128
                break;
1375969fd02e 6843079: Putback for the new EUC_TW is not complete
sherman
parents:
diff changeset
   129
            case 3:
1375969fd02e 6843079: Putback for the new EUC_TW is not complete
sherman
parents:
diff changeset
   130
                table = unicodeCNS3;
1375969fd02e 6843079: Putback for the new EUC_TW is not complete
sherman
parents:
diff changeset
   131
                break;
1375969fd02e 6843079: Putback for the new EUC_TW is not complete
sherman
parents:
diff changeset
   132
            default:
1375969fd02e 6843079: Putback for the new EUC_TW is not complete
sherman
parents:
diff changeset
   133
                throw new IllegalArgumentException
1375969fd02e 6843079: Putback for the new EUC_TW is not complete
sherman
parents:
diff changeset
   134
                    ("Only planes 1, 2, and 3 supported");
1375969fd02e 6843079: Putback for the new EUC_TW is not complete
sherman
parents:
diff changeset
   135
            }
1375969fd02e 6843079: Putback for the new EUC_TW is not complete
sherman
parents:
diff changeset
   136
        }
1375969fd02e 6843079: Putback for the new EUC_TW is not complete
sherman
parents:
diff changeset
   137
1375969fd02e 6843079: Putback for the new EUC_TW is not complete
sherman
parents:
diff changeset
   138
        //we only work on array backed buffer.
1375969fd02e 6843079: Putback for the new EUC_TW is not complete
sherman
parents:
diff changeset
   139
        protected CoderResult decodeLoop(ByteBuffer src, CharBuffer dst) {
1375969fd02e 6843079: Putback for the new EUC_TW is not complete
sherman
parents:
diff changeset
   140
            byte[] sa = src.array();
1375969fd02e 6843079: Putback for the new EUC_TW is not complete
sherman
parents:
diff changeset
   141
            int sp = src.arrayOffset() + src.position();
1375969fd02e 6843079: Putback for the new EUC_TW is not complete
sherman
parents:
diff changeset
   142
            int sl = src.arrayOffset() + src.limit();
1375969fd02e 6843079: Putback for the new EUC_TW is not complete
sherman
parents:
diff changeset
   143
            assert (sp <= sl);
1375969fd02e 6843079: Putback for the new EUC_TW is not complete
sherman
parents:
diff changeset
   144
            sp = (sp <= sl ? sp : sl);
1375969fd02e 6843079: Putback for the new EUC_TW is not complete
sherman
parents:
diff changeset
   145
1375969fd02e 6843079: Putback for the new EUC_TW is not complete
sherman
parents:
diff changeset
   146
            char[] da = dst.array();
1375969fd02e 6843079: Putback for the new EUC_TW is not complete
sherman
parents:
diff changeset
   147
            int dp = dst.arrayOffset() + dst.position();
1375969fd02e 6843079: Putback for the new EUC_TW is not complete
sherman
parents:
diff changeset
   148
            int dl = dst.arrayOffset() + dst.limit();
1375969fd02e 6843079: Putback for the new EUC_TW is not complete
sherman
parents:
diff changeset
   149
            assert (dp <= dl);
1375969fd02e 6843079: Putback for the new EUC_TW is not complete
sherman
parents:
diff changeset
   150
            dp = (dp <= dl ? dp : dl);
1375969fd02e 6843079: Putback for the new EUC_TW is not complete
sherman
parents:
diff changeset
   151
1375969fd02e 6843079: Putback for the new EUC_TW is not complete
sherman
parents:
diff changeset
   152
            try {
1375969fd02e 6843079: Putback for the new EUC_TW is not complete
sherman
parents:
diff changeset
   153
                while (sp < sl) {
1375969fd02e 6843079: Putback for the new EUC_TW is not complete
sherman
parents:
diff changeset
   154
                    if ( sl - sp < 2) {
1375969fd02e 6843079: Putback for the new EUC_TW is not complete
sherman
parents:
diff changeset
   155
                        return CoderResult.UNDERFLOW;
1375969fd02e 6843079: Putback for the new EUC_TW is not complete
sherman
parents:
diff changeset
   156
                    }
1375969fd02e 6843079: Putback for the new EUC_TW is not complete
sherman
parents:
diff changeset
   157
                    byte b1 = sa[sp];
1375969fd02e 6843079: Putback for the new EUC_TW is not complete
sherman
parents:
diff changeset
   158
                    byte b2 = sa[sp + 1];
1375969fd02e 6843079: Putback for the new EUC_TW is not complete
sherman
parents:
diff changeset
   159
                    char c = replacement().charAt(0);
1375969fd02e 6843079: Putback for the new EUC_TW is not complete
sherman
parents:
diff changeset
   160
1375969fd02e 6843079: Putback for the new EUC_TW is not complete
sherman
parents:
diff changeset
   161
                    if (table == unicodeCNS3) {
1375969fd02e 6843079: Putback for the new EUC_TW is not complete
sherman
parents:
diff changeset
   162
                        char[] cc = convToSurrogate((byte)(b1 | 0x80),
1375969fd02e 6843079: Putback for the new EUC_TW is not complete
sherman
parents:
diff changeset
   163
                                                    (byte)(b2 | 0x80),
1375969fd02e 6843079: Putback for the new EUC_TW is not complete
sherman
parents:
diff changeset
   164
                                                    table);
1375969fd02e 6843079: Putback for the new EUC_TW is not complete
sherman
parents:
diff changeset
   165
                        if (cc != null && cc[0] == '\u0000')
1375969fd02e 6843079: Putback for the new EUC_TW is not complete
sherman
parents:
diff changeset
   166
                            c = cc[1];
1375969fd02e 6843079: Putback for the new EUC_TW is not complete
sherman
parents:
diff changeset
   167
                    } else {
1375969fd02e 6843079: Putback for the new EUC_TW is not complete
sherman
parents:
diff changeset
   168
                        c = convToUnicode((byte)(b1 | 0x80),
1375969fd02e 6843079: Putback for the new EUC_TW is not complete
sherman
parents:
diff changeset
   169
                                           (byte)(b2 | 0x80),
1375969fd02e 6843079: Putback for the new EUC_TW is not complete
sherman
parents:
diff changeset
   170
                                           table);
1375969fd02e 6843079: Putback for the new EUC_TW is not complete
sherman
parents:
diff changeset
   171
                    }
1375969fd02e 6843079: Putback for the new EUC_TW is not complete
sherman
parents:
diff changeset
   172
                    if (c == replacement().charAt(0)
1375969fd02e 6843079: Putback for the new EUC_TW is not complete
sherman
parents:
diff changeset
   173
                        //to keep the compatibility with b2cX11CNS11643
1375969fd02e 6843079: Putback for the new EUC_TW is not complete
sherman
parents:
diff changeset
   174
                        /*|| c == '\u0000'*/) {
1375969fd02e 6843079: Putback for the new EUC_TW is not complete
sherman
parents:
diff changeset
   175
                        return CoderResult.unmappableForLength(2);
1375969fd02e 6843079: Putback for the new EUC_TW is not complete
sherman
parents:
diff changeset
   176
                    }
1375969fd02e 6843079: Putback for the new EUC_TW is not complete
sherman
parents:
diff changeset
   177
                    if (dl - dp < 1)
1375969fd02e 6843079: Putback for the new EUC_TW is not complete
sherman
parents:
diff changeset
   178
                        return CoderResult.OVERFLOW;
1375969fd02e 6843079: Putback for the new EUC_TW is not complete
sherman
parents:
diff changeset
   179
                    da[dp++] = c;
1375969fd02e 6843079: Putback for the new EUC_TW is not complete
sherman
parents:
diff changeset
   180
                    sp +=2;
1375969fd02e 6843079: Putback for the new EUC_TW is not complete
sherman
parents:
diff changeset
   181
                }
1375969fd02e 6843079: Putback for the new EUC_TW is not complete
sherman
parents:
diff changeset
   182
                return CoderResult.UNDERFLOW;
1375969fd02e 6843079: Putback for the new EUC_TW is not complete
sherman
parents:
diff changeset
   183
            } finally {
1375969fd02e 6843079: Putback for the new EUC_TW is not complete
sherman
parents:
diff changeset
   184
                src.position(sp - src.arrayOffset());
1375969fd02e 6843079: Putback for the new EUC_TW is not complete
sherman
parents:
diff changeset
   185
                dst.position(dp - dst.arrayOffset());
1375969fd02e 6843079: Putback for the new EUC_TW is not complete
sherman
parents:
diff changeset
   186
            }
1375969fd02e 6843079: Putback for the new EUC_TW is not complete
sherman
parents:
diff changeset
   187
        }
1375969fd02e 6843079: Putback for the new EUC_TW is not complete
sherman
parents:
diff changeset
   188
    }
1375969fd02e 6843079: Putback for the new EUC_TW is not complete
sherman
parents:
diff changeset
   189
}