jdk/src/share/classes/sun/nio/cs/ext/DoubleByteEncoder.java
author sherman
Tue, 24 Jul 2012 12:17:39 -0700
changeset 13366 2f5fdf6d8c22
parent 5506 202f599c92aa
permissions -rw-r--r--
6653797: Reimplement JDK charset repository charsets.jar Summary: Migrated all jis based charsets to new implementation Reviewed-by: okutsu
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     1
/*
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 3714
diff changeset
     2
 * Copyright (c) 2002, 2006, Oracle and/or its affiliates. All rights reserved.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
90ce3da70b43 Initial load
duke
parents:
diff changeset
     4
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
90ce3da70b43 Initial load
duke
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: 3714
diff changeset
     7
 * published by the Free Software Foundation.  Oracle designates this
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     8
 * particular file as subject to the "Classpath" exception as provided
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 3714
diff changeset
     9
 * by Oracle in the LICENSE file that accompanied this code.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    10
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    11
 * This code is distributed in the hope that it will be useful, but WITHOUT
90ce3da70b43 Initial load
duke
parents:
diff changeset
    12
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
90ce3da70b43 Initial load
duke
parents:
diff changeset
    13
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
90ce3da70b43 Initial load
duke
parents:
diff changeset
    14
 * version 2 for more details (a copy is included in the LICENSE file that
90ce3da70b43 Initial load
duke
parents:
diff changeset
    15
 * accompanied this code).
90ce3da70b43 Initial load
duke
parents:
diff changeset
    16
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    17
 * You should have received a copy of the GNU General Public License version
90ce3da70b43 Initial load
duke
parents:
diff changeset
    18
 * 2 along with this work; if not, write to the Free Software Foundation,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    19
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    20
 *
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 3714
diff changeset
    21
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 3714
diff changeset
    22
 * or visit www.oracle.com if you need additional information or have any
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 3714
diff changeset
    23
 * questions.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    24
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    25
90ce3da70b43 Initial load
duke
parents:
diff changeset
    26
/*
90ce3da70b43 Initial load
duke
parents:
diff changeset
    27
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    28
90ce3da70b43 Initial load
duke
parents:
diff changeset
    29
package sun.nio.cs.ext;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    30
90ce3da70b43 Initial load
duke
parents:
diff changeset
    31
import java.nio.ByteBuffer;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    32
import java.nio.CharBuffer;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    33
import java.nio.charset.Charset;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    34
import java.nio.charset.CharsetEncoder;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    35
import java.nio.charset.CoderResult;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    36
import sun.nio.cs.Surrogate;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    37
90ce3da70b43 Initial load
duke
parents:
diff changeset
    38
public abstract class DoubleByteEncoder
90ce3da70b43 Initial load
duke
parents:
diff changeset
    39
    extends CharsetEncoder
90ce3da70b43 Initial load
duke
parents:
diff changeset
    40
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
    41
90ce3da70b43 Initial load
duke
parents:
diff changeset
    42
    private short index1[];
90ce3da70b43 Initial load
duke
parents:
diff changeset
    43
    private String index2[];
90ce3da70b43 Initial load
duke
parents:
diff changeset
    44
90ce3da70b43 Initial load
duke
parents:
diff changeset
    45
    private final Surrogate.Parser sgp = new Surrogate.Parser();
90ce3da70b43 Initial load
duke
parents:
diff changeset
    46
90ce3da70b43 Initial load
duke
parents:
diff changeset
    47
    protected DoubleByteEncoder(Charset cs,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    48
                                short[] index1, String[] index2)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    49
    {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    50
        super(cs, 2.0f, 2.0f);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    51
        this.index1 = index1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    52
        this.index2 = index2;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    53
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    54
90ce3da70b43 Initial load
duke
parents:
diff changeset
    55
    protected DoubleByteEncoder(Charset cs,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    56
                                short[] index1, String[] index2,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    57
                                float avg, float max)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    58
    {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    59
        super(cs, avg, max);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    60
        this.index1 = index1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    61
        this.index2 = index2;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    62
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    63
90ce3da70b43 Initial load
duke
parents:
diff changeset
    64
    protected DoubleByteEncoder(Charset cs,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    65
                                short[] index1, String[] index2, byte[] repl)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    66
    {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    67
        super(cs, 2.0f, 2.0f, repl);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    68
        this.index1 = index1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    69
        this.index2 = index2;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    70
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    71
90ce3da70b43 Initial load
duke
parents:
diff changeset
    72
90ce3da70b43 Initial load
duke
parents:
diff changeset
    73
    protected DoubleByteEncoder(Charset cs,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    74
                                short[] index1, String[] index2,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    75
                                byte[] repl, float avg, float max)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    76
    {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    77
        super(cs, avg, max,repl);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    78
        this.index1 = index1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    79
        this.index2 = index2;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    80
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    81
90ce3da70b43 Initial load
duke
parents:
diff changeset
    82
    public boolean canEncode(char c) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    83
        return (encodeSingle(c) != -1 ||
90ce3da70b43 Initial load
duke
parents:
diff changeset
    84
                encodeDouble(c) != 0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    85
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    86
90ce3da70b43 Initial load
duke
parents:
diff changeset
    87
    private CoderResult encodeArrayLoop(CharBuffer src, ByteBuffer dst) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    88
        char[] sa = src.array();
90ce3da70b43 Initial load
duke
parents:
diff changeset
    89
        int sp = src.arrayOffset() + src.position();
90ce3da70b43 Initial load
duke
parents:
diff changeset
    90
        int sl = src.arrayOffset() + src.limit();
90ce3da70b43 Initial load
duke
parents:
diff changeset
    91
        byte[] da = dst.array();
90ce3da70b43 Initial load
duke
parents:
diff changeset
    92
        int dp = dst.arrayOffset() + dst.position();
90ce3da70b43 Initial load
duke
parents:
diff changeset
    93
        int dl = dst.arrayOffset() + dst.limit();
90ce3da70b43 Initial load
duke
parents:
diff changeset
    94
90ce3da70b43 Initial load
duke
parents:
diff changeset
    95
        try {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    96
            while (sp < sl) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    97
                char c = sa[sp];
3714
6a4eb8f53f91 6860431: Character.isSurrogate(char ch)
martin
parents: 2
diff changeset
    98
                if (Character.isSurrogate(c)) {
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    99
                    if (sgp.parse(c, sa, sp, sl) < 0)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   100
                        return sgp.error();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   101
                    if (sl - sp < 2)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   102
                        return CoderResult.UNDERFLOW;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   103
                    char c2 = sa[sp + 1];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   104
90ce3da70b43 Initial load
duke
parents:
diff changeset
   105
                    byte[] outputBytes = new byte[2];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   106
                    outputBytes = encodeSurrogate(c, c2);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   107
90ce3da70b43 Initial load
duke
parents:
diff changeset
   108
                    if (outputBytes == null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   109
                        return sgp.unmappableResult();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   110
                    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   111
                    else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   112
                        if (dl - dp < 2)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   113
                            return CoderResult.OVERFLOW;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   114
                        da[dp++] = outputBytes[0];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   115
                        da[dp++] = outputBytes[1];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   116
                        sp += 2;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   117
                        continue;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   118
                    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   119
                }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   120
                if (c >= '\uFFFE')
90ce3da70b43 Initial load
duke
parents:
diff changeset
   121
                    return CoderResult.unmappableForLength(1);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   122
90ce3da70b43 Initial load
duke
parents:
diff changeset
   123
                int b = encodeSingle(c);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   124
                if (b != -1) { // Single Byte
90ce3da70b43 Initial load
duke
parents:
diff changeset
   125
                    if (dl - dp < 1)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   126
                        return CoderResult.OVERFLOW;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   127
                    da[dp++] = (byte)b;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   128
                    sp++;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   129
                    continue;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   130
                }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   131
90ce3da70b43 Initial load
duke
parents:
diff changeset
   132
                int ncode  = encodeDouble(c);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   133
                if (ncode != 0 && c != '\u0000' ) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   134
                    if (dl - dp < 2)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   135
                        return CoderResult.OVERFLOW;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   136
                    da[dp++] = (byte) ((ncode & 0xff00) >> 8);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   137
                    da[dp++] = (byte) (ncode & 0xff);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   138
                    sp++;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   139
                    continue;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   140
                }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   141
                return CoderResult.unmappableForLength(1);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   142
                }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   143
            return CoderResult.UNDERFLOW;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   144
        } finally {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   145
            src.position(sp - src.arrayOffset());
90ce3da70b43 Initial load
duke
parents:
diff changeset
   146
            dst.position(dp - dst.arrayOffset());
90ce3da70b43 Initial load
duke
parents:
diff changeset
   147
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   148
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   149
90ce3da70b43 Initial load
duke
parents:
diff changeset
   150
    private CoderResult encodeBufferLoop(CharBuffer src, ByteBuffer dst) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   151
        int mark = src.position();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   152
90ce3da70b43 Initial load
duke
parents:
diff changeset
   153
        try {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   154
            while (src.hasRemaining()) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   155
                char c = src.get();
3714
6a4eb8f53f91 6860431: Character.isSurrogate(char ch)
martin
parents: 2
diff changeset
   156
                if (Character.isSurrogate(c)) {
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   157
                    int surr;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   158
                    if ((surr = sgp.parse(c, src)) < 0)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   159
                        return sgp.error();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   160
                    char c2 = Surrogate.low(surr);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   161
                    byte[] outputBytes = new byte[2];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   162
                    outputBytes = encodeSurrogate(c, c2);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   163
90ce3da70b43 Initial load
duke
parents:
diff changeset
   164
                    if (outputBytes == null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   165
                        return sgp.unmappableResult();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   166
                    } else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   167
                        if (dst.remaining() < 2)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   168
                            return CoderResult.OVERFLOW;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   169
                        mark += 2;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   170
                        dst.put(outputBytes[0]);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   171
                        dst.put(outputBytes[1]);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   172
                        continue;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   173
                    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   174
                }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   175
                if (c >= '\uFFFE')
90ce3da70b43 Initial load
duke
parents:
diff changeset
   176
                    return CoderResult.unmappableForLength(1);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   177
                int b = encodeSingle(c);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   178
90ce3da70b43 Initial load
duke
parents:
diff changeset
   179
                if (b != -1) { // Single-byte character
90ce3da70b43 Initial load
duke
parents:
diff changeset
   180
                    if (dst.remaining() < 1)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   181
                        return CoderResult.OVERFLOW;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   182
                    mark++;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   183
                    dst.put((byte)b);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   184
                    continue;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   185
                }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   186
                // Double Byte character
90ce3da70b43 Initial load
duke
parents:
diff changeset
   187
90ce3da70b43 Initial load
duke
parents:
diff changeset
   188
                int ncode = encodeDouble(c);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   189
                if (ncode != 0 && c != '\u0000') {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   190
                    if (dst.remaining() < 2)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   191
                        return CoderResult.OVERFLOW;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   192
                    mark++;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   193
                    dst.put((byte) ((ncode & 0xff00) >> 8));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   194
                    dst.put((byte) ncode);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   195
                    continue;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   196
                }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   197
                return CoderResult.unmappableForLength(1);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   198
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   199
90ce3da70b43 Initial load
duke
parents:
diff changeset
   200
            return CoderResult.UNDERFLOW;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   201
        } finally {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   202
            src.position(mark);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   203
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   204
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   205
90ce3da70b43 Initial load
duke
parents:
diff changeset
   206
    protected CoderResult encodeLoop(CharBuffer src, ByteBuffer dst) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   207
        if (true && src.hasArray() && dst.hasArray())
90ce3da70b43 Initial load
duke
parents:
diff changeset
   208
            return encodeArrayLoop(src, dst);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   209
        else
90ce3da70b43 Initial load
duke
parents:
diff changeset
   210
            return encodeBufferLoop(src, dst);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   211
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   212
90ce3da70b43 Initial load
duke
parents:
diff changeset
   213
    /*
90ce3da70b43 Initial load
duke
parents:
diff changeset
   214
     * Can be changed by subclass
90ce3da70b43 Initial load
duke
parents:
diff changeset
   215
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   216
    protected int encodeDouble(char ch) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   217
        int offset = index1[((ch & 0xff00) >> 8 )] << 8;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   218
        return index2[offset >> 12].charAt((offset & 0xfff) + (ch & 0xff));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   219
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   220
90ce3da70b43 Initial load
duke
parents:
diff changeset
   221
    /*
90ce3da70b43 Initial load
duke
parents:
diff changeset
   222
     * Can be changed by subclass
90ce3da70b43 Initial load
duke
parents:
diff changeset
   223
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   224
    protected int encodeSingle(char inputChar) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   225
        if (inputChar < 0x80)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   226
            return (byte)inputChar;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   227
        else
90ce3da70b43 Initial load
duke
parents:
diff changeset
   228
            return -1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   229
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   230
90ce3da70b43 Initial load
duke
parents:
diff changeset
   231
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   232
     *  Protected method which should be overridden by concrete DBCS
90ce3da70b43 Initial load
duke
parents:
diff changeset
   233
     *  CharsetEncoder classes which included supplementary characters
90ce3da70b43 Initial load
duke
parents:
diff changeset
   234
     *  within their mapping coverage.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   235
     *  null return value indicates surrogate values could not be
90ce3da70b43 Initial load
duke
parents:
diff changeset
   236
     *  handled or encoded.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   237
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   238
    protected byte[] encodeSurrogate(char highSurrogate, char lowSurrogate) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   239
        return null;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   240
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   241
}