jdk/src/jdk.charsets/share/classes/sun/nio/cs/ext/Big5_HKSCS.java.template
author sherman
Mon, 16 Feb 2015 14:53:59 -0800
changeset 28969 f980bee32887
child 39503 2c1a58222105
permissions -rw-r--r--
8073152: Update Standard/ExtendedCharsets to work with module system Summary: to reorganize the standard and extendec charset configuration during build time Reviewed-by: alanb
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
/*
f980bee32887 8073152: Update Standard/ExtendedCharsets to work with module system
sherman
parents:
diff changeset
     2
 * Copyright (c) 2010 Oracle and/or its affiliates. All rights reserved.
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;
f980bee32887 8073152: Update Standard/ExtendedCharsets to work with module system
sherman
parents:
diff changeset
    34
import static sun.nio.cs.CharsetMapping.*;
f980bee32887 8073152: Update Standard/ExtendedCharsets to work with module system
sherman
parents:
diff changeset
    35
f980bee32887 8073152: Update Standard/ExtendedCharsets to work with module system
sherman
parents:
diff changeset
    36
public class Big5_HKSCS extends Charset implements HistoricallyNamedCharset
f980bee32887 8073152: Update Standard/ExtendedCharsets to work with module system
sherman
parents:
diff changeset
    37
{
f980bee32887 8073152: Update Standard/ExtendedCharsets to work with module system
sherman
parents:
diff changeset
    38
    public Big5_HKSCS() {
f980bee32887 8073152: Update Standard/ExtendedCharsets to work with module system
sherman
parents:
diff changeset
    39
        super("Big5-HKSCS", $ALIASES$);
f980bee32887 8073152: Update Standard/ExtendedCharsets to work with module system
sherman
parents:
diff changeset
    40
    }
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
    public String historicalName() {
f980bee32887 8073152: Update Standard/ExtendedCharsets to work with module system
sherman
parents:
diff changeset
    43
        return "Big5_HKSCS";
f980bee32887 8073152: Update Standard/ExtendedCharsets to work with module system
sherman
parents:
diff changeset
    44
    }
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
    public boolean contains(Charset cs) {
f980bee32887 8073152: Update Standard/ExtendedCharsets to work with module system
sherman
parents:
diff changeset
    47
        return ((cs.name().equals("US-ASCII"))
f980bee32887 8073152: Update Standard/ExtendedCharsets to work with module system
sherman
parents:
diff changeset
    48
                || (cs instanceof Big5)
f980bee32887 8073152: Update Standard/ExtendedCharsets to work with module system
sherman
parents:
diff changeset
    49
                || (cs instanceof Big5_HKSCS));
f980bee32887 8073152: Update Standard/ExtendedCharsets to work with module system
sherman
parents:
diff changeset
    50
    }
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
    public CharsetDecoder newDecoder() {
f980bee32887 8073152: Update Standard/ExtendedCharsets to work with module system
sherman
parents:
diff changeset
    53
        return new Decoder(this);
f980bee32887 8073152: Update Standard/ExtendedCharsets to work with module system
sherman
parents:
diff changeset
    54
    }
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
    public CharsetEncoder newEncoder() {
f980bee32887 8073152: Update Standard/ExtendedCharsets to work with module system
sherman
parents:
diff changeset
    57
        return new Encoder(this);
f980bee32887 8073152: Update Standard/ExtendedCharsets to work with module system
sherman
parents:
diff changeset
    58
    }
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
    static class Decoder extends HKSCS.Decoder {
f980bee32887 8073152: Update Standard/ExtendedCharsets to work with module system
sherman
parents:
diff changeset
    61
        private static DoubleByte.Decoder big5 =
f980bee32887 8073152: Update Standard/ExtendedCharsets to work with module system
sherman
parents:
diff changeset
    62
            (DoubleByte.Decoder)new Big5().newDecoder();
f980bee32887 8073152: Update Standard/ExtendedCharsets to work with module system
sherman
parents:
diff changeset
    63
f980bee32887 8073152: Update Standard/ExtendedCharsets to work with module system
sherman
parents:
diff changeset
    64
        private static char[][] b2cBmp = new char[0x100][];
f980bee32887 8073152: Update Standard/ExtendedCharsets to work with module system
sherman
parents:
diff changeset
    65
        private static char[][] b2cSupp = new char[0x100][];
f980bee32887 8073152: Update Standard/ExtendedCharsets to work with module system
sherman
parents:
diff changeset
    66
        static {
f980bee32887 8073152: Update Standard/ExtendedCharsets to work with module system
sherman
parents:
diff changeset
    67
            initb2c(b2cBmp, HKSCSMapping.b2cBmpStr);
f980bee32887 8073152: Update Standard/ExtendedCharsets to work with module system
sherman
parents:
diff changeset
    68
            initb2c(b2cSupp, HKSCSMapping.b2cSuppStr);
f980bee32887 8073152: Update Standard/ExtendedCharsets to work with module system
sherman
parents:
diff changeset
    69
        }
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
        private Decoder(Charset cs) {
f980bee32887 8073152: Update Standard/ExtendedCharsets to work with module system
sherman
parents:
diff changeset
    72
            super(cs, big5, b2cBmp, b2cSupp);
f980bee32887 8073152: Update Standard/ExtendedCharsets to work with module system
sherman
parents:
diff changeset
    73
        }
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
    static class Encoder extends HKSCS.Encoder {
f980bee32887 8073152: Update Standard/ExtendedCharsets to work with module system
sherman
parents:
diff changeset
    77
        private static DoubleByte.Encoder big5 =
f980bee32887 8073152: Update Standard/ExtendedCharsets to work with module system
sherman
parents:
diff changeset
    78
            (DoubleByte.Encoder)new Big5().newEncoder();
f980bee32887 8073152: Update Standard/ExtendedCharsets to work with module system
sherman
parents:
diff changeset
    79
f980bee32887 8073152: Update Standard/ExtendedCharsets to work with module system
sherman
parents:
diff changeset
    80
        static char[][] c2bBmp = new char[0x100][];
f980bee32887 8073152: Update Standard/ExtendedCharsets to work with module system
sherman
parents:
diff changeset
    81
        static char[][] c2bSupp = new char[0x100][];
f980bee32887 8073152: Update Standard/ExtendedCharsets to work with module system
sherman
parents:
diff changeset
    82
        static {
f980bee32887 8073152: Update Standard/ExtendedCharsets to work with module system
sherman
parents:
diff changeset
    83
            initc2b(c2bBmp, HKSCSMapping.b2cBmpStr, HKSCSMapping.pua);
f980bee32887 8073152: Update Standard/ExtendedCharsets to work with module system
sherman
parents:
diff changeset
    84
            initc2b(c2bSupp, HKSCSMapping.b2cSuppStr, null);
f980bee32887 8073152: Update Standard/ExtendedCharsets to work with module system
sherman
parents:
diff changeset
    85
        }
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
        private Encoder(Charset cs) {
f980bee32887 8073152: Update Standard/ExtendedCharsets to work with module system
sherman
parents:
diff changeset
    88
            super(cs, big5, c2bBmp, c2bSupp);
f980bee32887 8073152: Update Standard/ExtendedCharsets to work with module system
sherman
parents:
diff changeset
    89
        }
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
}