src/jdk.charsets/share/classes/sun/nio/cs/ext/Big5_HKSCS.java.template
author chegar
Fri, 02 Mar 2018 10:18:48 +0000
branchhttp-client-branch
changeset 56225 348ae78efb60
parent 48031 d0cf025a5e79
permissions -rw-r--r--
http-client-branch: add temporary debug logging to SubscriberWrapper demand
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
28969
f980bee32887 8073152: Update Standard/ExtendedCharsets to work with module system
sherman
parents:
diff changeset
     1
/*
39503
2c1a58222105 8161002: GPL header missing comma in year - not swapped in licensee bundles
sherman
parents: 28969
diff changeset
     2
 * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
28969
f980bee32887 8073152: Update Standard/ExtendedCharsets to work with module system
sherman
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
f980bee32887 8073152: Update Standard/ExtendedCharsets to work with module system
sherman
parents:
diff changeset
     4
 *
f980bee32887 8073152: Update Standard/ExtendedCharsets to work with module system
sherman
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
f980bee32887 8073152: Update Standard/ExtendedCharsets to work with module system
sherman
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
f980bee32887 8073152: Update Standard/ExtendedCharsets to work with module system
sherman
parents:
diff changeset
     7
 * published by the Free Software Foundation.  Oracle designates this
f980bee32887 8073152: Update Standard/ExtendedCharsets to work with module system
sherman
parents:
diff changeset
     8
 * particular file as subject to the "Classpath" exception as provided
f980bee32887 8073152: Update Standard/ExtendedCharsets to work with module system
sherman
parents:
diff changeset
     9
 * by Oracle in the LICENSE file that accompanied this code.
f980bee32887 8073152: Update Standard/ExtendedCharsets to work with module system
sherman
parents:
diff changeset
    10
 *
f980bee32887 8073152: Update Standard/ExtendedCharsets to work with module system
sherman
parents:
diff changeset
    11
 * This code is distributed in the hope that it will be useful, but WITHOUT
f980bee32887 8073152: Update Standard/ExtendedCharsets to work with module system
sherman
parents:
diff changeset
    12
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
f980bee32887 8073152: Update Standard/ExtendedCharsets to work with module system
sherman
parents:
diff changeset
    13
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
f980bee32887 8073152: Update Standard/ExtendedCharsets to work with module system
sherman
parents:
diff changeset
    14
 * version 2 for more details (a copy is included in the LICENSE file that
f980bee32887 8073152: Update Standard/ExtendedCharsets to work with module system
sherman
parents:
diff changeset
    15
 * accompanied this code).
f980bee32887 8073152: Update Standard/ExtendedCharsets to work with module system
sherman
parents:
diff changeset
    16
 *
f980bee32887 8073152: Update Standard/ExtendedCharsets to work with module system
sherman
parents:
diff changeset
    17
 * You should have received a copy of the GNU General Public License version
f980bee32887 8073152: Update Standard/ExtendedCharsets to work with module system
sherman
parents:
diff changeset
    18
 * 2 along with this work; if not, write to the Free Software Foundation,
f980bee32887 8073152: Update Standard/ExtendedCharsets to work with module system
sherman
parents:
diff changeset
    19
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
f980bee32887 8073152: Update Standard/ExtendedCharsets to work with module system
sherman
parents:
diff changeset
    20
 *
f980bee32887 8073152: Update Standard/ExtendedCharsets to work with module system
sherman
parents:
diff changeset
    21
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
f980bee32887 8073152: Update Standard/ExtendedCharsets to work with module system
sherman
parents:
diff changeset
    22
 * or visit www.oracle.com if you need additional information or have any
f980bee32887 8073152: Update Standard/ExtendedCharsets to work with module system
sherman
parents:
diff changeset
    23
 * questions.
f980bee32887 8073152: Update Standard/ExtendedCharsets to work with module system
sherman
parents:
diff changeset
    24
 */
f980bee32887 8073152: Update Standard/ExtendedCharsets to work with module system
sherman
parents:
diff changeset
    25
f980bee32887 8073152: Update Standard/ExtendedCharsets to work with module system
sherman
parents:
diff changeset
    26
package $PACKAGE$;
f980bee32887 8073152: Update Standard/ExtendedCharsets to work with module system
sherman
parents:
diff changeset
    27
f980bee32887 8073152: Update Standard/ExtendedCharsets to work with module system
sherman
parents:
diff changeset
    28
import java.nio.charset.Charset;
f980bee32887 8073152: Update Standard/ExtendedCharsets to work with module system
sherman
parents:
diff changeset
    29
import java.nio.charset.CharsetDecoder;
f980bee32887 8073152: Update Standard/ExtendedCharsets to work with module system
sherman
parents:
diff changeset
    30
import java.nio.charset.CharsetEncoder;
f980bee32887 8073152: Update Standard/ExtendedCharsets to work with module system
sherman
parents:
diff changeset
    31
import sun.nio.cs.DoubleByte;
f980bee32887 8073152: Update Standard/ExtendedCharsets to work with module system
sherman
parents:
diff changeset
    32
import sun.nio.cs.HKSCS;
f980bee32887 8073152: Update Standard/ExtendedCharsets to work with module system
sherman
parents:
diff changeset
    33
import sun.nio.cs.HistoricallyNamedCharset;
48031
d0cf025a5e79 8187910: Charset MS950_HKSCS not supported in JDK 9
sherman
parents: 47216
diff changeset
    34
import sun.nio.cs.*;
28969
f980bee32887 8073152: Update Standard/ExtendedCharsets to work with module system
sherman
parents:
diff changeset
    35
import static sun.nio.cs.CharsetMapping.*;
f980bee32887 8073152: Update Standard/ExtendedCharsets to work with module system
sherman
parents:
diff changeset
    36
f980bee32887 8073152: Update Standard/ExtendedCharsets to work with module system
sherman
parents:
diff changeset
    37
public class Big5_HKSCS extends Charset implements HistoricallyNamedCharset
f980bee32887 8073152: Update Standard/ExtendedCharsets to work with module system
sherman
parents:
diff changeset
    38
{
f980bee32887 8073152: Update Standard/ExtendedCharsets to work with module system
sherman
parents:
diff changeset
    39
    public Big5_HKSCS() {
f980bee32887 8073152: Update Standard/ExtendedCharsets to work with module system
sherman
parents:
diff changeset
    40
        super("Big5-HKSCS", $ALIASES$);
f980bee32887 8073152: Update Standard/ExtendedCharsets to work with module system
sherman
parents:
diff changeset
    41
    }
f980bee32887 8073152: Update Standard/ExtendedCharsets to work with module system
sherman
parents:
diff changeset
    42
f980bee32887 8073152: Update Standard/ExtendedCharsets to work with module system
sherman
parents:
diff changeset
    43
    public String historicalName() {
f980bee32887 8073152: Update Standard/ExtendedCharsets to work with module system
sherman
parents:
diff changeset
    44
        return "Big5_HKSCS";
f980bee32887 8073152: Update Standard/ExtendedCharsets to work with module system
sherman
parents:
diff changeset
    45
    }
f980bee32887 8073152: Update Standard/ExtendedCharsets to work with module system
sherman
parents:
diff changeset
    46
f980bee32887 8073152: Update Standard/ExtendedCharsets to work with module system
sherman
parents:
diff changeset
    47
    public boolean contains(Charset cs) {
f980bee32887 8073152: Update Standard/ExtendedCharsets to work with module system
sherman
parents:
diff changeset
    48
        return ((cs.name().equals("US-ASCII"))
f980bee32887 8073152: Update Standard/ExtendedCharsets to work with module system
sherman
parents:
diff changeset
    49
                || (cs instanceof Big5)
f980bee32887 8073152: Update Standard/ExtendedCharsets to work with module system
sherman
parents:
diff changeset
    50
                || (cs instanceof Big5_HKSCS));
f980bee32887 8073152: Update Standard/ExtendedCharsets to work with module system
sherman
parents:
diff changeset
    51
    }
f980bee32887 8073152: Update Standard/ExtendedCharsets to work with module system
sherman
parents:
diff changeset
    52
f980bee32887 8073152: Update Standard/ExtendedCharsets to work with module system
sherman
parents:
diff changeset
    53
    public CharsetDecoder newDecoder() {
f980bee32887 8073152: Update Standard/ExtendedCharsets to work with module system
sherman
parents:
diff changeset
    54
        return new Decoder(this);
f980bee32887 8073152: Update Standard/ExtendedCharsets to work with module system
sherman
parents:
diff changeset
    55
    }
f980bee32887 8073152: Update Standard/ExtendedCharsets to work with module system
sherman
parents:
diff changeset
    56
f980bee32887 8073152: Update Standard/ExtendedCharsets to work with module system
sherman
parents:
diff changeset
    57
    public CharsetEncoder newEncoder() {
f980bee32887 8073152: Update Standard/ExtendedCharsets to work with module system
sherman
parents:
diff changeset
    58
        return new Encoder(this);
f980bee32887 8073152: Update Standard/ExtendedCharsets to work with module system
sherman
parents:
diff changeset
    59
    }
f980bee32887 8073152: Update Standard/ExtendedCharsets to work with module system
sherman
parents:
diff changeset
    60
f980bee32887 8073152: Update Standard/ExtendedCharsets to work with module system
sherman
parents:
diff changeset
    61
    static class Decoder extends HKSCS.Decoder {
f980bee32887 8073152: Update Standard/ExtendedCharsets to work with module system
sherman
parents:
diff changeset
    62
        private static DoubleByte.Decoder big5 =
f980bee32887 8073152: Update Standard/ExtendedCharsets to work with module system
sherman
parents:
diff changeset
    63
            (DoubleByte.Decoder)new Big5().newDecoder();
f980bee32887 8073152: Update Standard/ExtendedCharsets to work with module system
sherman
parents:
diff changeset
    64
f980bee32887 8073152: Update Standard/ExtendedCharsets to work with module system
sherman
parents:
diff changeset
    65
        private static char[][] b2cBmp = new char[0x100][];
f980bee32887 8073152: Update Standard/ExtendedCharsets to work with module system
sherman
parents:
diff changeset
    66
        private static char[][] b2cSupp = new char[0x100][];
f980bee32887 8073152: Update Standard/ExtendedCharsets to work with module system
sherman
parents:
diff changeset
    67
        static {
f980bee32887 8073152: Update Standard/ExtendedCharsets to work with module system
sherman
parents:
diff changeset
    68
            initb2c(b2cBmp, HKSCSMapping.b2cBmpStr);
f980bee32887 8073152: Update Standard/ExtendedCharsets to work with module system
sherman
parents:
diff changeset
    69
            initb2c(b2cSupp, HKSCSMapping.b2cSuppStr);
f980bee32887 8073152: Update Standard/ExtendedCharsets to work with module system
sherman
parents:
diff changeset
    70
        }
f980bee32887 8073152: Update Standard/ExtendedCharsets to work with module system
sherman
parents:
diff changeset
    71
f980bee32887 8073152: Update Standard/ExtendedCharsets to work with module system
sherman
parents:
diff changeset
    72
        private Decoder(Charset cs) {
f980bee32887 8073152: Update Standard/ExtendedCharsets to work with module system
sherman
parents:
diff changeset
    73
            super(cs, big5, b2cBmp, b2cSupp);
f980bee32887 8073152: Update Standard/ExtendedCharsets to work with module system
sherman
parents:
diff changeset
    74
        }
f980bee32887 8073152: Update Standard/ExtendedCharsets to work with module system
sherman
parents:
diff changeset
    75
    }
f980bee32887 8073152: Update Standard/ExtendedCharsets to work with module system
sherman
parents:
diff changeset
    76
f980bee32887 8073152: Update Standard/ExtendedCharsets to work with module system
sherman
parents:
diff changeset
    77
    static class Encoder extends HKSCS.Encoder {
f980bee32887 8073152: Update Standard/ExtendedCharsets to work with module system
sherman
parents:
diff changeset
    78
        private static DoubleByte.Encoder big5 =
f980bee32887 8073152: Update Standard/ExtendedCharsets to work with module system
sherman
parents:
diff changeset
    79
            (DoubleByte.Encoder)new Big5().newEncoder();
f980bee32887 8073152: Update Standard/ExtendedCharsets to work with module system
sherman
parents:
diff changeset
    80
f980bee32887 8073152: Update Standard/ExtendedCharsets to work with module system
sherman
parents:
diff changeset
    81
        static char[][] c2bBmp = new char[0x100][];
f980bee32887 8073152: Update Standard/ExtendedCharsets to work with module system
sherman
parents:
diff changeset
    82
        static char[][] c2bSupp = new char[0x100][];
f980bee32887 8073152: Update Standard/ExtendedCharsets to work with module system
sherman
parents:
diff changeset
    83
        static {
f980bee32887 8073152: Update Standard/ExtendedCharsets to work with module system
sherman
parents:
diff changeset
    84
            initc2b(c2bBmp, HKSCSMapping.b2cBmpStr, HKSCSMapping.pua);
f980bee32887 8073152: Update Standard/ExtendedCharsets to work with module system
sherman
parents:
diff changeset
    85
            initc2b(c2bSupp, HKSCSMapping.b2cSuppStr, null);
f980bee32887 8073152: Update Standard/ExtendedCharsets to work with module system
sherman
parents:
diff changeset
    86
        }
f980bee32887 8073152: Update Standard/ExtendedCharsets to work with module system
sherman
parents:
diff changeset
    87
f980bee32887 8073152: Update Standard/ExtendedCharsets to work with module system
sherman
parents:
diff changeset
    88
        private Encoder(Charset cs) {
f980bee32887 8073152: Update Standard/ExtendedCharsets to work with module system
sherman
parents:
diff changeset
    89
            super(cs, big5, c2bBmp, c2bSupp);
f980bee32887 8073152: Update Standard/ExtendedCharsets to work with module system
sherman
parents:
diff changeset
    90
        }
f980bee32887 8073152: Update Standard/ExtendedCharsets to work with module system
sherman
parents:
diff changeset
    91
    }
f980bee32887 8073152: Update Standard/ExtendedCharsets to work with module system
sherman
parents:
diff changeset
    92
}