SingleByte-X.java.template revision 2362
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore/*
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore * Copyright (c) 2008, Oracle and/or its affiliates. All rights reserved.
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore *
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore * This code is free software; you can redistribute it and/or modify it
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore * under the terms of the GNU General Public License version 2 only, as
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore * published by the Free Software Foundation. Oracle designates this
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore * particular file as subject to the "Classpath" exception as provided
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore * by Oracle in the LICENSE file that accompanied this code.
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore *
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore * This code is distributed in the hope that it will be useful, but WITHOUT
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore * version 2 for more details (a copy is included in the LICENSE file that
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore * accompanied this code).
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore *
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore * You should have received a copy of the GNU General Public License version
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore * 2 along with this work; if not, write to the Free Software Foundation,
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore *
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore * or visit www.oracle.com if you need additional information or have any
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore * questions.
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore */
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amorepackage $PACKAGE$;
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amoreimport java.nio.charset.Charset;
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amoreimport java.nio.charset.CharsetDecoder;
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amoreimport java.nio.charset.CharsetEncoder;
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amoreimport sun.nio.cs.StandardCharsets;
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amoreimport sun.nio.cs.SingleByte;
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amoreimport sun.nio.cs.HistoricallyNamedCharset;
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amoreimport static sun.nio.cs.CharsetMapping.*;
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amorepublic class $NAME_CLZ$ extends Charset implements HistoricallyNamedCharset
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore{
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore public $NAME_CLZ$() {
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore super("$NAME_CS$", $NAME_ALIASES$);
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore }
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore public String historicalName() {
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore return "$NAME_HIS$";
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore }
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore public boolean contains(Charset cs) {
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore $CONTAINS$;
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore }
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore public CharsetDecoder newDecoder() {
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore return new SingleByte.Decoder(this, b2c);
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore }
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore
public CharsetEncoder newEncoder() {
return new SingleByte.Encoder(this, c2b, c2bIndex);
}
public String getDecoderSingleByteMappings() {
return b2cTable;
}
public char[] getEncoderIndex2() {
return c2b;
}
public char[] getEncoderIndex1() {
return c2bIndex;
}
private final static String b2cTable = $B2CTABLE$
private final static char[] b2c = b2cTable.toCharArray();
private final static char[] c2b = new char[$C2BLENGTH$];
private final static char[] c2bIndex = new char[0x100];
static {
char[] b2cMap = b2c;
char[] c2bNR = null;
$NONROUNDTRIP_B2C$
$NONROUNDTRIP_C2B$
SingleByte.initC2B(b2cMap, c2bNR, c2b, c2bIndex);
}
}