jdk/test/sun/nio/cs/X11CNS11643.java
author serb
Tue, 12 Nov 2013 20:24:25 +0400
changeset 21596 0e3a39f29dbc
parent 5506 202f599c92aa
child 23010 6dadb192ad81
permissions -rw-r--r--
8027696: Incorrect copyright header in the tests Reviewed-by: alanb, malenkov, mullan
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
21596
0e3a39f29dbc 8027696: Incorrect copyright header in the tests
serb
parents: 5506
diff changeset
     7
 * published by the Free Software Foundation.
2914
1375969fd02e 6843079: Putback for the new EUC_TW is not complete
sherman
parents:
diff changeset
     8
 *
1375969fd02e 6843079: Putback for the new EUC_TW is not complete
sherman
parents:
diff changeset
     9
 * 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
    10
 * 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
    11
 * 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
    12
 * 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
    13
 * accompanied this code).
1375969fd02e 6843079: Putback for the new EUC_TW is not complete
sherman
parents:
diff changeset
    14
 *
1375969fd02e 6843079: Putback for the new EUC_TW is not complete
sherman
parents:
diff changeset
    15
 * 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
    16
 * 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
    17
 * 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
    18
 *
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2914
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2914
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2914
diff changeset
    21
 * questions.
2914
1375969fd02e 6843079: Putback for the new EUC_TW is not complete
sherman
parents:
diff changeset
    22
 */
1375969fd02e 6843079: Putback for the new EUC_TW is not complete
sherman
parents:
diff changeset
    23
1375969fd02e 6843079: Putback for the new EUC_TW is not complete
sherman
parents:
diff changeset
    24
import java.nio.CharBuffer;
1375969fd02e 6843079: Putback for the new EUC_TW is not complete
sherman
parents:
diff changeset
    25
import java.nio.ByteBuffer;
1375969fd02e 6843079: Putback for the new EUC_TW is not complete
sherman
parents:
diff changeset
    26
import java.nio.charset.*;
1375969fd02e 6843079: Putback for the new EUC_TW is not complete
sherman
parents:
diff changeset
    27
import sun.nio.cs.ext.EUC_TW;
1375969fd02e 6843079: Putback for the new EUC_TW is not complete
sherman
parents:
diff changeset
    28
1375969fd02e 6843079: Putback for the new EUC_TW is not complete
sherman
parents:
diff changeset
    29
public abstract class X11CNS11643 extends Charset {
1375969fd02e 6843079: Putback for the new EUC_TW is not complete
sherman
parents:
diff changeset
    30
    private final int plane;
1375969fd02e 6843079: Putback for the new EUC_TW is not complete
sherman
parents:
diff changeset
    31
    public X11CNS11643 (int plane, String name) {
1375969fd02e 6843079: Putback for the new EUC_TW is not complete
sherman
parents:
diff changeset
    32
        super(name, null);
1375969fd02e 6843079: Putback for the new EUC_TW is not complete
sherman
parents:
diff changeset
    33
        switch (plane) {
1375969fd02e 6843079: Putback for the new EUC_TW is not complete
sherman
parents:
diff changeset
    34
        case 1:
1375969fd02e 6843079: Putback for the new EUC_TW is not complete
sherman
parents:
diff changeset
    35
            this.plane = 0; // CS1
1375969fd02e 6843079: Putback for the new EUC_TW is not complete
sherman
parents:
diff changeset
    36
            break;
1375969fd02e 6843079: Putback for the new EUC_TW is not complete
sherman
parents:
diff changeset
    37
        case 2:
1375969fd02e 6843079: Putback for the new EUC_TW is not complete
sherman
parents:
diff changeset
    38
        case 3:
1375969fd02e 6843079: Putback for the new EUC_TW is not complete
sherman
parents:
diff changeset
    39
            this.plane = plane;
1375969fd02e 6843079: Putback for the new EUC_TW is not complete
sherman
parents:
diff changeset
    40
            break;
1375969fd02e 6843079: Putback for the new EUC_TW is not complete
sherman
parents:
diff changeset
    41
        default:
1375969fd02e 6843079: Putback for the new EUC_TW is not complete
sherman
parents:
diff changeset
    42
            throw new IllegalArgumentException
1375969fd02e 6843079: Putback for the new EUC_TW is not complete
sherman
parents:
diff changeset
    43
                ("Only planes 1, 2, and 3 supported");
1375969fd02e 6843079: Putback for the new EUC_TW is not complete
sherman
parents:
diff changeset
    44
        }
1375969fd02e 6843079: Putback for the new EUC_TW is not complete
sherman
parents:
diff changeset
    45
    }
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
    public CharsetEncoder newEncoder() {
1375969fd02e 6843079: Putback for the new EUC_TW is not complete
sherman
parents:
diff changeset
    48
        return new Encoder(this, plane);
1375969fd02e 6843079: Putback for the new EUC_TW is not complete
sherman
parents:
diff changeset
    49
    }
1375969fd02e 6843079: Putback for the new EUC_TW is not complete
sherman
parents:
diff changeset
    50
1375969fd02e 6843079: Putback for the new EUC_TW is not complete
sherman
parents:
diff changeset
    51
    public CharsetDecoder newDecoder() {
1375969fd02e 6843079: Putback for the new EUC_TW is not complete
sherman
parents:
diff changeset
    52
        return new Decoder(this, plane);
1375969fd02e 6843079: Putback for the new EUC_TW is not complete
sherman
parents:
diff changeset
    53
    }
1375969fd02e 6843079: Putback for the new EUC_TW is not complete
sherman
parents:
diff changeset
    54
1375969fd02e 6843079: Putback for the new EUC_TW is not complete
sherman
parents:
diff changeset
    55
    public boolean contains(Charset cs) {
1375969fd02e 6843079: Putback for the new EUC_TW is not complete
sherman
parents:
diff changeset
    56
        return cs instanceof X11CNS11643;
1375969fd02e 6843079: Putback for the new EUC_TW is not complete
sherman
parents:
diff changeset
    57
    }
1375969fd02e 6843079: Putback for the new EUC_TW is not complete
sherman
parents:
diff changeset
    58
1375969fd02e 6843079: Putback for the new EUC_TW is not complete
sherman
parents:
diff changeset
    59
    private class Encoder extends EUC_TW_OLD.Encoder {
1375969fd02e 6843079: Putback for the new EUC_TW is not complete
sherman
parents:
diff changeset
    60
        private int plane;
1375969fd02e 6843079: Putback for the new EUC_TW is not complete
sherman
parents:
diff changeset
    61
        public Encoder(Charset cs, int plane) {
1375969fd02e 6843079: Putback for the new EUC_TW is not complete
sherman
parents:
diff changeset
    62
            super(cs);
1375969fd02e 6843079: Putback for the new EUC_TW is not complete
sherman
parents:
diff changeset
    63
            this.plane = plane;
1375969fd02e 6843079: Putback for the new EUC_TW is not complete
sherman
parents:
diff changeset
    64
        }
1375969fd02e 6843079: Putback for the new EUC_TW is not complete
sherman
parents:
diff changeset
    65
        public boolean canEncode(char c) {
1375969fd02e 6843079: Putback for the new EUC_TW is not complete
sherman
parents:
diff changeset
    66
            if (c <= 0x7F) {
1375969fd02e 6843079: Putback for the new EUC_TW is not complete
sherman
parents:
diff changeset
    67
                return false;
1375969fd02e 6843079: Putback for the new EUC_TW is not complete
sherman
parents:
diff changeset
    68
            }
1375969fd02e 6843079: Putback for the new EUC_TW is not complete
sherman
parents:
diff changeset
    69
            int p = getNative(c) >> 16;
1375969fd02e 6843079: Putback for the new EUC_TW is not complete
sherman
parents:
diff changeset
    70
            if (p == 1 && plane == 0 ||
1375969fd02e 6843079: Putback for the new EUC_TW is not complete
sherman
parents:
diff changeset
    71
                p == 2 && plane == 2 ||
1375969fd02e 6843079: Putback for the new EUC_TW is not complete
sherman
parents:
diff changeset
    72
                p == 3 && plane == 3)
1375969fd02e 6843079: Putback for the new EUC_TW is not complete
sherman
parents:
diff changeset
    73
                return true;
1375969fd02e 6843079: Putback for the new EUC_TW is not complete
sherman
parents:
diff changeset
    74
            return false;
1375969fd02e 6843079: Putback for the new EUC_TW is not complete
sherman
parents:
diff changeset
    75
        }
1375969fd02e 6843079: Putback for the new EUC_TW is not complete
sherman
parents:
diff changeset
    76
1375969fd02e 6843079: Putback for the new EUC_TW is not complete
sherman
parents:
diff changeset
    77
        public boolean isLegalReplacement(byte[] repl) {
1375969fd02e 6843079: Putback for the new EUC_TW is not complete
sherman
parents:
diff changeset
    78
            return true;
1375969fd02e 6843079: Putback for the new EUC_TW is not complete
sherman
parents:
diff changeset
    79
        }
1375969fd02e 6843079: Putback for the new EUC_TW is not complete
sherman
parents:
diff changeset
    80
1375969fd02e 6843079: Putback for the new EUC_TW is not complete
sherman
parents:
diff changeset
    81
        protected CoderResult encodeLoop(CharBuffer src, ByteBuffer dst) {
1375969fd02e 6843079: Putback for the new EUC_TW is not complete
sherman
parents:
diff changeset
    82
            char[] sa = src.array();
1375969fd02e 6843079: Putback for the new EUC_TW is not complete
sherman
parents:
diff changeset
    83
            int sp = src.arrayOffset() + src.position();
1375969fd02e 6843079: Putback for the new EUC_TW is not complete
sherman
parents:
diff changeset
    84
            int sl = src.arrayOffset() + src.limit();
1375969fd02e 6843079: Putback for the new EUC_TW is not complete
sherman
parents:
diff changeset
    85
            byte[] da = dst.array();
1375969fd02e 6843079: Putback for the new EUC_TW is not complete
sherman
parents:
diff changeset
    86
            int dp = dst.arrayOffset() + dst.position();
1375969fd02e 6843079: Putback for the new EUC_TW is not complete
sherman
parents:
diff changeset
    87
            int dl = dst.arrayOffset() + dst.limit();
1375969fd02e 6843079: Putback for the new EUC_TW is not complete
sherman
parents:
diff changeset
    88
1375969fd02e 6843079: Putback for the new EUC_TW is not complete
sherman
parents:
diff changeset
    89
            try {
1375969fd02e 6843079: Putback for the new EUC_TW is not complete
sherman
parents:
diff changeset
    90
                while (sp < sl) {
1375969fd02e 6843079: Putback for the new EUC_TW is not complete
sherman
parents:
diff changeset
    91
                    char c = sa[sp];
1375969fd02e 6843079: Putback for the new EUC_TW is not complete
sherman
parents:
diff changeset
    92
                    if (c >= '\uFFFE' || c <= '\u007f')
1375969fd02e 6843079: Putback for the new EUC_TW is not complete
sherman
parents:
diff changeset
    93
                        return CoderResult.unmappableForLength(1);
1375969fd02e 6843079: Putback for the new EUC_TW is not complete
sherman
parents:
diff changeset
    94
                    int cns = getNative(c);
1375969fd02e 6843079: Putback for the new EUC_TW is not complete
sherman
parents:
diff changeset
    95
                    int p = cns >> 16;
1375969fd02e 6843079: Putback for the new EUC_TW is not complete
sherman
parents:
diff changeset
    96
                    if (p == 1 && plane == 0 ||
1375969fd02e 6843079: Putback for the new EUC_TW is not complete
sherman
parents:
diff changeset
    97
                        p == 2 && plane == 2 ||
1375969fd02e 6843079: Putback for the new EUC_TW is not complete
sherman
parents:
diff changeset
    98
                        p == 3 && plane == 3) {
1375969fd02e 6843079: Putback for the new EUC_TW is not complete
sherman
parents:
diff changeset
    99
                        if (dl - dp < 2)
1375969fd02e 6843079: Putback for the new EUC_TW is not complete
sherman
parents:
diff changeset
   100
                            return CoderResult.OVERFLOW;
1375969fd02e 6843079: Putback for the new EUC_TW is not complete
sherman
parents:
diff changeset
   101
                        da[dp++] = (byte) ((cns  >> 8) & 0x7f);
1375969fd02e 6843079: Putback for the new EUC_TW is not complete
sherman
parents:
diff changeset
   102
                        da[dp++] = (byte) (cns & 0x7f);
1375969fd02e 6843079: Putback for the new EUC_TW is not complete
sherman
parents:
diff changeset
   103
                        sp++;
1375969fd02e 6843079: Putback for the new EUC_TW is not complete
sherman
parents:
diff changeset
   104
                        continue;
1375969fd02e 6843079: Putback for the new EUC_TW is not complete
sherman
parents:
diff changeset
   105
                    }
1375969fd02e 6843079: Putback for the new EUC_TW is not complete
sherman
parents:
diff changeset
   106
                    return CoderResult.unmappableForLength(1);
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.UNDERFLOW;
1375969fd02e 6843079: Putback for the new EUC_TW is not complete
sherman
parents:
diff changeset
   109
            } finally {
1375969fd02e 6843079: Putback for the new EUC_TW is not complete
sherman
parents:
diff changeset
   110
                src.position(sp - src.arrayOffset());
1375969fd02e 6843079: Putback for the new EUC_TW is not complete
sherman
parents:
diff changeset
   111
                dst.position(dp - dst.arrayOffset());
1375969fd02e 6843079: Putback for the new EUC_TW is not complete
sherman
parents:
diff changeset
   112
            }
1375969fd02e 6843079: Putback for the new EUC_TW is not complete
sherman
parents:
diff changeset
   113
        }
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
    private class Decoder extends EUC_TW_OLD.Decoder {
1375969fd02e 6843079: Putback for the new EUC_TW is not complete
sherman
parents:
diff changeset
   117
        private String table;
1375969fd02e 6843079: Putback for the new EUC_TW is not complete
sherman
parents:
diff changeset
   118
        protected Decoder(Charset cs, int plane) {
1375969fd02e 6843079: Putback for the new EUC_TW is not complete
sherman
parents:
diff changeset
   119
            super(cs);
1375969fd02e 6843079: Putback for the new EUC_TW is not complete
sherman
parents:
diff changeset
   120
            switch (plane) {
1375969fd02e 6843079: Putback for the new EUC_TW is not complete
sherman
parents:
diff changeset
   121
            case 0:
1375969fd02e 6843079: Putback for the new EUC_TW is not complete
sherman
parents:
diff changeset
   122
                table = unicodeCNS1;
1375969fd02e 6843079: Putback for the new EUC_TW is not complete
sherman
parents:
diff changeset
   123
                break;
1375969fd02e 6843079: Putback for the new EUC_TW is not complete
sherman
parents:
diff changeset
   124
            case 2:
1375969fd02e 6843079: Putback for the new EUC_TW is not complete
sherman
parents:
diff changeset
   125
                table = unicodeCNS2;
1375969fd02e 6843079: Putback for the new EUC_TW is not complete
sherman
parents:
diff changeset
   126
                break;
1375969fd02e 6843079: Putback for the new EUC_TW is not complete
sherman
parents:
diff changeset
   127
            case 3:
1375969fd02e 6843079: Putback for the new EUC_TW is not complete
sherman
parents:
diff changeset
   128
                table = unicodeCNS3;
1375969fd02e 6843079: Putback for the new EUC_TW is not complete
sherman
parents:
diff changeset
   129
                break;
1375969fd02e 6843079: Putback for the new EUC_TW is not complete
sherman
parents:
diff changeset
   130
            default:
1375969fd02e 6843079: Putback for the new EUC_TW is not complete
sherman
parents:
diff changeset
   131
                throw new IllegalArgumentException
1375969fd02e 6843079: Putback for the new EUC_TW is not complete
sherman
parents:
diff changeset
   132
                    ("Only planes 1, 2, and 3 supported");
1375969fd02e 6843079: Putback for the new EUC_TW is not complete
sherman
parents:
diff changeset
   133
            }
1375969fd02e 6843079: Putback for the new EUC_TW is not complete
sherman
parents:
diff changeset
   134
        }
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
        //we only work on array backed buffer.
1375969fd02e 6843079: Putback for the new EUC_TW is not complete
sherman
parents:
diff changeset
   137
        protected CoderResult decodeLoop(ByteBuffer src, CharBuffer dst) {
1375969fd02e 6843079: Putback for the new EUC_TW is not complete
sherman
parents:
diff changeset
   138
            byte[] sa = src.array();
1375969fd02e 6843079: Putback for the new EUC_TW is not complete
sherman
parents:
diff changeset
   139
            int sp = src.arrayOffset() + src.position();
1375969fd02e 6843079: Putback for the new EUC_TW is not complete
sherman
parents:
diff changeset
   140
            int sl = src.arrayOffset() + src.limit();
1375969fd02e 6843079: Putback for the new EUC_TW is not complete
sherman
parents:
diff changeset
   141
            assert (sp <= sl);
1375969fd02e 6843079: Putback for the new EUC_TW is not complete
sherman
parents:
diff changeset
   142
            sp = (sp <= sl ? sp : sl);
1375969fd02e 6843079: Putback for the new EUC_TW is not complete
sherman
parents:
diff changeset
   143
1375969fd02e 6843079: Putback for the new EUC_TW is not complete
sherman
parents:
diff changeset
   144
            char[] da = dst.array();
1375969fd02e 6843079: Putback for the new EUC_TW is not complete
sherman
parents:
diff changeset
   145
            int dp = dst.arrayOffset() + dst.position();
1375969fd02e 6843079: Putback for the new EUC_TW is not complete
sherman
parents:
diff changeset
   146
            int dl = dst.arrayOffset() + dst.limit();
1375969fd02e 6843079: Putback for the new EUC_TW is not complete
sherman
parents:
diff changeset
   147
            assert (dp <= dl);
1375969fd02e 6843079: Putback for the new EUC_TW is not complete
sherman
parents:
diff changeset
   148
            dp = (dp <= dl ? dp : dl);
1375969fd02e 6843079: Putback for the new EUC_TW is not complete
sherman
parents:
diff changeset
   149
1375969fd02e 6843079: Putback for the new EUC_TW is not complete
sherman
parents:
diff changeset
   150
            try {
1375969fd02e 6843079: Putback for the new EUC_TW is not complete
sherman
parents:
diff changeset
   151
                while (sp < sl) {
1375969fd02e 6843079: Putback for the new EUC_TW is not complete
sherman
parents:
diff changeset
   152
                    if ( sl - sp < 2) {
1375969fd02e 6843079: Putback for the new EUC_TW is not complete
sherman
parents:
diff changeset
   153
                        return CoderResult.UNDERFLOW;
1375969fd02e 6843079: Putback for the new EUC_TW is not complete
sherman
parents:
diff changeset
   154
                    }
1375969fd02e 6843079: Putback for the new EUC_TW is not complete
sherman
parents:
diff changeset
   155
                    byte b1 = sa[sp];
1375969fd02e 6843079: Putback for the new EUC_TW is not complete
sherman
parents:
diff changeset
   156
                    byte b2 = sa[sp + 1];
1375969fd02e 6843079: Putback for the new EUC_TW is not complete
sherman
parents:
diff changeset
   157
                    char c = replacement().charAt(0);
1375969fd02e 6843079: Putback for the new EUC_TW is not complete
sherman
parents:
diff changeset
   158
1375969fd02e 6843079: Putback for the new EUC_TW is not complete
sherman
parents:
diff changeset
   159
                    if (table == unicodeCNS3) {
1375969fd02e 6843079: Putback for the new EUC_TW is not complete
sherman
parents:
diff changeset
   160
                        char[] cc = convToSurrogate((byte)(b1 | 0x80),
1375969fd02e 6843079: Putback for the new EUC_TW is not complete
sherman
parents:
diff changeset
   161
                                                    (byte)(b2 | 0x80),
1375969fd02e 6843079: Putback for the new EUC_TW is not complete
sherman
parents:
diff changeset
   162
                                                    table);
1375969fd02e 6843079: Putback for the new EUC_TW is not complete
sherman
parents:
diff changeset
   163
                        if (cc != null && cc[0] == '\u0000')
1375969fd02e 6843079: Putback for the new EUC_TW is not complete
sherman
parents:
diff changeset
   164
                            c = cc[1];
1375969fd02e 6843079: Putback for the new EUC_TW is not complete
sherman
parents:
diff changeset
   165
                    } else {
1375969fd02e 6843079: Putback for the new EUC_TW is not complete
sherman
parents:
diff changeset
   166
                        c = convToUnicode((byte)(b1 | 0x80),
1375969fd02e 6843079: Putback for the new EUC_TW is not complete
sherman
parents:
diff changeset
   167
                                           (byte)(b2 | 0x80),
1375969fd02e 6843079: Putback for the new EUC_TW is not complete
sherman
parents:
diff changeset
   168
                                           table);
1375969fd02e 6843079: Putback for the new EUC_TW is not complete
sherman
parents:
diff changeset
   169
                    }
1375969fd02e 6843079: Putback for the new EUC_TW is not complete
sherman
parents:
diff changeset
   170
                    if (c == replacement().charAt(0)
1375969fd02e 6843079: Putback for the new EUC_TW is not complete
sherman
parents:
diff changeset
   171
                        //to keep the compatibility with b2cX11CNS11643
1375969fd02e 6843079: Putback for the new EUC_TW is not complete
sherman
parents:
diff changeset
   172
                        /*|| c == '\u0000'*/) {
1375969fd02e 6843079: Putback for the new EUC_TW is not complete
sherman
parents:
diff changeset
   173
                        return CoderResult.unmappableForLength(2);
1375969fd02e 6843079: Putback for the new EUC_TW is not complete
sherman
parents:
diff changeset
   174
                    }
1375969fd02e 6843079: Putback for the new EUC_TW is not complete
sherman
parents:
diff changeset
   175
                    if (dl - dp < 1)
1375969fd02e 6843079: Putback for the new EUC_TW is not complete
sherman
parents:
diff changeset
   176
                        return CoderResult.OVERFLOW;
1375969fd02e 6843079: Putback for the new EUC_TW is not complete
sherman
parents:
diff changeset
   177
                    da[dp++] = c;
1375969fd02e 6843079: Putback for the new EUC_TW is not complete
sherman
parents:
diff changeset
   178
                    sp +=2;
1375969fd02e 6843079: Putback for the new EUC_TW is not complete
sherman
parents:
diff changeset
   179
                }
1375969fd02e 6843079: Putback for the new EUC_TW is not complete
sherman
parents:
diff changeset
   180
                return CoderResult.UNDERFLOW;
1375969fd02e 6843079: Putback for the new EUC_TW is not complete
sherman
parents:
diff changeset
   181
            } finally {
1375969fd02e 6843079: Putback for the new EUC_TW is not complete
sherman
parents:
diff changeset
   182
                src.position(sp - src.arrayOffset());
1375969fd02e 6843079: Putback for the new EUC_TW is not complete
sherman
parents:
diff changeset
   183
                dst.position(dp - dst.arrayOffset());
1375969fd02e 6843079: Putback for the new EUC_TW is not complete
sherman
parents:
diff changeset
   184
            }
1375969fd02e 6843079: Putback for the new EUC_TW is not complete
sherman
parents:
diff changeset
   185
        }
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
}