1245N/A/*
2362N/A * Copyright (c) 2003, 2004, Oracle and/or its affiliates. All rights reserved.
1245N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
1245N/A *
1245N/A * This code is free software; you can redistribute it and/or modify it
1245N/A * under the terms of the GNU General Public License version 2 only, as
2362N/A * published by the Free Software Foundation. Oracle designates this
1245N/A * particular file as subject to the "Classpath" exception as provided
2362N/A * by Oracle in the LICENSE file that accompanied this code.
1245N/A *
1245N/A * This code is distributed in the hope that it will be useful, but WITHOUT
1245N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
1245N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
1245N/A * version 2 for more details (a copy is included in the LICENSE file that
1245N/A * accompanied this code).
1245N/A *
1245N/A * You should have received a copy of the GNU General Public License version
1245N/A * 2 along with this work; if not, write to the Free Software Foundation,
1245N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
1245N/A *
2362N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
2362N/A * or visit www.oracle.com if you need additional information or have any
2362N/A * questions.
1245N/A */
1245N/A
1245N/A/*
1245N/A */
1245N/A
1245N/A
1245N/Aimport java.nio.charset.Charset;
1245N/Aimport java.nio.charset.CharsetDecoder;
1245N/Aimport java.nio.charset.CharsetEncoder;
1245N/Aimport java.nio.charset.CharacterCodingException;
1245N/Aimport sun.nio.cs.HistoricallyNamedCharset;
1245N/A
1245N/Apublic class IBM943C_OLD extends Charset implements HistoricallyNamedCharset
1245N/A{
1245N/A
1245N/A public IBM943C_OLD() {
1245N/A super("x-IBM943C_OLD", null);
1245N/A }
1245N/A
1245N/A public String historicalName() {
1245N/A return "Cp943_OLDC";
1245N/A }
1245N/A
1245N/A public boolean contains(Charset cs) {
1245N/A return ((cs.name().equals("US-ASCII"))
1245N/A || (cs instanceof IBM943C_OLD));
1245N/A }
1245N/A
1245N/A public CharsetDecoder newDecoder() {
1245N/A return new Decoder(this);
1245N/A }
1245N/A
1245N/A public CharsetEncoder newEncoder() {
1245N/A return new Encoder(this);
1245N/A }
1245N/A
1245N/A private static class Decoder extends IBM943_OLD.Decoder {
1245N/A protected static final String singleByteToChar;
1245N/A
1245N/A static {
1245N/A String indexs = "";
1245N/A for (char c = '\0'; c < '\u0080'; ++c) indexs += c;
1245N/A singleByteToChar = indexs +
1245N/A IBM943_OLD.Decoder.singleByteToChar.substring(indexs.length());
1245N/A }
1245N/A
1245N/A public Decoder(Charset cs) {
1245N/A super(cs, singleByteToChar);
1245N/A }
1245N/A }
1245N/A
1245N/A private static class Encoder extends IBM943_OLD.Encoder {
1245N/A
1245N/A protected static final short index1[];
1245N/A protected static final String index2a;
1245N/A protected static final int shift = 6;
1245N/A
1245N/A static {
1245N/A String indexs = "";
1245N/A for (char c = '\0'; c < '\u0080'; ++c) indexs += c;
1245N/A index2a = IBM943_OLD.Encoder.index2a + indexs;
1245N/A
1245N/A int o = IBM943_OLD.Encoder.index2a.length() + 15000;
1245N/A index1 = new short[IBM943_OLD.Encoder.index1.length];
1245N/A System.arraycopy(IBM943_OLD.Encoder.index1,
1245N/A 0,
1245N/A index1,
1245N/A 0,
1245N/A IBM943_OLD.Encoder.index1.length);
1245N/A
1245N/A for (int i = 0; i * (1<<shift) < 128; ++i) {
1245N/A index1[i] = (short)(o + i * (1<<shift));
1245N/A }
1245N/A }
1245N/A
1245N/A public Encoder(Charset cs) {
1245N/A super(cs, index1, index2a);
1245N/A }
1245N/A }
1245N/A}