feat(jdk8): move files to new folder to avoid resources compiled.
This commit is contained in:
2420
jdkSrc/jdk8/sun/nio/cs/ext/Big5.java
Normal file
2420
jdkSrc/jdk8/sun/nio/cs/ext/Big5.java
Normal file
File diff suppressed because it is too large
Load Diff
89
jdkSrc/jdk8/sun/nio/cs/ext/Big5_HKSCS.java
Normal file
89
jdkSrc/jdk8/sun/nio/cs/ext/Big5_HKSCS.java
Normal file
@@ -0,0 +1,89 @@
|
||||
/*
|
||||
* Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package sun.nio.cs.ext;
|
||||
|
||||
import java.nio.charset.Charset;
|
||||
import java.nio.charset.CharsetDecoder;
|
||||
import java.nio.charset.CharsetEncoder;
|
||||
import sun.nio.cs.HistoricallyNamedCharset;
|
||||
import static sun.nio.cs.CharsetMapping.*;
|
||||
|
||||
public class Big5_HKSCS extends Charset implements HistoricallyNamedCharset
|
||||
{
|
||||
public Big5_HKSCS() {
|
||||
super("Big5-HKSCS", ExtendedCharsets.aliasesFor("Big5-HKSCS"));
|
||||
}
|
||||
|
||||
public String historicalName() {
|
||||
return "Big5_HKSCS";
|
||||
}
|
||||
|
||||
public boolean contains(Charset cs) {
|
||||
return ((cs.name().equals("US-ASCII"))
|
||||
|| (cs instanceof Big5)
|
||||
|| (cs instanceof Big5_HKSCS));
|
||||
}
|
||||
|
||||
public CharsetDecoder newDecoder() {
|
||||
return new Decoder(this);
|
||||
}
|
||||
|
||||
public CharsetEncoder newEncoder() {
|
||||
return new Encoder(this);
|
||||
}
|
||||
|
||||
static class Decoder extends HKSCS.Decoder {
|
||||
private static DoubleByte.Decoder big5 =
|
||||
(DoubleByte.Decoder)new Big5().newDecoder();
|
||||
|
||||
private static char[][] b2cBmp = new char[0x100][];
|
||||
private static char[][] b2cSupp = new char[0x100][];
|
||||
static {
|
||||
initb2c(b2cBmp, HKSCSMapping.b2cBmpStr);
|
||||
initb2c(b2cSupp, HKSCSMapping.b2cSuppStr);
|
||||
}
|
||||
|
||||
private Decoder(Charset cs) {
|
||||
super(cs, big5, b2cBmp, b2cSupp);
|
||||
}
|
||||
}
|
||||
|
||||
static class Encoder extends HKSCS.Encoder {
|
||||
private static DoubleByte.Encoder big5 =
|
||||
(DoubleByte.Encoder)new Big5().newEncoder();
|
||||
|
||||
static char[][] c2bBmp = new char[0x100][];
|
||||
static char[][] c2bSupp = new char[0x100][];
|
||||
static {
|
||||
initc2b(c2bBmp, HKSCSMapping.b2cBmpStr, HKSCSMapping.pua);
|
||||
initc2b(c2bSupp, HKSCSMapping.b2cSuppStr, null);
|
||||
}
|
||||
|
||||
private Encoder(Charset cs) {
|
||||
super(cs, big5, c2bBmp, c2bSupp);
|
||||
}
|
||||
}
|
||||
}
|
||||
85
jdkSrc/jdk8/sun/nio/cs/ext/Big5_HKSCS_2001.java
Normal file
85
jdkSrc/jdk8/sun/nio/cs/ext/Big5_HKSCS_2001.java
Normal file
@@ -0,0 +1,85 @@
|
||||
/*
|
||||
* Copyright (c) 2002, 2010, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package sun.nio.cs.ext;
|
||||
|
||||
import java.nio.charset.Charset;
|
||||
import java.nio.charset.CharsetDecoder;
|
||||
import java.nio.charset.CharsetEncoder;
|
||||
import sun.nio.cs.HistoricallyNamedCharset;
|
||||
|
||||
public class Big5_HKSCS_2001 extends Charset
|
||||
{
|
||||
public Big5_HKSCS_2001() {
|
||||
super("x-Big5-HKSCS-2001", ExtendedCharsets.aliasesFor("x-Big5-HKSCS-2001"));
|
||||
}
|
||||
|
||||
public boolean contains(Charset cs) {
|
||||
return ((cs.name().equals("US-ASCII"))
|
||||
|| (cs instanceof Big5)
|
||||
|| (cs instanceof Big5_HKSCS_2001));
|
||||
}
|
||||
|
||||
public CharsetDecoder newDecoder() {
|
||||
return new Decoder(this);
|
||||
}
|
||||
|
||||
public CharsetEncoder newEncoder() {
|
||||
return new Encoder(this);
|
||||
}
|
||||
|
||||
private static class Decoder extends HKSCS.Decoder {
|
||||
private static DoubleByte.Decoder big5 =
|
||||
(DoubleByte.Decoder)new Big5().newDecoder();
|
||||
|
||||
private static char[][] b2cBmp = new char[0x100][];
|
||||
private static char[][] b2cSupp = new char[0x100][];
|
||||
static {
|
||||
initb2c(b2cBmp, HKSCS2001Mapping.b2cBmpStr);
|
||||
initb2c(b2cSupp, HKSCS2001Mapping.b2cSuppStr);
|
||||
}
|
||||
|
||||
private Decoder(Charset cs) {
|
||||
super(cs, big5, b2cBmp, b2cSupp);
|
||||
}
|
||||
}
|
||||
|
||||
private static class Encoder extends HKSCS.Encoder {
|
||||
private static DoubleByte.Encoder big5 =
|
||||
(DoubleByte.Encoder)new Big5().newEncoder();
|
||||
|
||||
static char[][] c2bBmp = new char[0x100][];
|
||||
static char[][] c2bSupp = new char[0x100][];
|
||||
static {
|
||||
initc2b(c2bBmp, HKSCS2001Mapping.b2cBmpStr,
|
||||
HKSCS2001Mapping.pua);
|
||||
initc2b(c2bSupp, HKSCS2001Mapping.b2cSuppStr, null);
|
||||
}
|
||||
|
||||
private Encoder(Charset cs) {
|
||||
super(cs, big5, c2bBmp, c2bSupp);
|
||||
}
|
||||
}
|
||||
}
|
||||
126
jdkSrc/jdk8/sun/nio/cs/ext/Big5_Solaris.java
Normal file
126
jdkSrc/jdk8/sun/nio/cs/ext/Big5_Solaris.java
Normal file
@@ -0,0 +1,126 @@
|
||||
/*
|
||||
* Copyright (c) 2004, 2010, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package sun.nio.cs.ext;
|
||||
|
||||
import java.nio.charset.Charset;
|
||||
import java.nio.charset.CharsetDecoder;
|
||||
import java.nio.charset.CharsetEncoder;
|
||||
import sun.nio.cs.HistoricallyNamedCharset;
|
||||
import java.util.Arrays;
|
||||
import static sun.nio.cs.CharsetMapping.*;
|
||||
|
||||
public class Big5_Solaris extends Charset implements HistoricallyNamedCharset
|
||||
{
|
||||
public Big5_Solaris() {
|
||||
super("x-Big5-Solaris", ExtendedCharsets.aliasesFor("x-Big5-Solaris"));
|
||||
}
|
||||
|
||||
public String historicalName() {
|
||||
return "Big5_Solaris";
|
||||
}
|
||||
|
||||
public boolean contains(Charset cs) {
|
||||
return ((cs.name().equals("US-ASCII"))
|
||||
|| (cs instanceof Big5)
|
||||
|| (cs instanceof Big5_Solaris));
|
||||
}
|
||||
|
||||
public CharsetDecoder newDecoder() {
|
||||
initb2c();
|
||||
return new DoubleByte.Decoder(this, b2c, b2cSB, 0x40, 0xfe);
|
||||
}
|
||||
|
||||
public CharsetEncoder newEncoder() {
|
||||
initc2b();
|
||||
return new DoubleByte.Encoder(this, c2b, c2bIndex);
|
||||
}
|
||||
|
||||
static char[][] b2c;
|
||||
static char[] b2cSB;
|
||||
private static volatile boolean b2cInitialized = false;
|
||||
|
||||
static void initb2c() {
|
||||
if (b2cInitialized)
|
||||
return;
|
||||
synchronized (Big5_Solaris.class) {
|
||||
if (b2cInitialized)
|
||||
return;
|
||||
Big5.initb2c();
|
||||
b2c = Big5.b2c.clone();
|
||||
// Big5 Solaris implementation has 7 additional mappings
|
||||
int[] sol = new int[] {
|
||||
0xF9D6, 0x7881,
|
||||
0xF9D7, 0x92B9,
|
||||
0xF9D8, 0x88CF,
|
||||
0xF9D9, 0x58BB,
|
||||
0xF9DA, 0x6052,
|
||||
0xF9DB, 0x7CA7,
|
||||
0xF9DC, 0x5AFA };
|
||||
if (b2c[0xf9] == DoubleByte.B2C_UNMAPPABLE) {
|
||||
b2c[0xf9] = new char[0xfe - 0x40 + 1];
|
||||
Arrays.fill(b2c[0xf9], UNMAPPABLE_DECODING);
|
||||
}
|
||||
|
||||
for (int i = 0; i < sol.length;) {
|
||||
b2c[0xf9][sol[i++] & 0xff - 0x40] = (char)sol[i++];
|
||||
}
|
||||
b2cSB = Big5.b2cSB;
|
||||
b2cInitialized = true;
|
||||
}
|
||||
}
|
||||
|
||||
static char[] c2b;
|
||||
static char[] c2bIndex;
|
||||
private static volatile boolean c2bInitialized = false;
|
||||
|
||||
static void initc2b() {
|
||||
if (c2bInitialized)
|
||||
return;
|
||||
synchronized (Big5_Solaris.class) {
|
||||
if (c2bInitialized)
|
||||
return;
|
||||
Big5.initc2b();
|
||||
c2b = Big5.c2b.clone();
|
||||
c2bIndex = Big5.c2bIndex.clone();
|
||||
int[] sol = new int[] {
|
||||
0x7881, 0xF9D6,
|
||||
0x92B9, 0xF9D7,
|
||||
0x88CF, 0xF9D8,
|
||||
0x58BB, 0xF9D9,
|
||||
0x6052, 0xF9DA,
|
||||
0x7CA7, 0xF9DB,
|
||||
0x5AFA, 0xF9DC };
|
||||
|
||||
for (int i = 0; i < sol.length;) {
|
||||
int c = sol[i++];
|
||||
// no need to check c2bIndex[c >>8], we know it points
|
||||
// to the appropriate place.
|
||||
c2b[c2bIndex[c >> 8] + (c & 0xff)] = (char)sol[i++];
|
||||
}
|
||||
c2bInitialized = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
41
jdkSrc/jdk8/sun/nio/cs/ext/DelegatableDecoder.java
Normal file
41
jdkSrc/jdk8/sun/nio/cs/ext/DelegatableDecoder.java
Normal file
@@ -0,0 +1,41 @@
|
||||
/*
|
||||
* Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package sun.nio.cs.ext;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
import java.nio.CharBuffer;
|
||||
import java.nio.charset.CoderResult;
|
||||
|
||||
/**
|
||||
* A decoder that can be delegated to by another decoder
|
||||
* when normal inheritance cannot be used.
|
||||
* Used by autodecting decoders.
|
||||
*/
|
||||
interface DelegatableDecoder {
|
||||
CoderResult decodeLoop(ByteBuffer src, CharBuffer dst);
|
||||
void implReset();
|
||||
CoderResult implFlush(CharBuffer out);
|
||||
}
|
||||
929
jdkSrc/jdk8/sun/nio/cs/ext/DoubleByte.java
Normal file
929
jdkSrc/jdk8/sun/nio/cs/ext/DoubleByte.java
Normal file
@@ -0,0 +1,929 @@
|
||||
/*
|
||||
* Copyright (c) 2009, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package sun.nio.cs.ext;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
import java.nio.CharBuffer;
|
||||
import java.nio.charset.Charset;
|
||||
import java.nio.charset.CharsetDecoder;
|
||||
import java.nio.charset.CharsetEncoder;
|
||||
import java.nio.charset.CoderResult;
|
||||
import java.util.Arrays;
|
||||
import sun.nio.cs.Surrogate;
|
||||
import sun.nio.cs.ArrayDecoder;
|
||||
import sun.nio.cs.ArrayEncoder;
|
||||
import static sun.nio.cs.CharsetMapping.*;
|
||||
|
||||
/*
|
||||
* Four types of "DoubleByte" charsets are implemented in this class
|
||||
* (1)DoubleByte
|
||||
* The "mostly widely used" multibyte charset, a combination of
|
||||
* a singlebyte character set (usually the ASCII charset) and a
|
||||
* doublebyte character set. The codepoint values of singlebyte
|
||||
* and doublebyte don't overlap. Microsoft's multibyte charsets
|
||||
* and IBM's "DBCS_ASCII" charsets, such as IBM1381, 942, 943,
|
||||
* 948, 949 and 950 are such charsets.
|
||||
*
|
||||
* (2)DoubleByte_EBCDIC
|
||||
* IBM EBCDIC Mix multibyte charset. Use SO and SI to shift (switch)
|
||||
* in and out between the singlebyte character set and doublebyte
|
||||
* character set.
|
||||
*
|
||||
* (3)DoubleByte_SIMPLE_EUC
|
||||
* It's a "simple" form of EUC encoding scheme, only have the
|
||||
* singlebyte character set G0 and one doublebyte character set
|
||||
* G1 are defined, G2 (with SS2) and G3 (with SS3) are not used.
|
||||
* So it is actually the same as the "typical" type (1) mentioned
|
||||
* above, except it return "malformed" for the SS2 and SS3 when
|
||||
* decoding.
|
||||
*
|
||||
* (4)DoubleByte ONLY
|
||||
* A "pure" doublebyte only character set. From implementation
|
||||
* point of view, this is the type (1) with "decodeSingle" always
|
||||
* returns unmappable.
|
||||
*
|
||||
* For simplicity, all implementations share the same decoding and
|
||||
* encoding data structure.
|
||||
*
|
||||
* Decoding:
|
||||
*
|
||||
* char[][] b2c;
|
||||
* char[] b2cSB;
|
||||
* int b2Min, b2Max
|
||||
*
|
||||
* public char decodeSingle(int b) {
|
||||
* return b2cSB.[b];
|
||||
* }
|
||||
*
|
||||
* public char decodeDouble(int b1, int b2) {
|
||||
* if (b2 < b2Min || b2 > b2Max)
|
||||
* return UNMAPPABLE_DECODING;
|
||||
* return b2c[b1][b2 - b2Min];
|
||||
* }
|
||||
*
|
||||
* (1)b2Min, b2Max are the corresponding min and max value of the
|
||||
* low-half of the double-byte.
|
||||
* (2)The high 8-bit/b1 of the double-byte are used to indexed into
|
||||
* b2c array.
|
||||
*
|
||||
* Encoding:
|
||||
*
|
||||
* char[] c2b;
|
||||
* char[] c2bIndex;
|
||||
*
|
||||
* public int encodeChar(char ch) {
|
||||
* return c2b[c2bIndex[ch >> 8] + (ch & 0xff)];
|
||||
* }
|
||||
*
|
||||
*/
|
||||
|
||||
public class DoubleByte {
|
||||
|
||||
public final static char[] B2C_UNMAPPABLE;
|
||||
static {
|
||||
B2C_UNMAPPABLE = new char[0x100];
|
||||
Arrays.fill(B2C_UNMAPPABLE, UNMAPPABLE_DECODING);
|
||||
}
|
||||
|
||||
public static class Decoder extends CharsetDecoder
|
||||
implements DelegatableDecoder, ArrayDecoder
|
||||
{
|
||||
final char[][] b2c;
|
||||
final char[] b2cSB;
|
||||
final int b2Min;
|
||||
final int b2Max;
|
||||
|
||||
// for SimpleEUC override
|
||||
protected CoderResult crMalformedOrUnderFlow(int b) {
|
||||
return CoderResult.UNDERFLOW;
|
||||
}
|
||||
|
||||
protected CoderResult crMalformedOrUnmappable(int b1, int b2) {
|
||||
if (b2c[b1] == B2C_UNMAPPABLE || // isNotLeadingByte(b1)
|
||||
b2c[b2] != B2C_UNMAPPABLE || // isLeadingByte(b2)
|
||||
decodeSingle(b2) != UNMAPPABLE_DECODING) { // isSingle(b2)
|
||||
return CoderResult.malformedForLength(1);
|
||||
}
|
||||
return CoderResult.unmappableForLength(2);
|
||||
}
|
||||
|
||||
Decoder(Charset cs, float avgcpb, float maxcpb,
|
||||
char[][] b2c, char[] b2cSB,
|
||||
int b2Min, int b2Max) {
|
||||
super(cs, avgcpb, maxcpb);
|
||||
this.b2c = b2c;
|
||||
this.b2cSB = b2cSB;
|
||||
this.b2Min = b2Min;
|
||||
this.b2Max = b2Max;
|
||||
}
|
||||
|
||||
Decoder(Charset cs, char[][] b2c, char[] b2cSB, int b2Min, int b2Max) {
|
||||
this(cs, 0.5f, 1.0f, b2c, b2cSB, b2Min, b2Max);
|
||||
}
|
||||
|
||||
protected CoderResult decodeArrayLoop(ByteBuffer src, CharBuffer dst) {
|
||||
byte[] sa = src.array();
|
||||
int sp = src.arrayOffset() + src.position();
|
||||
int sl = src.arrayOffset() + src.limit();
|
||||
|
||||
char[] da = dst.array();
|
||||
int dp = dst.arrayOffset() + dst.position();
|
||||
int dl = dst.arrayOffset() + dst.limit();
|
||||
|
||||
try {
|
||||
while (sp < sl && dp < dl) {
|
||||
// inline the decodeSingle/Double() for better performance
|
||||
int inSize = 1;
|
||||
int b1 = sa[sp] & 0xff;
|
||||
char c = b2cSB[b1];
|
||||
if (c == UNMAPPABLE_DECODING) {
|
||||
if (sl - sp < 2)
|
||||
return crMalformedOrUnderFlow(b1);
|
||||
int b2 = sa[sp + 1] & 0xff;
|
||||
if (b2 < b2Min || b2 > b2Max ||
|
||||
(c = b2c[b1][b2 - b2Min]) == UNMAPPABLE_DECODING) {
|
||||
return crMalformedOrUnmappable(b1, b2);
|
||||
}
|
||||
inSize++;
|
||||
}
|
||||
da[dp++] = c;
|
||||
sp += inSize;
|
||||
}
|
||||
return (sp >= sl) ? CoderResult.UNDERFLOW
|
||||
: CoderResult.OVERFLOW;
|
||||
} finally {
|
||||
src.position(sp - src.arrayOffset());
|
||||
dst.position(dp - dst.arrayOffset());
|
||||
}
|
||||
}
|
||||
|
||||
protected CoderResult decodeBufferLoop(ByteBuffer src, CharBuffer dst) {
|
||||
int mark = src.position();
|
||||
try {
|
||||
|
||||
while (src.hasRemaining() && dst.hasRemaining()) {
|
||||
int b1 = src.get() & 0xff;
|
||||
char c = b2cSB[b1];
|
||||
int inSize = 1;
|
||||
if (c == UNMAPPABLE_DECODING) {
|
||||
if (src.remaining() < 1)
|
||||
return crMalformedOrUnderFlow(b1);
|
||||
int b2 = src.get() & 0xff;
|
||||
if (b2 < b2Min || b2 > b2Max ||
|
||||
(c = b2c[b1][b2 - b2Min]) == UNMAPPABLE_DECODING)
|
||||
return crMalformedOrUnmappable(b1, b2);
|
||||
inSize++;
|
||||
}
|
||||
dst.put(c);
|
||||
mark += inSize;
|
||||
}
|
||||
return src.hasRemaining()? CoderResult.OVERFLOW
|
||||
: CoderResult.UNDERFLOW;
|
||||
} finally {
|
||||
src.position(mark);
|
||||
}
|
||||
}
|
||||
|
||||
// Make some protected methods public for use by JISAutoDetect
|
||||
public CoderResult decodeLoop(ByteBuffer src, CharBuffer dst) {
|
||||
if (src.hasArray() && dst.hasArray())
|
||||
return decodeArrayLoop(src, dst);
|
||||
else
|
||||
return decodeBufferLoop(src, dst);
|
||||
}
|
||||
|
||||
public int decode(byte[] src, int sp, int len, char[] dst) {
|
||||
int dp = 0;
|
||||
int sl = sp + len;
|
||||
char repl = replacement().charAt(0);
|
||||
while (sp < sl) {
|
||||
int b1 = src[sp++] & 0xff;
|
||||
char c = b2cSB[b1];
|
||||
if (c == UNMAPPABLE_DECODING) {
|
||||
if (sp < sl) {
|
||||
int b2 = src[sp++] & 0xff;
|
||||
if (b2 < b2Min || b2 > b2Max ||
|
||||
(c = b2c[b1][b2 - b2Min]) == UNMAPPABLE_DECODING) {
|
||||
if (b2c[b1] == B2C_UNMAPPABLE || // isNotLeadingByte
|
||||
b2c[b2] != B2C_UNMAPPABLE || // isLeadingByte
|
||||
decodeSingle(b2) != UNMAPPABLE_DECODING) {
|
||||
sp--;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (c == UNMAPPABLE_DECODING) {
|
||||
c = repl;
|
||||
}
|
||||
}
|
||||
dst[dp++] = c;
|
||||
}
|
||||
return dp;
|
||||
}
|
||||
|
||||
public void implReset() {
|
||||
super.implReset();
|
||||
}
|
||||
|
||||
public CoderResult implFlush(CharBuffer out) {
|
||||
return super.implFlush(out);
|
||||
}
|
||||
|
||||
// decode loops are not using decodeSingle/Double() for performance
|
||||
// reason.
|
||||
public char decodeSingle(int b) {
|
||||
return b2cSB[b];
|
||||
}
|
||||
|
||||
public char decodeDouble(int b1, int b2) {
|
||||
if (b1 < 0 || b1 > b2c.length ||
|
||||
b2 < b2Min || b2 > b2Max)
|
||||
return UNMAPPABLE_DECODING;
|
||||
return b2c[b1][b2 - b2Min];
|
||||
}
|
||||
}
|
||||
|
||||
// IBM_EBCDIC_DBCS
|
||||
public static class Decoder_EBCDIC extends Decoder {
|
||||
private static final int SBCS = 0;
|
||||
private static final int DBCS = 1;
|
||||
private static final int SO = 0x0e;
|
||||
private static final int SI = 0x0f;
|
||||
private int currentState;
|
||||
|
||||
Decoder_EBCDIC(Charset cs,
|
||||
char[][] b2c, char[] b2cSB, int b2Min, int b2Max) {
|
||||
super(cs, b2c, b2cSB, b2Min, b2Max);
|
||||
}
|
||||
|
||||
public void implReset() {
|
||||
currentState = SBCS;
|
||||
}
|
||||
|
||||
// Check validity of dbcs ebcdic byte pair values
|
||||
//
|
||||
// First byte : 0x41 -- 0xFE
|
||||
// Second byte: 0x41 -- 0xFE
|
||||
// Doublebyte blank: 0x4040
|
||||
//
|
||||
// The validation implementation in "old" DBCS_IBM_EBCDIC and sun.io
|
||||
// as
|
||||
// if ((b1 != 0x40 || b2 != 0x40) &&
|
||||
// (b2 < 0x41 || b2 > 0xfe)) {...}
|
||||
// is not correct/complete (range check for b1)
|
||||
//
|
||||
private static boolean isDoubleByte(int b1, int b2) {
|
||||
return (0x41 <= b1 && b1 <= 0xfe && 0x41 <= b2 && b2 <= 0xfe)
|
||||
|| (b1 == 0x40 && b2 == 0x40); // DBCS-HOST SPACE
|
||||
}
|
||||
|
||||
protected CoderResult decodeArrayLoop(ByteBuffer src, CharBuffer dst) {
|
||||
byte[] sa = src.array();
|
||||
int sp = src.arrayOffset() + src.position();
|
||||
int sl = src.arrayOffset() + src.limit();
|
||||
char[] da = dst.array();
|
||||
int dp = dst.arrayOffset() + dst.position();
|
||||
int dl = dst.arrayOffset() + dst.limit();
|
||||
|
||||
try {
|
||||
// don't check dp/dl together here, it's possible to
|
||||
// decdoe a SO/SI without space in output buffer.
|
||||
while (sp < sl) {
|
||||
int b1 = sa[sp] & 0xff;
|
||||
int inSize = 1;
|
||||
if (b1 == SO) { // Shift out
|
||||
if (currentState != SBCS)
|
||||
return CoderResult.malformedForLength(1);
|
||||
else
|
||||
currentState = DBCS;
|
||||
} else if (b1 == SI) {
|
||||
if (currentState != DBCS)
|
||||
return CoderResult.malformedForLength(1);
|
||||
else
|
||||
currentState = SBCS;
|
||||
} else {
|
||||
char c = UNMAPPABLE_DECODING;
|
||||
if (currentState == SBCS) {
|
||||
c = b2cSB[b1];
|
||||
if (c == UNMAPPABLE_DECODING)
|
||||
return CoderResult.unmappableForLength(1);
|
||||
} else {
|
||||
if (sl - sp < 2)
|
||||
return CoderResult.UNDERFLOW;
|
||||
int b2 = sa[sp + 1] & 0xff;
|
||||
if (b2 < b2Min || b2 > b2Max ||
|
||||
(c = b2c[b1][b2 - b2Min]) == UNMAPPABLE_DECODING) {
|
||||
if (!isDoubleByte(b1, b2))
|
||||
return CoderResult.malformedForLength(2);
|
||||
return CoderResult.unmappableForLength(2);
|
||||
}
|
||||
inSize++;
|
||||
}
|
||||
if (dl - dp < 1)
|
||||
return CoderResult.OVERFLOW;
|
||||
|
||||
da[dp++] = c;
|
||||
}
|
||||
sp += inSize;
|
||||
}
|
||||
return CoderResult.UNDERFLOW;
|
||||
} finally {
|
||||
src.position(sp - src.arrayOffset());
|
||||
dst.position(dp - dst.arrayOffset());
|
||||
}
|
||||
}
|
||||
|
||||
protected CoderResult decodeBufferLoop(ByteBuffer src, CharBuffer dst) {
|
||||
int mark = src.position();
|
||||
try {
|
||||
while (src.hasRemaining()) {
|
||||
int b1 = src.get() & 0xff;
|
||||
int inSize = 1;
|
||||
if (b1 == SO) { // Shift out
|
||||
if (currentState != SBCS)
|
||||
return CoderResult.malformedForLength(1);
|
||||
else
|
||||
currentState = DBCS;
|
||||
} else if (b1 == SI) {
|
||||
if (currentState != DBCS)
|
||||
return CoderResult.malformedForLength(1);
|
||||
else
|
||||
currentState = SBCS;
|
||||
} else {
|
||||
char c = UNMAPPABLE_DECODING;
|
||||
if (currentState == SBCS) {
|
||||
c = b2cSB[b1];
|
||||
if (c == UNMAPPABLE_DECODING)
|
||||
return CoderResult.unmappableForLength(1);
|
||||
} else {
|
||||
if (src.remaining() < 1)
|
||||
return CoderResult.UNDERFLOW;
|
||||
int b2 = src.get()&0xff;
|
||||
if (b2 < b2Min || b2 > b2Max ||
|
||||
(c = b2c[b1][b2 - b2Min]) == UNMAPPABLE_DECODING) {
|
||||
if (!isDoubleByte(b1, b2))
|
||||
return CoderResult.malformedForLength(2);
|
||||
return CoderResult.unmappableForLength(2);
|
||||
}
|
||||
inSize++;
|
||||
}
|
||||
|
||||
if (dst.remaining() < 1)
|
||||
return CoderResult.OVERFLOW;
|
||||
|
||||
dst.put(c);
|
||||
}
|
||||
mark += inSize;
|
||||
}
|
||||
return CoderResult.UNDERFLOW;
|
||||
} finally {
|
||||
src.position(mark);
|
||||
}
|
||||
}
|
||||
|
||||
public int decode(byte[] src, int sp, int len, char[] dst) {
|
||||
int dp = 0;
|
||||
int sl = sp + len;
|
||||
currentState = SBCS;
|
||||
char repl = replacement().charAt(0);
|
||||
while (sp < sl) {
|
||||
int b1 = src[sp++] & 0xff;
|
||||
if (b1 == SO) { // Shift out
|
||||
if (currentState != SBCS)
|
||||
dst[dp++] = repl;
|
||||
else
|
||||
currentState = DBCS;
|
||||
} else if (b1 == SI) {
|
||||
if (currentState != DBCS)
|
||||
dst[dp++] = repl;
|
||||
else
|
||||
currentState = SBCS;
|
||||
} else {
|
||||
char c = UNMAPPABLE_DECODING;
|
||||
if (currentState == SBCS) {
|
||||
c = b2cSB[b1];
|
||||
if (c == UNMAPPABLE_DECODING)
|
||||
c = repl;
|
||||
} else {
|
||||
if (sl == sp) {
|
||||
c = repl;
|
||||
} else {
|
||||
int b2 = src[sp++] & 0xff;
|
||||
if (b2 < b2Min || b2 > b2Max ||
|
||||
(c = b2c[b1][b2 - b2Min]) == UNMAPPABLE_DECODING) {
|
||||
c = repl;
|
||||
}
|
||||
}
|
||||
}
|
||||
dst[dp++] = c;
|
||||
}
|
||||
}
|
||||
return dp;
|
||||
}
|
||||
}
|
||||
|
||||
// DBCS_ONLY
|
||||
public static class Decoder_DBCSONLY extends Decoder {
|
||||
static final char[] b2cSB_UNMAPPABLE;
|
||||
static {
|
||||
b2cSB_UNMAPPABLE = new char[0x100];
|
||||
Arrays.fill(b2cSB_UNMAPPABLE, UNMAPPABLE_DECODING);
|
||||
}
|
||||
Decoder_DBCSONLY(Charset cs, char[][] b2c, char[] b2cSB, int b2Min, int b2Max) {
|
||||
super(cs, 0.5f, 1.0f, b2c, b2cSB_UNMAPPABLE, b2Min, b2Max);
|
||||
}
|
||||
}
|
||||
|
||||
// EUC_SIMPLE
|
||||
// The only thing we need to "override" is to check SS2/SS3 and
|
||||
// return "malformed" if found
|
||||
public static class Decoder_EUC_SIM extends Decoder {
|
||||
private final int SS2 = 0x8E;
|
||||
private final int SS3 = 0x8F;
|
||||
|
||||
Decoder_EUC_SIM(Charset cs,
|
||||
char[][] b2c, char[] b2cSB, int b2Min, int b2Max) {
|
||||
super(cs, b2c, b2cSB, b2Min, b2Max);
|
||||
}
|
||||
|
||||
// No support provided for G2/G3 for SimpleEUC
|
||||
protected CoderResult crMalformedOrUnderFlow(int b) {
|
||||
if (b == SS2 || b == SS3 )
|
||||
return CoderResult.malformedForLength(1);
|
||||
return CoderResult.UNDERFLOW;
|
||||
}
|
||||
|
||||
protected CoderResult crMalformedOrUnmappable(int b1, int b2) {
|
||||
if (b1 == SS2 || b1 == SS3 )
|
||||
return CoderResult.malformedForLength(1);
|
||||
return CoderResult.unmappableForLength(2);
|
||||
}
|
||||
|
||||
public int decode(byte[] src, int sp, int len, char[] dst) {
|
||||
int dp = 0;
|
||||
int sl = sp + len;
|
||||
char repl = replacement().charAt(0);
|
||||
while (sp < sl) {
|
||||
int b1 = src[sp++] & 0xff;
|
||||
char c = b2cSB[b1];
|
||||
if (c == UNMAPPABLE_DECODING) {
|
||||
if (sp < sl) {
|
||||
int b2 = src[sp++] & 0xff;
|
||||
if (b2 < b2Min || b2 > b2Max ||
|
||||
(c = b2c[b1][b2 - b2Min]) == UNMAPPABLE_DECODING) {
|
||||
if (b1 == SS2 || b1 == SS3) {
|
||||
sp--;
|
||||
}
|
||||
c = repl;
|
||||
}
|
||||
} else {
|
||||
c = repl;
|
||||
}
|
||||
}
|
||||
dst[dp++] = c;
|
||||
}
|
||||
return dp;
|
||||
}
|
||||
}
|
||||
|
||||
public static class Encoder extends CharsetEncoder
|
||||
implements ArrayEncoder
|
||||
{
|
||||
final int MAX_SINGLEBYTE = 0xff;
|
||||
private final char[] c2b;
|
||||
private final char[] c2bIndex;
|
||||
Surrogate.Parser sgp;
|
||||
|
||||
protected Encoder(Charset cs, char[] c2b, char[] c2bIndex) {
|
||||
super(cs, 2.0f, 2.0f);
|
||||
this.c2b = c2b;
|
||||
this.c2bIndex = c2bIndex;
|
||||
}
|
||||
|
||||
Encoder(Charset cs, float avg, float max, byte[] repl, char[] c2b, char[] c2bIndex) {
|
||||
super(cs, avg, max, repl);
|
||||
this.c2b = c2b;
|
||||
this.c2bIndex = c2bIndex;
|
||||
}
|
||||
|
||||
public boolean canEncode(char c) {
|
||||
return encodeChar(c) != UNMAPPABLE_ENCODING;
|
||||
}
|
||||
|
||||
Surrogate.Parser sgp() {
|
||||
if (sgp == null)
|
||||
sgp = new Surrogate.Parser();
|
||||
return sgp;
|
||||
}
|
||||
|
||||
protected CoderResult encodeArrayLoop(CharBuffer src, ByteBuffer dst) {
|
||||
char[] sa = src.array();
|
||||
int sp = src.arrayOffset() + src.position();
|
||||
int sl = src.arrayOffset() + src.limit();
|
||||
|
||||
byte[] da = dst.array();
|
||||
int dp = dst.arrayOffset() + dst.position();
|
||||
int dl = dst.arrayOffset() + dst.limit();
|
||||
|
||||
try {
|
||||
while (sp < sl) {
|
||||
char c = sa[sp];
|
||||
int bb = encodeChar(c);
|
||||
if (bb == UNMAPPABLE_ENCODING) {
|
||||
if (Character.isSurrogate(c)) {
|
||||
if (sgp().parse(c, sa, sp, sl) < 0)
|
||||
return sgp.error();
|
||||
return sgp.unmappableResult();
|
||||
}
|
||||
return CoderResult.unmappableForLength(1);
|
||||
}
|
||||
|
||||
if (bb > MAX_SINGLEBYTE) { // DoubleByte
|
||||
if (dl - dp < 2)
|
||||
return CoderResult.OVERFLOW;
|
||||
da[dp++] = (byte)(bb >> 8);
|
||||
da[dp++] = (byte)bb;
|
||||
} else { // SingleByte
|
||||
if (dl - dp < 1)
|
||||
return CoderResult.OVERFLOW;
|
||||
da[dp++] = (byte)bb;
|
||||
}
|
||||
|
||||
sp++;
|
||||
}
|
||||
return CoderResult.UNDERFLOW;
|
||||
} finally {
|
||||
src.position(sp - src.arrayOffset());
|
||||
dst.position(dp - dst.arrayOffset());
|
||||
}
|
||||
}
|
||||
|
||||
protected CoderResult encodeBufferLoop(CharBuffer src, ByteBuffer dst) {
|
||||
int mark = src.position();
|
||||
try {
|
||||
while (src.hasRemaining()) {
|
||||
char c = src.get();
|
||||
int bb = encodeChar(c);
|
||||
if (bb == UNMAPPABLE_ENCODING) {
|
||||
if (Character.isSurrogate(c)) {
|
||||
if (sgp().parse(c, src) < 0)
|
||||
return sgp.error();
|
||||
return sgp.unmappableResult();
|
||||
}
|
||||
return CoderResult.unmappableForLength(1);
|
||||
}
|
||||
if (bb > MAX_SINGLEBYTE) { // DoubleByte
|
||||
if (dst.remaining() < 2)
|
||||
return CoderResult.OVERFLOW;
|
||||
dst.put((byte)(bb >> 8));
|
||||
dst.put((byte)(bb));
|
||||
} else {
|
||||
if (dst.remaining() < 1)
|
||||
return CoderResult.OVERFLOW;
|
||||
dst.put((byte)bb);
|
||||
}
|
||||
mark++;
|
||||
}
|
||||
return CoderResult.UNDERFLOW;
|
||||
} finally {
|
||||
src.position(mark);
|
||||
}
|
||||
}
|
||||
|
||||
protected CoderResult encodeLoop(CharBuffer src, ByteBuffer dst) {
|
||||
if (src.hasArray() && dst.hasArray())
|
||||
return encodeArrayLoop(src, dst);
|
||||
else
|
||||
return encodeBufferLoop(src, dst);
|
||||
}
|
||||
|
||||
protected byte[] repl = replacement();
|
||||
protected void implReplaceWith(byte[] newReplacement) {
|
||||
repl = newReplacement;
|
||||
}
|
||||
|
||||
public int encode(char[] src, int sp, int len, byte[] dst) {
|
||||
int dp = 0;
|
||||
int sl = sp + len;
|
||||
int dl = dst.length;
|
||||
while (sp < sl) {
|
||||
char c = src[sp++];
|
||||
int bb = encodeChar(c);
|
||||
if (bb == UNMAPPABLE_ENCODING) {
|
||||
if (Character.isHighSurrogate(c) && sp < sl &&
|
||||
Character.isLowSurrogate(src[sp])) {
|
||||
sp++;
|
||||
}
|
||||
dst[dp++] = repl[0];
|
||||
if (repl.length > 1)
|
||||
dst[dp++] = repl[1];
|
||||
continue;
|
||||
} //else
|
||||
if (bb > MAX_SINGLEBYTE) { // DoubleByte
|
||||
dst[dp++] = (byte)(bb >> 8);
|
||||
dst[dp++] = (byte)bb;
|
||||
} else { // SingleByte
|
||||
dst[dp++] = (byte)bb;
|
||||
}
|
||||
|
||||
}
|
||||
return dp;
|
||||
}
|
||||
|
||||
public int encodeChar(char ch) {
|
||||
return c2b[c2bIndex[ch >> 8] + (ch & 0xff)];
|
||||
}
|
||||
|
||||
// init the c2b and c2bIndex tables from b2c.
|
||||
static void initC2B(String[] b2c, String b2cSB, String b2cNR, String c2bNR,
|
||||
int b2Min, int b2Max,
|
||||
char[] c2b, char[] c2bIndex)
|
||||
{
|
||||
Arrays.fill(c2b, (char)UNMAPPABLE_ENCODING);
|
||||
int off = 0x100;
|
||||
|
||||
char[][] b2c_ca = new char[b2c.length][];
|
||||
char[] b2cSB_ca = null;
|
||||
if (b2cSB != null)
|
||||
b2cSB_ca = b2cSB.toCharArray();
|
||||
|
||||
for (int i = 0; i < b2c.length; i++) {
|
||||
if (b2c[i] == null)
|
||||
continue;
|
||||
b2c_ca[i] = b2c[i].toCharArray();
|
||||
}
|
||||
|
||||
if (b2cNR != null) {
|
||||
int j = 0;
|
||||
while (j < b2cNR.length()) {
|
||||
char b = b2cNR.charAt(j++);
|
||||
char c = b2cNR.charAt(j++);
|
||||
if (b < 0x100 && b2cSB_ca != null) {
|
||||
if (b2cSB_ca[b] == c)
|
||||
b2cSB_ca[b] = UNMAPPABLE_DECODING;
|
||||
} else {
|
||||
if (b2c_ca[b >> 8][(b & 0xff) - b2Min] == c)
|
||||
b2c_ca[b >> 8][(b & 0xff) - b2Min] = UNMAPPABLE_DECODING;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (b2cSB_ca != null) { // SingleByte
|
||||
for (int b = 0; b < b2cSB_ca.length; b++) {
|
||||
char c = b2cSB_ca[b];
|
||||
if (c == UNMAPPABLE_DECODING)
|
||||
continue;
|
||||
int index = c2bIndex[c >> 8];
|
||||
if (index == 0) {
|
||||
index = off;
|
||||
off += 0x100;
|
||||
c2bIndex[c >> 8] = (char)index;
|
||||
}
|
||||
c2b[index + (c & 0xff)] = (char)b;
|
||||
}
|
||||
}
|
||||
|
||||
for (int b1 = 0; b1 < b2c.length; b1++) { // DoubleByte
|
||||
char[] db = b2c_ca[b1];
|
||||
if (db == null)
|
||||
continue;
|
||||
for (int b2 = b2Min; b2 <= b2Max; b2++) {
|
||||
char c = db[b2 - b2Min];
|
||||
if (c == UNMAPPABLE_DECODING)
|
||||
continue;
|
||||
int index = c2bIndex[c >> 8];
|
||||
if (index == 0) {
|
||||
index = off;
|
||||
off += 0x100;
|
||||
c2bIndex[c >> 8] = (char)index;
|
||||
}
|
||||
c2b[index + (c & 0xff)] = (char)((b1 << 8) | b2);
|
||||
}
|
||||
}
|
||||
|
||||
if (c2bNR != null) {
|
||||
// add c->b only nr entries
|
||||
for (int i = 0; i < c2bNR.length(); i += 2) {
|
||||
char b = c2bNR.charAt(i);
|
||||
char c = c2bNR.charAt(i + 1);
|
||||
int index = (c >> 8);
|
||||
if (c2bIndex[index] == 0) {
|
||||
c2bIndex[index] = (char)off;
|
||||
off += 0x100;
|
||||
}
|
||||
index = c2bIndex[index] + (c & 0xff);
|
||||
c2b[index] = b;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static class Encoder_DBCSONLY extends Encoder {
|
||||
Encoder_DBCSONLY(Charset cs, byte[] repl,
|
||||
char[] c2b, char[] c2bIndex) {
|
||||
super(cs, 2.0f, 2.0f, repl, c2b, c2bIndex);
|
||||
}
|
||||
|
||||
public int encodeChar(char ch) {
|
||||
int bb = super.encodeChar(ch);
|
||||
if (bb <= MAX_SINGLEBYTE)
|
||||
return UNMAPPABLE_ENCODING;
|
||||
return bb;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
public static class Encoder_EBCDIC extends Encoder {
|
||||
static final int SBCS = 0;
|
||||
static final int DBCS = 1;
|
||||
static final byte SO = 0x0e;
|
||||
static final byte SI = 0x0f;
|
||||
|
||||
protected int currentState = SBCS;
|
||||
|
||||
Encoder_EBCDIC(Charset cs, char[] c2b, char[] c2bIndex) {
|
||||
super(cs, 4.0f, 5.0f, new byte[] {(byte)0x6f}, c2b, c2bIndex);
|
||||
}
|
||||
|
||||
protected void implReset() {
|
||||
currentState = SBCS;
|
||||
}
|
||||
|
||||
protected CoderResult implFlush(ByteBuffer out) {
|
||||
if (currentState == DBCS) {
|
||||
if (out.remaining() < 1)
|
||||
return CoderResult.OVERFLOW;
|
||||
out.put(SI);
|
||||
}
|
||||
implReset();
|
||||
return CoderResult.UNDERFLOW;
|
||||
}
|
||||
|
||||
protected CoderResult encodeArrayLoop(CharBuffer src, ByteBuffer dst) {
|
||||
char[] sa = src.array();
|
||||
int sp = src.arrayOffset() + src.position();
|
||||
int sl = src.arrayOffset() + src.limit();
|
||||
byte[] da = dst.array();
|
||||
int dp = dst.arrayOffset() + dst.position();
|
||||
int dl = dst.arrayOffset() + dst.limit();
|
||||
|
||||
try {
|
||||
while (sp < sl) {
|
||||
char c = sa[sp];
|
||||
int bb = encodeChar(c);
|
||||
if (bb == UNMAPPABLE_ENCODING) {
|
||||
if (Character.isSurrogate(c)) {
|
||||
if (sgp().parse(c, sa, sp, sl) < 0)
|
||||
return sgp.error();
|
||||
return sgp.unmappableResult();
|
||||
}
|
||||
return CoderResult.unmappableForLength(1);
|
||||
}
|
||||
if (bb > MAX_SINGLEBYTE) { // DoubleByte
|
||||
if (currentState == SBCS) {
|
||||
if (dl - dp < 1)
|
||||
return CoderResult.OVERFLOW;
|
||||
currentState = DBCS;
|
||||
da[dp++] = SO;
|
||||
}
|
||||
if (dl - dp < 2)
|
||||
return CoderResult.OVERFLOW;
|
||||
da[dp++] = (byte)(bb >> 8);
|
||||
da[dp++] = (byte)bb;
|
||||
} else { // SingleByte
|
||||
if (currentState == DBCS) {
|
||||
if (dl - dp < 1)
|
||||
return CoderResult.OVERFLOW;
|
||||
currentState = SBCS;
|
||||
da[dp++] = SI;
|
||||
}
|
||||
if (dl - dp < 1)
|
||||
return CoderResult.OVERFLOW;
|
||||
da[dp++] = (byte)bb;
|
||||
|
||||
}
|
||||
sp++;
|
||||
}
|
||||
return CoderResult.UNDERFLOW;
|
||||
} finally {
|
||||
src.position(sp - src.arrayOffset());
|
||||
dst.position(dp - dst.arrayOffset());
|
||||
}
|
||||
}
|
||||
|
||||
protected CoderResult encodeBufferLoop(CharBuffer src, ByteBuffer dst) {
|
||||
int mark = src.position();
|
||||
try {
|
||||
while (src.hasRemaining()) {
|
||||
char c = src.get();
|
||||
int bb = encodeChar(c);
|
||||
if (bb == UNMAPPABLE_ENCODING) {
|
||||
if (Character.isSurrogate(c)) {
|
||||
if (sgp().parse(c, src) < 0)
|
||||
return sgp.error();
|
||||
return sgp.unmappableResult();
|
||||
}
|
||||
return CoderResult.unmappableForLength(1);
|
||||
}
|
||||
if (bb > MAX_SINGLEBYTE) { // DoubleByte
|
||||
if (currentState == SBCS) {
|
||||
if (dst.remaining() < 1)
|
||||
return CoderResult.OVERFLOW;
|
||||
currentState = DBCS;
|
||||
dst.put(SO);
|
||||
}
|
||||
if (dst.remaining() < 2)
|
||||
return CoderResult.OVERFLOW;
|
||||
dst.put((byte)(bb >> 8));
|
||||
dst.put((byte)(bb));
|
||||
} else { // Single-byte
|
||||
if (currentState == DBCS) {
|
||||
if (dst.remaining() < 1)
|
||||
return CoderResult.OVERFLOW;
|
||||
currentState = SBCS;
|
||||
dst.put(SI);
|
||||
}
|
||||
if (dst.remaining() < 1)
|
||||
return CoderResult.OVERFLOW;
|
||||
dst.put((byte)bb);
|
||||
}
|
||||
mark++;
|
||||
}
|
||||
return CoderResult.UNDERFLOW;
|
||||
} finally {
|
||||
src.position(mark);
|
||||
}
|
||||
}
|
||||
|
||||
public int encode(char[] src, int sp, int len, byte[] dst) {
|
||||
int dp = 0;
|
||||
int sl = sp + len;
|
||||
while (sp < sl) {
|
||||
char c = src[sp++];
|
||||
int bb = encodeChar(c);
|
||||
|
||||
if (bb == UNMAPPABLE_ENCODING) {
|
||||
if (Character.isHighSurrogate(c) && sp < sl &&
|
||||
Character.isLowSurrogate(src[sp])) {
|
||||
sp++;
|
||||
}
|
||||
dst[dp++] = repl[0];
|
||||
if (repl.length > 1)
|
||||
dst[dp++] = repl[1];
|
||||
continue;
|
||||
} //else
|
||||
if (bb > MAX_SINGLEBYTE) { // DoubleByte
|
||||
if (currentState == SBCS) {
|
||||
currentState = DBCS;
|
||||
dst[dp++] = SO;
|
||||
}
|
||||
dst[dp++] = (byte)(bb >> 8);
|
||||
dst[dp++] = (byte)bb;
|
||||
} else { // SingleByte
|
||||
if (currentState == DBCS) {
|
||||
currentState = SBCS;
|
||||
dst[dp++] = SI;
|
||||
}
|
||||
dst[dp++] = (byte)bb;
|
||||
}
|
||||
}
|
||||
|
||||
if (currentState == DBCS) {
|
||||
currentState = SBCS;
|
||||
dst[dp++] = SI;
|
||||
}
|
||||
return dp;
|
||||
}
|
||||
}
|
||||
|
||||
// EUC_SIMPLE
|
||||
public static class Encoder_EUC_SIM extends Encoder {
|
||||
Encoder_EUC_SIM(Charset cs, char[] c2b, char[] c2bIndex) {
|
||||
super(cs, c2b, c2bIndex);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
241
jdkSrc/jdk8/sun/nio/cs/ext/DoubleByteEncoder.java
Normal file
241
jdkSrc/jdk8/sun/nio/cs/ext/DoubleByteEncoder.java
Normal file
@@ -0,0 +1,241 @@
|
||||
/*
|
||||
* Copyright (c) 2002, 2006, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
/*
|
||||
*/
|
||||
|
||||
package sun.nio.cs.ext;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
import java.nio.CharBuffer;
|
||||
import java.nio.charset.Charset;
|
||||
import java.nio.charset.CharsetEncoder;
|
||||
import java.nio.charset.CoderResult;
|
||||
import sun.nio.cs.Surrogate;
|
||||
|
||||
public abstract class DoubleByteEncoder
|
||||
extends CharsetEncoder
|
||||
{
|
||||
|
||||
private short index1[];
|
||||
private String index2[];
|
||||
|
||||
private final Surrogate.Parser sgp = new Surrogate.Parser();
|
||||
|
||||
protected DoubleByteEncoder(Charset cs,
|
||||
short[] index1, String[] index2)
|
||||
{
|
||||
super(cs, 2.0f, 2.0f);
|
||||
this.index1 = index1;
|
||||
this.index2 = index2;
|
||||
}
|
||||
|
||||
protected DoubleByteEncoder(Charset cs,
|
||||
short[] index1, String[] index2,
|
||||
float avg, float max)
|
||||
{
|
||||
super(cs, avg, max);
|
||||
this.index1 = index1;
|
||||
this.index2 = index2;
|
||||
}
|
||||
|
||||
protected DoubleByteEncoder(Charset cs,
|
||||
short[] index1, String[] index2, byte[] repl)
|
||||
{
|
||||
super(cs, 2.0f, 2.0f, repl);
|
||||
this.index1 = index1;
|
||||
this.index2 = index2;
|
||||
}
|
||||
|
||||
|
||||
protected DoubleByteEncoder(Charset cs,
|
||||
short[] index1, String[] index2,
|
||||
byte[] repl, float avg, float max)
|
||||
{
|
||||
super(cs, avg, max,repl);
|
||||
this.index1 = index1;
|
||||
this.index2 = index2;
|
||||
}
|
||||
|
||||
public boolean canEncode(char c) {
|
||||
return (encodeSingle(c) != -1 ||
|
||||
encodeDouble(c) != 0);
|
||||
}
|
||||
|
||||
private CoderResult encodeArrayLoop(CharBuffer src, ByteBuffer dst) {
|
||||
char[] sa = src.array();
|
||||
int sp = src.arrayOffset() + src.position();
|
||||
int sl = src.arrayOffset() + src.limit();
|
||||
byte[] da = dst.array();
|
||||
int dp = dst.arrayOffset() + dst.position();
|
||||
int dl = dst.arrayOffset() + dst.limit();
|
||||
|
||||
try {
|
||||
while (sp < sl) {
|
||||
char c = sa[sp];
|
||||
if (Character.isSurrogate(c)) {
|
||||
if (sgp.parse(c, sa, sp, sl) < 0)
|
||||
return sgp.error();
|
||||
if (sl - sp < 2)
|
||||
return CoderResult.UNDERFLOW;
|
||||
char c2 = sa[sp + 1];
|
||||
|
||||
byte[] outputBytes = new byte[2];
|
||||
outputBytes = encodeSurrogate(c, c2);
|
||||
|
||||
if (outputBytes == null) {
|
||||
return sgp.unmappableResult();
|
||||
}
|
||||
else {
|
||||
if (dl - dp < 2)
|
||||
return CoderResult.OVERFLOW;
|
||||
da[dp++] = outputBytes[0];
|
||||
da[dp++] = outputBytes[1];
|
||||
sp += 2;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if (c >= '\uFFFE')
|
||||
return CoderResult.unmappableForLength(1);
|
||||
|
||||
int b = encodeSingle(c);
|
||||
if (b != -1) { // Single Byte
|
||||
if (dl - dp < 1)
|
||||
return CoderResult.OVERFLOW;
|
||||
da[dp++] = (byte)b;
|
||||
sp++;
|
||||
continue;
|
||||
}
|
||||
|
||||
int ncode = encodeDouble(c);
|
||||
if (ncode != 0 && c != '\u0000' ) {
|
||||
if (dl - dp < 2)
|
||||
return CoderResult.OVERFLOW;
|
||||
da[dp++] = (byte) ((ncode & 0xff00) >> 8);
|
||||
da[dp++] = (byte) (ncode & 0xff);
|
||||
sp++;
|
||||
continue;
|
||||
}
|
||||
return CoderResult.unmappableForLength(1);
|
||||
}
|
||||
return CoderResult.UNDERFLOW;
|
||||
} finally {
|
||||
src.position(sp - src.arrayOffset());
|
||||
dst.position(dp - dst.arrayOffset());
|
||||
}
|
||||
}
|
||||
|
||||
private CoderResult encodeBufferLoop(CharBuffer src, ByteBuffer dst) {
|
||||
int mark = src.position();
|
||||
|
||||
try {
|
||||
while (src.hasRemaining()) {
|
||||
char c = src.get();
|
||||
if (Character.isSurrogate(c)) {
|
||||
int surr;
|
||||
if ((surr = sgp.parse(c, src)) < 0)
|
||||
return sgp.error();
|
||||
char c2 = Surrogate.low(surr);
|
||||
byte[] outputBytes = new byte[2];
|
||||
outputBytes = encodeSurrogate(c, c2);
|
||||
|
||||
if (outputBytes == null) {
|
||||
return sgp.unmappableResult();
|
||||
} else {
|
||||
if (dst.remaining() < 2)
|
||||
return CoderResult.OVERFLOW;
|
||||
mark += 2;
|
||||
dst.put(outputBytes[0]);
|
||||
dst.put(outputBytes[1]);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if (c >= '\uFFFE')
|
||||
return CoderResult.unmappableForLength(1);
|
||||
int b = encodeSingle(c);
|
||||
|
||||
if (b != -1) { // Single-byte character
|
||||
if (dst.remaining() < 1)
|
||||
return CoderResult.OVERFLOW;
|
||||
mark++;
|
||||
dst.put((byte)b);
|
||||
continue;
|
||||
}
|
||||
// Double Byte character
|
||||
|
||||
int ncode = encodeDouble(c);
|
||||
if (ncode != 0 && c != '\u0000') {
|
||||
if (dst.remaining() < 2)
|
||||
return CoderResult.OVERFLOW;
|
||||
mark++;
|
||||
dst.put((byte) ((ncode & 0xff00) >> 8));
|
||||
dst.put((byte) ncode);
|
||||
continue;
|
||||
}
|
||||
return CoderResult.unmappableForLength(1);
|
||||
}
|
||||
|
||||
return CoderResult.UNDERFLOW;
|
||||
} finally {
|
||||
src.position(mark);
|
||||
}
|
||||
}
|
||||
|
||||
protected CoderResult encodeLoop(CharBuffer src, ByteBuffer dst) {
|
||||
if (true && src.hasArray() && dst.hasArray())
|
||||
return encodeArrayLoop(src, dst);
|
||||
else
|
||||
return encodeBufferLoop(src, dst);
|
||||
}
|
||||
|
||||
/*
|
||||
* Can be changed by subclass
|
||||
*/
|
||||
protected int encodeDouble(char ch) {
|
||||
int offset = index1[((ch & 0xff00) >> 8 )] << 8;
|
||||
return index2[offset >> 12].charAt((offset & 0xfff) + (ch & 0xff));
|
||||
}
|
||||
|
||||
/*
|
||||
* Can be changed by subclass
|
||||
*/
|
||||
protected int encodeSingle(char inputChar) {
|
||||
if (inputChar < 0x80)
|
||||
return (byte)inputChar;
|
||||
else
|
||||
return -1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Protected method which should be overridden by concrete DBCS
|
||||
* CharsetEncoder classes which included supplementary characters
|
||||
* within their mapping coverage.
|
||||
* null return value indicates surrogate values could not be
|
||||
* handled or encoded.
|
||||
*/
|
||||
protected byte[] encodeSurrogate(char highSurrogate, char lowSurrogate) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
1284
jdkSrc/jdk8/sun/nio/cs/ext/EUC_CN.java
Normal file
1284
jdkSrc/jdk8/sun/nio/cs/ext/EUC_CN.java
Normal file
File diff suppressed because it is too large
Load Diff
411
jdkSrc/jdk8/sun/nio/cs/ext/EUC_JP.java
Normal file
411
jdkSrc/jdk8/sun/nio/cs/ext/EUC_JP.java
Normal file
@@ -0,0 +1,411 @@
|
||||
/*
|
||||
* Copyright (c) 2002, 2012, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package sun.nio.cs.ext;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
import java.nio.CharBuffer;
|
||||
import java.nio.charset.Charset;
|
||||
import java.nio.charset.CharsetDecoder;
|
||||
import java.nio.charset.CharsetEncoder;
|
||||
import java.nio.charset.CoderResult;
|
||||
import sun.nio.cs.HistoricallyNamedCharset;
|
||||
import sun.nio.cs.Surrogate;
|
||||
import sun.nio.cs.SingleByte;
|
||||
import static sun.nio.cs.CharsetMapping.*;
|
||||
|
||||
public class EUC_JP
|
||||
extends Charset
|
||||
implements HistoricallyNamedCharset
|
||||
{
|
||||
public EUC_JP() {
|
||||
super("EUC-JP", ExtendedCharsets.aliasesFor("EUC-JP"));
|
||||
}
|
||||
|
||||
public String historicalName() {
|
||||
return "EUC_JP";
|
||||
}
|
||||
|
||||
public boolean contains(Charset cs) {
|
||||
return ((cs.name().equals("US-ASCII"))
|
||||
|| (cs instanceof JIS_X_0201)
|
||||
|| (cs instanceof JIS_X_0208)
|
||||
|| (cs instanceof JIS_X_0212)
|
||||
|| (cs instanceof EUC_JP));
|
||||
}
|
||||
|
||||
public CharsetDecoder newDecoder() {
|
||||
return new Decoder(this);
|
||||
}
|
||||
|
||||
public CharsetEncoder newEncoder() {
|
||||
return new Encoder(this);
|
||||
}
|
||||
|
||||
static class Decoder extends CharsetDecoder
|
||||
implements DelegatableDecoder {
|
||||
|
||||
final static SingleByte.Decoder DEC0201 =
|
||||
(SingleByte.Decoder)new JIS_X_0201().newDecoder();
|
||||
|
||||
final static DoubleByte.Decoder DEC0208 =
|
||||
(DoubleByte.Decoder)new JIS_X_0208().newDecoder();
|
||||
|
||||
final static DoubleByte.Decoder DEC0212 =
|
||||
(DoubleByte.Decoder)new JIS_X_0212().newDecoder();
|
||||
|
||||
private final SingleByte.Decoder dec0201;
|
||||
private final DoubleByte.Decoder dec0208;
|
||||
private final DoubleByte.Decoder dec0212;
|
||||
|
||||
protected Decoder(Charset cs) {
|
||||
this(cs, 0.5f, 1.0f, DEC0201, DEC0208, DEC0212);
|
||||
}
|
||||
|
||||
protected Decoder(Charset cs, float avgCpb, float maxCpb,
|
||||
SingleByte.Decoder dec0201,
|
||||
DoubleByte.Decoder dec0208,
|
||||
DoubleByte.Decoder dec0212) {
|
||||
super(cs, avgCpb, maxCpb);
|
||||
this.dec0201 = dec0201;
|
||||
this.dec0208 = dec0208;
|
||||
this.dec0212 = dec0212;
|
||||
}
|
||||
|
||||
|
||||
protected char decodeDouble(int byte1, int byte2) {
|
||||
if (byte1 == 0x8e) {
|
||||
if (byte2 < 0x80)
|
||||
return UNMAPPABLE_DECODING;
|
||||
return dec0201.decode((byte)byte2);
|
||||
}
|
||||
return dec0208.decodeDouble(byte1 - 0x80, byte2 - 0x80);
|
||||
}
|
||||
|
||||
private CoderResult decodeArrayLoop(ByteBuffer src,
|
||||
CharBuffer dst)
|
||||
{
|
||||
byte[] sa = src.array();
|
||||
int sp = src.arrayOffset() + src.position();
|
||||
int sl = src.arrayOffset() + src.limit();
|
||||
assert (sp <= sl);
|
||||
sp = (sp <= sl ? sp : sl);
|
||||
|
||||
char[] da = dst.array();
|
||||
int dp = dst.arrayOffset() + dst.position();
|
||||
int dl = dst.arrayOffset() + dst.limit();
|
||||
assert (dp <= dl);
|
||||
dp = (dp <= dl ? dp : dl);
|
||||
|
||||
int b1 = 0, b2 = 0;
|
||||
int inputSize = 0;
|
||||
char outputChar = UNMAPPABLE_DECODING;
|
||||
try {
|
||||
while (sp < sl) {
|
||||
b1 = sa[sp] & 0xff;
|
||||
inputSize = 1;
|
||||
|
||||
if ((b1 & 0x80) == 0) {
|
||||
outputChar = (char)b1;
|
||||
} else { // Multibyte char
|
||||
if (b1 == 0x8f) { // JIS0212
|
||||
if (sp + 3 > sl)
|
||||
return CoderResult.UNDERFLOW;
|
||||
b1 = sa[sp + 1] & 0xff;
|
||||
b2 = sa[sp + 2] & 0xff;
|
||||
inputSize += 2;
|
||||
if (dec0212 == null) // JIS02012 not supported
|
||||
return CoderResult.unmappableForLength(inputSize);
|
||||
outputChar = dec0212.decodeDouble(b1-0x80, b2-0x80);
|
||||
} else { // JIS0201, JIS0208
|
||||
if (sp + 2 > sl)
|
||||
return CoderResult.UNDERFLOW;
|
||||
b2 = sa[sp + 1] & 0xff;
|
||||
inputSize++;
|
||||
outputChar = decodeDouble(b1, b2);
|
||||
}
|
||||
}
|
||||
if (outputChar == UNMAPPABLE_DECODING) { // can't be decoded
|
||||
return CoderResult.unmappableForLength(inputSize);
|
||||
}
|
||||
if (dp + 1 > dl)
|
||||
return CoderResult.OVERFLOW;
|
||||
da[dp++] = outputChar;
|
||||
sp += inputSize;
|
||||
}
|
||||
return CoderResult.UNDERFLOW;
|
||||
} finally {
|
||||
src.position(sp - src.arrayOffset());
|
||||
dst.position(dp - dst.arrayOffset());
|
||||
}
|
||||
}
|
||||
|
||||
private CoderResult decodeBufferLoop(ByteBuffer src,
|
||||
CharBuffer dst)
|
||||
{
|
||||
int mark = src.position();
|
||||
int b1 = 0, b2 = 0;
|
||||
int inputSize = 0;
|
||||
char outputChar = UNMAPPABLE_DECODING;
|
||||
|
||||
try {
|
||||
while (src.hasRemaining()) {
|
||||
b1 = src.get() & 0xff;
|
||||
inputSize = 1;
|
||||
if ((b1 & 0x80) == 0) {
|
||||
outputChar = (char)b1;
|
||||
} else { // Multibyte char
|
||||
if (b1 == 0x8f) { // JIS0212
|
||||
if (src.remaining() < 2)
|
||||
return CoderResult.UNDERFLOW;
|
||||
b1 = src.get() & 0xff;
|
||||
b2 = src.get() & 0xff;
|
||||
inputSize += 2;
|
||||
if (dec0212 == null) // JIS02012 not supported
|
||||
return CoderResult.unmappableForLength(inputSize);
|
||||
outputChar = dec0212.decodeDouble(b1-0x80, b2-0x80);
|
||||
} else { // JIS0201 JIS0208
|
||||
if (src.remaining() < 1)
|
||||
return CoderResult.UNDERFLOW;
|
||||
b2 = src.get() & 0xff;
|
||||
inputSize++;
|
||||
outputChar = decodeDouble(b1, b2);
|
||||
}
|
||||
}
|
||||
if (outputChar == UNMAPPABLE_DECODING) {
|
||||
return CoderResult.unmappableForLength(inputSize);
|
||||
}
|
||||
if (dst.remaining() < 1)
|
||||
return CoderResult.OVERFLOW;
|
||||
dst.put(outputChar);
|
||||
mark += inputSize;
|
||||
}
|
||||
return CoderResult.UNDERFLOW;
|
||||
} finally {
|
||||
src.position(mark);
|
||||
}
|
||||
}
|
||||
|
||||
// Make some protected methods public for use by JISAutoDetect
|
||||
public CoderResult decodeLoop(ByteBuffer src, CharBuffer dst) {
|
||||
if (src.hasArray() && dst.hasArray())
|
||||
return decodeArrayLoop(src, dst);
|
||||
else
|
||||
return decodeBufferLoop(src, dst);
|
||||
}
|
||||
public void implReset() {
|
||||
super.implReset();
|
||||
}
|
||||
public CoderResult implFlush(CharBuffer out) {
|
||||
return super.implFlush(out);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static class Encoder extends CharsetEncoder {
|
||||
|
||||
final static SingleByte.Encoder ENC0201 =
|
||||
(SingleByte.Encoder)new JIS_X_0201().newEncoder();
|
||||
|
||||
final static DoubleByte.Encoder ENC0208 =
|
||||
(DoubleByte.Encoder)new JIS_X_0208().newEncoder();
|
||||
|
||||
final static DoubleByte.Encoder ENC0212 =
|
||||
(DoubleByte.Encoder)new JIS_X_0212().newEncoder();
|
||||
|
||||
private final Surrogate.Parser sgp = new Surrogate.Parser();
|
||||
|
||||
|
||||
private final SingleByte.Encoder enc0201;
|
||||
private final DoubleByte.Encoder enc0208;
|
||||
private final DoubleByte.Encoder enc0212;
|
||||
|
||||
protected Encoder(Charset cs) {
|
||||
this(cs, 3.0f, 3.0f, ENC0201, ENC0208, ENC0212);
|
||||
}
|
||||
|
||||
protected Encoder(Charset cs, float avgBpc, float maxBpc,
|
||||
SingleByte.Encoder enc0201,
|
||||
DoubleByte.Encoder enc0208,
|
||||
DoubleByte.Encoder enc0212) {
|
||||
super(cs, avgBpc, maxBpc);
|
||||
this.enc0201 = enc0201;
|
||||
this.enc0208 = enc0208;
|
||||
this.enc0212 = enc0212;
|
||||
}
|
||||
|
||||
public boolean canEncode(char c) {
|
||||
byte[] encodedBytes = new byte[3];
|
||||
return encodeSingle(c, encodedBytes) != 0 ||
|
||||
encodeDouble(c) != UNMAPPABLE_ENCODING;
|
||||
}
|
||||
|
||||
protected int encodeSingle(char inputChar, byte[] outputByte) {
|
||||
int b = enc0201.encode(inputChar);
|
||||
if (b == UNMAPPABLE_ENCODING)
|
||||
return 0;
|
||||
if (b >= 0 && b < 128) {
|
||||
outputByte[0] = (byte)b;
|
||||
return 1;
|
||||
}
|
||||
outputByte[0] = (byte)0x8e;
|
||||
outputByte[1] = (byte)b;
|
||||
return 2;
|
||||
}
|
||||
|
||||
protected int encodeDouble(char ch) {
|
||||
int b = enc0208.encodeChar(ch);
|
||||
if (b != UNMAPPABLE_ENCODING)
|
||||
return b + 0x8080;
|
||||
if (enc0212 != null) {
|
||||
b = enc0212.encodeChar(ch);
|
||||
if (b != UNMAPPABLE_ENCODING)
|
||||
b += 0x8F8080;
|
||||
}
|
||||
return b;
|
||||
}
|
||||
|
||||
private CoderResult encodeArrayLoop(CharBuffer src,
|
||||
ByteBuffer dst)
|
||||
{
|
||||
char[] sa = src.array();
|
||||
int sp = src.arrayOffset() + src.position();
|
||||
int sl = src.arrayOffset() + src.limit();
|
||||
assert (sp <= sl);
|
||||
sp = (sp <= sl ? sp : sl);
|
||||
byte[] da = dst.array();
|
||||
int dp = dst.arrayOffset() + dst.position();
|
||||
int dl = dst.arrayOffset() + dst.limit();
|
||||
assert (dp <= dl);
|
||||
dp = (dp <= dl ? dp : dl);
|
||||
|
||||
int outputSize = 0;
|
||||
byte[] outputByte;
|
||||
int inputSize = 0; // Size of input
|
||||
byte[] tmpBuf = new byte[3];
|
||||
|
||||
try {
|
||||
while (sp < sl) {
|
||||
outputByte = tmpBuf;
|
||||
char c = sa[sp];
|
||||
if (Character.isSurrogate(c)) {
|
||||
if (sgp.parse(c, sa, sp, sl) < 0)
|
||||
return sgp.error();
|
||||
return sgp.unmappableResult();
|
||||
}
|
||||
outputSize = encodeSingle(c, outputByte);
|
||||
if (outputSize == 0) { // DoubleByte
|
||||
int ncode = encodeDouble(c);
|
||||
if (ncode != UNMAPPABLE_ENCODING) {
|
||||
if ((ncode & 0xFF0000) == 0) {
|
||||
outputByte[0] = (byte) ((ncode & 0xff00) >> 8);
|
||||
outputByte[1] = (byte) (ncode & 0xff);
|
||||
outputSize = 2;
|
||||
} else {
|
||||
outputByte[0] = (byte) 0x8f;
|
||||
outputByte[1] = (byte) ((ncode & 0xff00) >> 8);
|
||||
outputByte[2] = (byte) (ncode & 0xff);
|
||||
outputSize = 3;
|
||||
}
|
||||
} else {
|
||||
return CoderResult.unmappableForLength(1);
|
||||
}
|
||||
}
|
||||
if (dl - dp < outputSize)
|
||||
return CoderResult.OVERFLOW;
|
||||
// Put the byte in the output buffer
|
||||
for (int i = 0; i < outputSize; i++) {
|
||||
da[dp++] = outputByte[i];
|
||||
}
|
||||
sp++;
|
||||
}
|
||||
return CoderResult.UNDERFLOW;
|
||||
} finally {
|
||||
src.position(sp - src.arrayOffset());
|
||||
dst.position(dp - dst.arrayOffset());
|
||||
}
|
||||
}
|
||||
|
||||
private CoderResult encodeBufferLoop(CharBuffer src,
|
||||
ByteBuffer dst)
|
||||
{
|
||||
int outputSize = 0;
|
||||
byte[] outputByte;
|
||||
int inputSize = 0; // Size of input
|
||||
byte[] tmpBuf = new byte[3];
|
||||
|
||||
int mark = src.position();
|
||||
|
||||
try {
|
||||
while (src.hasRemaining()) {
|
||||
outputByte = tmpBuf;
|
||||
char c = src.get();
|
||||
if (Character.isSurrogate(c)) {
|
||||
if (sgp.parse(c, src) < 0)
|
||||
return sgp.error();
|
||||
return sgp.unmappableResult();
|
||||
}
|
||||
outputSize = encodeSingle(c, outputByte);
|
||||
if (outputSize == 0) { // DoubleByte
|
||||
int ncode = encodeDouble(c);
|
||||
if (ncode != UNMAPPABLE_ENCODING) {
|
||||
if ((ncode & 0xFF0000) == 0) {
|
||||
outputByte[0] = (byte) ((ncode & 0xff00) >> 8);
|
||||
outputByte[1] = (byte) (ncode & 0xff);
|
||||
outputSize = 2;
|
||||
} else {
|
||||
outputByte[0] = (byte) 0x8f;
|
||||
outputByte[1] = (byte) ((ncode & 0xff00) >> 8);
|
||||
outputByte[2] = (byte) (ncode & 0xff);
|
||||
outputSize = 3;
|
||||
}
|
||||
} else {
|
||||
return CoderResult.unmappableForLength(1);
|
||||
}
|
||||
}
|
||||
if (dst.remaining() < outputSize)
|
||||
return CoderResult.OVERFLOW;
|
||||
// Put the byte in the output buffer
|
||||
for (int i = 0; i < outputSize; i++) {
|
||||
dst.put(outputByte[i]);
|
||||
}
|
||||
mark++;
|
||||
}
|
||||
return CoderResult.UNDERFLOW;
|
||||
} finally {
|
||||
src.position(mark);
|
||||
}
|
||||
}
|
||||
|
||||
protected CoderResult encodeLoop(CharBuffer src,
|
||||
ByteBuffer dst)
|
||||
{
|
||||
if (src.hasArray() && dst.hasArray())
|
||||
return encodeArrayLoop(src, dst);
|
||||
else
|
||||
return encodeBufferLoop(src, dst);
|
||||
}
|
||||
}
|
||||
}
|
||||
73
jdkSrc/jdk8/sun/nio/cs/ext/EUC_JP_LINUX.java
Normal file
73
jdkSrc/jdk8/sun/nio/cs/ext/EUC_JP_LINUX.java
Normal file
@@ -0,0 +1,73 @@
|
||||
/*
|
||||
* Copyright (c) 2002, 2012, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package sun.nio.cs.ext;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
import java.nio.CharBuffer;
|
||||
import java.nio.charset.Charset;
|
||||
import java.nio.charset.CharsetDecoder;
|
||||
import java.nio.charset.CharsetEncoder;
|
||||
import java.nio.charset.CoderResult;
|
||||
import sun.nio.cs.HistoricallyNamedCharset;
|
||||
|
||||
public class EUC_JP_LINUX
|
||||
extends Charset
|
||||
implements HistoricallyNamedCharset
|
||||
{
|
||||
public EUC_JP_LINUX() {
|
||||
super("x-euc-jp-linux", ExtendedCharsets.aliasesFor("x-euc-jp-linux"));
|
||||
}
|
||||
|
||||
public String historicalName() {
|
||||
return "EUC_JP_LINUX";
|
||||
}
|
||||
|
||||
public boolean contains(Charset cs) {
|
||||
return ((cs instanceof JIS_X_0201)
|
||||
|| (cs.name().equals("US-ASCII"))
|
||||
|| (cs instanceof EUC_JP_LINUX));
|
||||
}
|
||||
|
||||
public CharsetDecoder newDecoder() {
|
||||
return new Decoder(this);
|
||||
}
|
||||
|
||||
public CharsetEncoder newEncoder() {
|
||||
return new Encoder(this);
|
||||
}
|
||||
|
||||
private static class Decoder extends EUC_JP.Decoder {
|
||||
private Decoder(Charset cs) {
|
||||
super(cs, 1.0f, 1.0f, DEC0201, DEC0208, null);
|
||||
}
|
||||
}
|
||||
|
||||
private static class Encoder extends EUC_JP.Encoder {
|
||||
private Encoder(Charset cs) {
|
||||
super(cs, 2.0f, 2.0f, ENC0201, ENC0208, null);
|
||||
}
|
||||
}
|
||||
}
|
||||
111
jdkSrc/jdk8/sun/nio/cs/ext/EUC_JP_Open.java
Normal file
111
jdkSrc/jdk8/sun/nio/cs/ext/EUC_JP_Open.java
Normal file
@@ -0,0 +1,111 @@
|
||||
/*
|
||||
* Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package sun.nio.cs.ext;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
import java.nio.CharBuffer;
|
||||
import java.nio.charset.Charset;
|
||||
import java.nio.charset.CharsetDecoder;
|
||||
import java.nio.charset.CharsetEncoder;
|
||||
import java.nio.charset.CoderResult;
|
||||
import sun.nio.cs.HistoricallyNamedCharset;
|
||||
import static sun.nio.cs.CharsetMapping.*;
|
||||
|
||||
public class EUC_JP_Open
|
||||
extends Charset
|
||||
implements HistoricallyNamedCharset
|
||||
{
|
||||
public EUC_JP_Open() {
|
||||
super("x-eucJP-Open", ExtendedCharsets.aliasesFor("x-eucJP-Open"));
|
||||
}
|
||||
|
||||
public String historicalName() {
|
||||
return "EUC_JP_Solaris";
|
||||
}
|
||||
|
||||
public boolean contains(Charset cs) {
|
||||
return ((cs.name().equals("US-ASCII"))
|
||||
|| (cs instanceof JIS_X_0201)
|
||||
|| (cs instanceof EUC_JP));
|
||||
}
|
||||
|
||||
public CharsetDecoder newDecoder() {
|
||||
return new Decoder(this);
|
||||
}
|
||||
|
||||
public CharsetEncoder newEncoder() {
|
||||
return new Encoder(this);
|
||||
}
|
||||
|
||||
private static class Decoder extends EUC_JP.Decoder {
|
||||
private static DoubleByte.Decoder DEC0208_Solaris =
|
||||
(DoubleByte.Decoder)new JIS_X_0208_Solaris().newDecoder();
|
||||
private static DoubleByte.Decoder DEC0212_Solaris =
|
||||
(DoubleByte.Decoder)new JIS_X_0212_Solaris().newDecoder();
|
||||
|
||||
private Decoder(Charset cs) {
|
||||
// JIS_X_0208_Solaris only has the "extra" mappings, it
|
||||
// does not have the JIS_X_0208 entries
|
||||
super(cs, 0.5f, 1.0f, DEC0201, DEC0208, DEC0212_Solaris);
|
||||
}
|
||||
|
||||
protected char decodeDouble(int byte1, int byte2) {
|
||||
char c = super.decodeDouble(byte1, byte2);
|
||||
if (c == UNMAPPABLE_DECODING)
|
||||
return DEC0208_Solaris.decodeDouble(byte1 - 0x80, byte2 - 0x80);
|
||||
return c;
|
||||
}
|
||||
}
|
||||
|
||||
private static class Encoder extends EUC_JP.Encoder {
|
||||
private static DoubleByte.Encoder ENC0208_Solaris =
|
||||
(DoubleByte.Encoder)new JIS_X_0208_Solaris().newEncoder();
|
||||
|
||||
private static DoubleByte.Encoder ENC0212_Solaris =
|
||||
(DoubleByte.Encoder)new JIS_X_0212_Solaris().newEncoder();
|
||||
|
||||
private Encoder(Charset cs) {
|
||||
// The EUC_JP_Open has some interesting tweak for the
|
||||
// encoding, so can't just pass the euc0208_solaris to
|
||||
// the euc_jp. Have to override the encodeDouble() as
|
||||
// showed below (mapping testing catches this).
|
||||
// super(cs, 3.0f, 3.0f, ENC0201, ENC0208_Solaris, ENC0212_Solaris);
|
||||
super(cs);
|
||||
}
|
||||
|
||||
protected int encodeDouble(char ch) {
|
||||
int b = super.encodeDouble(ch);
|
||||
if (b != UNMAPPABLE_ENCODING)
|
||||
return b;
|
||||
b = ENC0208_Solaris.encodeChar(ch);
|
||||
if (b != UNMAPPABLE_ENCODING && b > 0x7500) {
|
||||
return 0x8F8080 + ENC0212_Solaris.encodeChar(ch);
|
||||
}
|
||||
return b == UNMAPPABLE_ENCODING ? b : b + 0x8080;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
1372
jdkSrc/jdk8/sun/nio/cs/ext/EUC_KR.java
Normal file
1372
jdkSrc/jdk8/sun/nio/cs/ext/EUC_KR.java
Normal file
File diff suppressed because it is too large
Load Diff
546
jdkSrc/jdk8/sun/nio/cs/ext/EUC_TW.java
Normal file
546
jdkSrc/jdk8/sun/nio/cs/ext/EUC_TW.java
Normal file
@@ -0,0 +1,546 @@
|
||||
/*
|
||||
* Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package sun.nio.cs.ext;
|
||||
|
||||
import java.io.*;
|
||||
import java.nio.CharBuffer;
|
||||
import java.nio.ByteBuffer;
|
||||
import java.nio.charset.Charset;
|
||||
import java.nio.charset.CharsetDecoder;
|
||||
import java.nio.charset.CharsetEncoder;
|
||||
import java.nio.charset.CoderResult;
|
||||
import java.util.Arrays;
|
||||
import sun.nio.cs.HistoricallyNamedCharset;
|
||||
import static sun.nio.cs.CharsetMapping.*;
|
||||
|
||||
public class EUC_TW extends Charset implements HistoricallyNamedCharset
|
||||
{
|
||||
private static final int SS2 = 0x8E;
|
||||
|
||||
/*
|
||||
(1) EUC_TW
|
||||
Second byte of EUC_TW for cs2 is in range of
|
||||
0xA1-0xB0 for plane 1-16. According to CJKV /163,
|
||||
plane1 is coded in both cs1 and cs2. This impl
|
||||
however does not decode the codepoints of plane1
|
||||
in cs2, so only p2-p7 and p15 are supported in cs2.
|
||||
|
||||
Plane2 0xA2;
|
||||
Plane3 0xA3;
|
||||
Plane4 0xA4;
|
||||
Plane5 0xA5;
|
||||
Plane6 0xA6;
|
||||
Plane7 0xA7;
|
||||
Plane15 0xAF;
|
||||
|
||||
(2) Mapping
|
||||
The fact that all supplementary characters encoded in EUC_TW are
|
||||
in 0x2xxxx range gives us the room to optimize the data tables.
|
||||
|
||||
Decoding:
|
||||
(1) save the lower 16-bit value of all codepoints of b->c mapping
|
||||
in a String array table String[plane] b2c.
|
||||
(2) save "codepoint is supplementary" info (one bit) in a
|
||||
byte[] b2cIsSupp, so 8 codepoints (same codepoint value, different
|
||||
plane No) share one byte.
|
||||
|
||||
Encoding:
|
||||
(1)c->b mappings are stored in
|
||||
char[]c2b/char[]c2bIndex
|
||||
char[]c2bSupp/char[]c2bIndexsupp (indexed by lower 16-bit
|
||||
(2)byte[] c2bPlane stores the "plane info" of each euc-tw codepoints,
|
||||
BMP and Supp share the low/high 4 bits of one byte.
|
||||
|
||||
Mapping tables are stored separated in EUC_TWMapping, which
|
||||
is generated by tool.
|
||||
*/
|
||||
|
||||
public EUC_TW() {
|
||||
super("x-EUC-TW", ExtendedCharsets.aliasesFor("x-EUC-TW"));
|
||||
}
|
||||
|
||||
public String historicalName() {
|
||||
return "EUC_TW";
|
||||
}
|
||||
|
||||
public boolean contains(Charset cs) {
|
||||
return ((cs.name().equals("US-ASCII"))
|
||||
|| (cs instanceof EUC_TW));
|
||||
}
|
||||
|
||||
public CharsetDecoder newDecoder() {
|
||||
return new Decoder(this);
|
||||
}
|
||||
|
||||
public CharsetEncoder newEncoder() {
|
||||
return new Encoder(this);
|
||||
}
|
||||
|
||||
public static class Decoder extends CharsetDecoder {
|
||||
public Decoder(Charset cs) {
|
||||
super(cs, 2.0f, 2.0f);
|
||||
}
|
||||
|
||||
char[] c1 = new char[1];
|
||||
char[] c2 = new char[2];
|
||||
public char[] toUnicode(int b1, int b2, int p) {
|
||||
return decode(b1, b2, p, c1, c2);
|
||||
}
|
||||
|
||||
static final String[] b2c = EUC_TWMapping.b2c;
|
||||
static final int b1Min = EUC_TWMapping.b1Min;
|
||||
static final int b1Max = EUC_TWMapping.b1Max;
|
||||
static final int b2Min = EUC_TWMapping.b2Min;
|
||||
static final int b2Max = EUC_TWMapping.b2Max;
|
||||
static final int dbSegSize = b2Max - b2Min + 1;
|
||||
static final byte[] b2cIsSupp;
|
||||
|
||||
// adjust from cns planeNo to the plane index of b2c
|
||||
static final byte[] cnspToIndex = new byte[0x100];
|
||||
static {
|
||||
Arrays.fill(cnspToIndex, (byte)-1);
|
||||
cnspToIndex[0xa2] = 1; cnspToIndex[0xa3] = 2; cnspToIndex[0xa4] = 3;
|
||||
cnspToIndex[0xa5] = 4; cnspToIndex[0xa6] = 5; cnspToIndex[0xa7] = 6;
|
||||
cnspToIndex[0xaf] = 7;
|
||||
}
|
||||
|
||||
//static final BitSet b2cIsSupp;
|
||||
static {
|
||||
String b2cIsSuppStr = EUC_TWMapping.b2cIsSuppStr;
|
||||
// work on a local copy is much faster than operate
|
||||
// directly on b2cIsSupp
|
||||
byte[] flag = new byte[b2cIsSuppStr.length() << 1];
|
||||
int off = 0;
|
||||
for (int i = 0; i < b2cIsSuppStr.length(); i++) {
|
||||
char c = b2cIsSuppStr.charAt(i);
|
||||
flag[off++] = (byte)(c >> 8);
|
||||
flag[off++] = (byte)(c & 0xff);
|
||||
}
|
||||
b2cIsSupp = flag;
|
||||
}
|
||||
|
||||
static boolean isLegalDB(int b) {
|
||||
return b >= b1Min && b <= b1Max;
|
||||
}
|
||||
|
||||
static char[] decode(int b1, int b2, int p, char[] c1, char[] c2)
|
||||
{
|
||||
if (b1 < b1Min || b1 > b1Max || b2 < b2Min || b2 > b2Max)
|
||||
return null;
|
||||
int index = (b1 - b1Min) * dbSegSize + b2 - b2Min;
|
||||
char c = b2c[p].charAt(index);
|
||||
if (c == UNMAPPABLE_DECODING)
|
||||
return null;
|
||||
if ((b2cIsSupp[index] & (1 << p)) == 0) {
|
||||
c1[0] = c;
|
||||
return c1;
|
||||
} else {
|
||||
c2[0] = Character.highSurrogate(0x20000 + c);
|
||||
c2[1] = Character.lowSurrogate(0x20000 + c);
|
||||
return c2;
|
||||
}
|
||||
}
|
||||
|
||||
private CoderResult decodeArrayLoop(ByteBuffer src,
|
||||
CharBuffer dst)
|
||||
{
|
||||
byte[] sa = src.array();
|
||||
int sp = src.arrayOffset() + src.position();
|
||||
int sl = src.arrayOffset() + src.limit();
|
||||
|
||||
char[] da = dst.array();
|
||||
int dp = dst.arrayOffset() + dst.position();
|
||||
int dl = dst.arrayOffset() + dst.limit();
|
||||
try {
|
||||
while (sp < sl) {
|
||||
int byte1 = sa[sp] & 0xff;
|
||||
if (byte1 == SS2) { // Codeset 2 G2
|
||||
if ( sl - sp < 4)
|
||||
return CoderResult.UNDERFLOW;
|
||||
int cnsPlane = cnspToIndex[sa[sp + 1] & 0xff];
|
||||
if (cnsPlane < 0)
|
||||
return CoderResult.malformedForLength(2);
|
||||
byte1 = sa[sp + 2] & 0xff;
|
||||
int byte2 = sa[sp + 3] & 0xff;
|
||||
char[] cc = toUnicode(byte1, byte2, cnsPlane);
|
||||
if (cc == null) {
|
||||
if (!isLegalDB(byte1) || !isLegalDB(byte2))
|
||||
return CoderResult.malformedForLength(4);
|
||||
return CoderResult.unmappableForLength(4);
|
||||
}
|
||||
if (dl - dp < cc.length)
|
||||
return CoderResult.OVERFLOW;
|
||||
if (cc.length == 1) {
|
||||
da[dp++] = cc[0];
|
||||
} else {
|
||||
da[dp++] = cc[0];
|
||||
da[dp++] = cc[1];
|
||||
}
|
||||
sp += 4;
|
||||
} else if (byte1 < 0x80) { // ASCII G0
|
||||
if (dl - dp < 1)
|
||||
return CoderResult.OVERFLOW;
|
||||
da[dp++] = (char) byte1;
|
||||
sp++;
|
||||
} else { // Codeset 1 G1
|
||||
if ( sl - sp < 2)
|
||||
return CoderResult.UNDERFLOW;
|
||||
int byte2 = sa[sp + 1] & 0xff;
|
||||
char[] cc = toUnicode(byte1, byte2, 0);
|
||||
if (cc == null) {
|
||||
if (!isLegalDB(byte1) || !isLegalDB(byte2))
|
||||
return CoderResult.malformedForLength(1);
|
||||
return CoderResult.unmappableForLength(2);
|
||||
}
|
||||
if (dl - dp < 1)
|
||||
return CoderResult.OVERFLOW;
|
||||
da[dp++] = cc[0];
|
||||
sp += 2;
|
||||
}
|
||||
}
|
||||
return CoderResult.UNDERFLOW;
|
||||
} finally {
|
||||
src.position(sp - src.arrayOffset());
|
||||
dst.position(dp - dst.arrayOffset());
|
||||
}
|
||||
}
|
||||
|
||||
private CoderResult decodeBufferLoop(ByteBuffer src,
|
||||
CharBuffer dst)
|
||||
{
|
||||
int mark = src.position();
|
||||
try {
|
||||
while (src.hasRemaining()) {
|
||||
int byte1 = src.get() & 0xff;
|
||||
if (byte1 == SS2) { // Codeset 2 G2
|
||||
if ( src.remaining() < 3)
|
||||
return CoderResult.UNDERFLOW;
|
||||
int cnsPlane = cnspToIndex[src.get() & 0xff];
|
||||
if (cnsPlane < 0)
|
||||
return CoderResult.malformedForLength(2);
|
||||
byte1 = src.get() & 0xff;
|
||||
int byte2 = src.get() & 0xff;
|
||||
char[] cc = toUnicode(byte1, byte2, cnsPlane);
|
||||
if (cc == null) {
|
||||
if (!isLegalDB(byte1) || !isLegalDB(byte2))
|
||||
return CoderResult.malformedForLength(4);
|
||||
return CoderResult.unmappableForLength(4);
|
||||
}
|
||||
if (dst.remaining() < cc.length)
|
||||
return CoderResult.OVERFLOW;
|
||||
if (cc.length == 1) {
|
||||
dst.put(cc[0]);
|
||||
} else {
|
||||
dst.put(cc[0]);
|
||||
dst.put(cc[1]);
|
||||
}
|
||||
mark += 4;
|
||||
} else if (byte1 < 0x80) { // ASCII G0
|
||||
if (!dst.hasRemaining())
|
||||
return CoderResult.OVERFLOW;
|
||||
dst.put((char) byte1);
|
||||
mark++;
|
||||
} else { // Codeset 1 G1
|
||||
if (!src.hasRemaining())
|
||||
return CoderResult.UNDERFLOW;
|
||||
int byte2 = src.get() & 0xff;
|
||||
char[] cc = toUnicode(byte1, byte2, 0);
|
||||
if (cc == null) {
|
||||
if (!isLegalDB(byte1) || !isLegalDB(byte2))
|
||||
return CoderResult.malformedForLength(1);
|
||||
return CoderResult.unmappableForLength(2);
|
||||
}
|
||||
if (!dst.hasRemaining())
|
||||
return CoderResult.OVERFLOW;
|
||||
dst.put(cc[0]);
|
||||
mark +=2;
|
||||
}
|
||||
}
|
||||
return CoderResult.UNDERFLOW;
|
||||
} finally {
|
||||
src.position(mark);
|
||||
}
|
||||
}
|
||||
|
||||
protected CoderResult decodeLoop(ByteBuffer src, CharBuffer dst)
|
||||
{
|
||||
if (src.hasArray() && dst.hasArray())
|
||||
return decodeArrayLoop(src, dst);
|
||||
else
|
||||
return decodeBufferLoop(src, dst);
|
||||
}
|
||||
}
|
||||
|
||||
public static class Encoder extends CharsetEncoder {
|
||||
private byte[] bb = new byte[4];
|
||||
|
||||
public Encoder(Charset cs) {
|
||||
super(cs, 4.0f, 4.0f);
|
||||
}
|
||||
|
||||
public boolean canEncode(char c) {
|
||||
return (c <= '\u007f' || toEUC(c, bb) != -1);
|
||||
}
|
||||
|
||||
public boolean canEncode(CharSequence cs) {
|
||||
int i = 0;
|
||||
while (i < cs.length()) {
|
||||
char c = cs.charAt(i++);
|
||||
if (Character.isHighSurrogate(c)) {
|
||||
if (i == cs.length())
|
||||
return false;
|
||||
char low = cs.charAt(i++);
|
||||
if (!Character.isLowSurrogate(low) || toEUC(c, low, bb) == -1)
|
||||
return false;
|
||||
} else if (!canEncode(c)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public int toEUC(char hi, char low, byte[] bb) {
|
||||
return encode(hi, low, bb);
|
||||
}
|
||||
|
||||
public int toEUC(char c, byte[] bb) {
|
||||
return encode(c, bb);
|
||||
}
|
||||
|
||||
private CoderResult encodeArrayLoop(CharBuffer src,
|
||||
ByteBuffer dst)
|
||||
{
|
||||
char[] sa = src.array();
|
||||
int sp = src.arrayOffset() + src.position();
|
||||
int sl = src.arrayOffset() + src.limit();
|
||||
|
||||
byte[] da = dst.array();
|
||||
int dp = dst.arrayOffset() + dst.position();
|
||||
int dl = dst.arrayOffset() + dst.limit();
|
||||
|
||||
int inSize;
|
||||
int outSize;
|
||||
|
||||
try {
|
||||
while (sp < sl) {
|
||||
char c = sa[sp];
|
||||
inSize = 1;
|
||||
if (c < 0x80) { // ASCII
|
||||
bb[0] = (byte)c;
|
||||
outSize = 1;
|
||||
} else {
|
||||
outSize = toEUC(c, bb);
|
||||
if (outSize == -1) {
|
||||
// to check surrogates only after BMP failed
|
||||
// has the benefit of improving the BMP encoding
|
||||
// 10% faster, with the price of the slowdown of
|
||||
// supplementary character encoding. given the use
|
||||
// of supplementary characters is really rare, this
|
||||
// is something worth doing.
|
||||
if (Character.isHighSurrogate(c)) {
|
||||
if ((sp + 1) == sl)
|
||||
return CoderResult.UNDERFLOW;
|
||||
if (!Character.isLowSurrogate(sa[sp + 1]))
|
||||
return CoderResult.malformedForLength(1);
|
||||
outSize = toEUC(c, sa[sp+1], bb);
|
||||
inSize = 2;
|
||||
} else if (Character.isLowSurrogate(c)) {
|
||||
return CoderResult.malformedForLength(1);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (outSize == -1)
|
||||
return CoderResult.unmappableForLength(inSize);
|
||||
if ( dl - dp < outSize)
|
||||
return CoderResult.OVERFLOW;
|
||||
for (int i = 0; i < outSize; i++)
|
||||
da[dp++] = bb[i];
|
||||
sp += inSize;
|
||||
}
|
||||
return CoderResult.UNDERFLOW;
|
||||
} finally {
|
||||
src.position(sp - src.arrayOffset());
|
||||
dst.position(dp - dst.arrayOffset());
|
||||
}
|
||||
}
|
||||
|
||||
private CoderResult encodeBufferLoop(CharBuffer src,
|
||||
ByteBuffer dst)
|
||||
{
|
||||
int outSize;
|
||||
int inSize;
|
||||
int mark = src.position();
|
||||
|
||||
try {
|
||||
while (src.hasRemaining()) {
|
||||
inSize = 1;
|
||||
char c = src.get();
|
||||
if (c < 0x80) { // ASCII
|
||||
outSize = 1;
|
||||
bb[0] = (byte)c;
|
||||
} else {
|
||||
outSize = toEUC(c, bb);
|
||||
if (outSize == -1) {
|
||||
if (Character.isHighSurrogate(c)) {
|
||||
if (!src.hasRemaining())
|
||||
return CoderResult.UNDERFLOW;
|
||||
char c2 = src.get();
|
||||
if (!Character.isLowSurrogate(c2))
|
||||
return CoderResult.malformedForLength(1);
|
||||
outSize = toEUC(c, c2, bb);
|
||||
inSize = 2;
|
||||
} else if (Character.isLowSurrogate(c)) {
|
||||
return CoderResult.malformedForLength(1);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (outSize == -1)
|
||||
return CoderResult.unmappableForLength(inSize);
|
||||
if (dst.remaining() < outSize)
|
||||
return CoderResult.OVERFLOW;
|
||||
for (int i = 0; i < outSize; i++)
|
||||
dst.put(bb[i]);
|
||||
mark += inSize;
|
||||
}
|
||||
return CoderResult.UNDERFLOW;
|
||||
} finally {
|
||||
src.position(mark);
|
||||
}
|
||||
}
|
||||
|
||||
protected CoderResult encodeLoop(CharBuffer src, ByteBuffer dst)
|
||||
{
|
||||
if (src.hasArray() && dst.hasArray())
|
||||
return encodeArrayLoop(src, dst);
|
||||
else
|
||||
return encodeBufferLoop(src, dst);
|
||||
}
|
||||
|
||||
static int encode(char hi, char low, byte[] bb) {
|
||||
int c = Character.toCodePoint(hi, low);
|
||||
if ((c & 0xf0000) != 0x20000)
|
||||
return -1;
|
||||
c -= 0x20000;
|
||||
int index = c2bSuppIndex[c >> 8];
|
||||
if (index == UNMAPPABLE_ENCODING)
|
||||
return -1;
|
||||
index = index + (c & 0xff);
|
||||
int db = c2bSupp[index];
|
||||
if (db == UNMAPPABLE_ENCODING)
|
||||
return -1;
|
||||
int p = (c2bPlane[index] >> 4) & 0xf;
|
||||
bb[0] = (byte)SS2;
|
||||
bb[1] = (byte)(0xa0 | p);
|
||||
bb[2] = (byte)(db >> 8);
|
||||
bb[3] = (byte)db;
|
||||
return 4;
|
||||
}
|
||||
|
||||
static int encode(char c, byte[] bb) {
|
||||
int index = c2bIndex[c >> 8];
|
||||
if (index == UNMAPPABLE_ENCODING)
|
||||
return -1;
|
||||
index = index + (c & 0xff);
|
||||
int db = c2b[index];
|
||||
if (db == UNMAPPABLE_ENCODING)
|
||||
return -1;
|
||||
int p = c2bPlane[index] & 0xf;
|
||||
if (p == 0) {
|
||||
bb[0] = (byte)(db >> 8);
|
||||
bb[1] = (byte)db;
|
||||
return 2;
|
||||
} else {
|
||||
bb[0] = (byte)SS2;
|
||||
bb[1] = (byte)(0xa0 | p);
|
||||
bb[2] = (byte)(db >> 8);
|
||||
bb[3] = (byte)db;
|
||||
return 4;
|
||||
}
|
||||
}
|
||||
|
||||
static final char[] c2b;
|
||||
static final char[] c2bIndex;
|
||||
static final char[] c2bSupp;
|
||||
static final char[] c2bSuppIndex;
|
||||
static final byte[] c2bPlane;
|
||||
static {
|
||||
int b1Min = Decoder.b1Min;
|
||||
int b1Max = Decoder.b1Max;
|
||||
int b2Min = Decoder.b2Min;
|
||||
int b2Max = Decoder.b2Max;
|
||||
int dbSegSize = Decoder.dbSegSize;
|
||||
String[] b2c = Decoder.b2c;
|
||||
byte[] b2cIsSupp = Decoder.b2cIsSupp;
|
||||
|
||||
c2bIndex = EUC_TWMapping.c2bIndex;
|
||||
c2bSuppIndex = EUC_TWMapping.c2bSuppIndex;
|
||||
char[] c2b0 = new char[EUC_TWMapping.C2BSIZE];
|
||||
char[] c2bSupp0 = new char[EUC_TWMapping.C2BSUPPSIZE];
|
||||
byte[] c2bPlane0 = new byte[Math.max(EUC_TWMapping.C2BSIZE,
|
||||
EUC_TWMapping.C2BSUPPSIZE)];
|
||||
|
||||
Arrays.fill(c2b0, (char)UNMAPPABLE_ENCODING);
|
||||
Arrays.fill(c2bSupp0, (char)UNMAPPABLE_ENCODING);
|
||||
|
||||
for (int p = 0; p < b2c.length; p++) {
|
||||
String db = b2c[p];
|
||||
/*
|
||||
adjust the "plane" from 0..7 to 0, 2, 3, 4, 5, 6, 7, 0xf,
|
||||
which helps balance between footprint (to save the plane
|
||||
info in 4 bits) and runtime performance (to require only
|
||||
one operation "0xa0 | plane" to encode the plane byte)
|
||||
*/
|
||||
int plane = p;
|
||||
if (plane == 7)
|
||||
plane = 0xf;
|
||||
else if (plane != 0)
|
||||
plane = p + 1;
|
||||
|
||||
int off = 0;
|
||||
for (int b1 = b1Min; b1 <= b1Max; b1++) {
|
||||
for (int b2 = b2Min; b2 <= b2Max; b2++) {
|
||||
char c = db.charAt(off);
|
||||
if (c != UNMAPPABLE_DECODING) {
|
||||
if ((b2cIsSupp[off] & (1 << p)) != 0) {
|
||||
int index = c2bSuppIndex[c >> 8] + (c&0xff);
|
||||
c2bSupp0[index] = (char)((b1 << 8) + b2);
|
||||
c2bPlane0[index] |= (byte)(plane << 4);
|
||||
} else {
|
||||
int index = c2bIndex[c >> 8] + (c&0xff);
|
||||
c2b0[index] = (char)((b1 << 8) + b2);
|
||||
c2bPlane0[index] |= (byte)plane;
|
||||
}
|
||||
}
|
||||
off++;
|
||||
}
|
||||
}
|
||||
}
|
||||
c2b = c2b0;
|
||||
c2bSupp = c2bSupp0;
|
||||
c2bPlane = c2bPlane0;
|
||||
}
|
||||
}
|
||||
}
|
||||
10075
jdkSrc/jdk8/sun/nio/cs/ext/EUC_TWMapping.java
Normal file
10075
jdkSrc/jdk8/sun/nio/cs/ext/EUC_TWMapping.java
Normal file
File diff suppressed because it is too large
Load Diff
1353
jdkSrc/jdk8/sun/nio/cs/ext/ExtendedCharsets.java
Normal file
1353
jdkSrc/jdk8/sun/nio/cs/ext/ExtendedCharsets.java
Normal file
File diff suppressed because it is too large
Load Diff
12858
jdkSrc/jdk8/sun/nio/cs/ext/GB18030.java
Normal file
12858
jdkSrc/jdk8/sun/nio/cs/ext/GB18030.java
Normal file
File diff suppressed because it is too large
Load Diff
3291
jdkSrc/jdk8/sun/nio/cs/ext/GBK.java
Normal file
3291
jdkSrc/jdk8/sun/nio/cs/ext/GBK.java
Normal file
File diff suppressed because it is too large
Load Diff
432
jdkSrc/jdk8/sun/nio/cs/ext/HKSCS.java
Normal file
432
jdkSrc/jdk8/sun/nio/cs/ext/HKSCS.java
Normal file
@@ -0,0 +1,432 @@
|
||||
/*
|
||||
* Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package sun.nio.cs.ext;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
import java.nio.CharBuffer;
|
||||
import java.nio.charset.Charset;
|
||||
import java.nio.charset.CharsetDecoder;
|
||||
import java.nio.charset.CharsetEncoder;
|
||||
import java.nio.charset.CoderResult;
|
||||
import java.util.Arrays;
|
||||
import sun.nio.cs.Surrogate;
|
||||
import static sun.nio.cs.CharsetMapping.*;
|
||||
|
||||
public class HKSCS {
|
||||
|
||||
public static class Decoder extends DoubleByte.Decoder {
|
||||
static int b2Min = 0x40;
|
||||
static int b2Max = 0xfe;
|
||||
|
||||
private char[][] b2cBmp;
|
||||
private char[][] b2cSupp;
|
||||
private DoubleByte.Decoder big5Dec;
|
||||
|
||||
protected Decoder(Charset cs,
|
||||
DoubleByte.Decoder big5Dec,
|
||||
char[][] b2cBmp, char[][] b2cSupp)
|
||||
{
|
||||
// super(cs, 0.5f, 1.0f);
|
||||
// need to extends DoubleByte.Decoder so the
|
||||
// sun.io can use it. this implementation
|
||||
super(cs, 0.5f, 1.0f, null, null, 0, 0);
|
||||
this.big5Dec = big5Dec;
|
||||
this.b2cBmp = b2cBmp;
|
||||
this.b2cSupp = b2cSupp;
|
||||
}
|
||||
|
||||
public char decodeSingle(int b) {
|
||||
return big5Dec.decodeSingle(b);
|
||||
}
|
||||
|
||||
public char decodeBig5(int b1, int b2) {
|
||||
return big5Dec.decodeDouble(b1, b2);
|
||||
}
|
||||
|
||||
public char decodeDouble(int b1, int b2) {
|
||||
return b2cBmp[b1][b2 - b2Min];
|
||||
}
|
||||
|
||||
public char decodeDoubleEx(int b1, int b2) {
|
||||
/* if the b2cSupp is null, the subclass need
|
||||
to override the methold
|
||||
if (b2cSupp == null)
|
||||
return UNMAPPABLE_DECODING;
|
||||
*/
|
||||
return b2cSupp[b1][b2 - b2Min];
|
||||
}
|
||||
|
||||
protected CoderResult decodeArrayLoop(ByteBuffer src, CharBuffer dst) {
|
||||
byte[] sa = src.array();
|
||||
int sp = src.arrayOffset() + src.position();
|
||||
int sl = src.arrayOffset() + src.limit();
|
||||
|
||||
char[] da = dst.array();
|
||||
int dp = dst.arrayOffset() + dst.position();
|
||||
int dl = dst.arrayOffset() + dst.limit();
|
||||
|
||||
try {
|
||||
while (sp < sl) {
|
||||
int b1 = sa[sp] & 0xff;
|
||||
char c = decodeSingle(b1);
|
||||
int inSize = 1, outSize = 1;
|
||||
char[] cc = null;
|
||||
if (c == UNMAPPABLE_DECODING) {
|
||||
if (sl - sp < 2)
|
||||
return CoderResult.UNDERFLOW;
|
||||
int b2 = sa[sp + 1] & 0xff;
|
||||
inSize++;
|
||||
if (b2 < b2Min || b2 > b2Max)
|
||||
return CoderResult.unmappableForLength(2);
|
||||
c = decodeDouble(b1, b2); //bmp
|
||||
if (c == UNMAPPABLE_DECODING) {
|
||||
c = decodeDoubleEx(b1, b2); //supp
|
||||
if (c == UNMAPPABLE_DECODING) {
|
||||
c = decodeBig5(b1, b2); //big5
|
||||
if (c == UNMAPPABLE_DECODING)
|
||||
return CoderResult.unmappableForLength(2);
|
||||
} else {
|
||||
// supplementary character in u+2xxxx area
|
||||
outSize = 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (dl - dp < outSize)
|
||||
return CoderResult.OVERFLOW;
|
||||
if (outSize == 2) {
|
||||
// supplementary characters
|
||||
da[dp++] = Surrogate.high(0x20000 + c);
|
||||
da[dp++] = Surrogate.low(0x20000 + c);
|
||||
} else {
|
||||
da[dp++] = c;
|
||||
}
|
||||
sp += inSize;
|
||||
}
|
||||
return CoderResult.UNDERFLOW;
|
||||
} finally {
|
||||
src.position(sp - src.arrayOffset());
|
||||
dst.position(dp - dst.arrayOffset());
|
||||
}
|
||||
}
|
||||
|
||||
protected CoderResult decodeBufferLoop(ByteBuffer src, CharBuffer dst) {
|
||||
int mark = src.position();
|
||||
try {
|
||||
while (src.hasRemaining()) {
|
||||
char[] cc = null;
|
||||
int b1 = src.get() & 0xff;
|
||||
int inSize = 1, outSize = 1;
|
||||
char c = decodeSingle(b1);
|
||||
if (c == UNMAPPABLE_DECODING) {
|
||||
if (src.remaining() < 1)
|
||||
return CoderResult.UNDERFLOW;
|
||||
int b2 = src.get() & 0xff;
|
||||
inSize++;
|
||||
if (b2 < b2Min || b2 > b2Max)
|
||||
return CoderResult.unmappableForLength(2);
|
||||
c = decodeDouble(b1, b2); //bmp
|
||||
if (c == UNMAPPABLE_DECODING) {
|
||||
c = decodeDoubleEx(b1, b2); //supp
|
||||
if (c == UNMAPPABLE_DECODING) {
|
||||
c = decodeBig5(b1, b2); //big5
|
||||
if (c == UNMAPPABLE_DECODING)
|
||||
return CoderResult.unmappableForLength(2);
|
||||
} else {
|
||||
outSize = 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (dst.remaining() < outSize)
|
||||
return CoderResult.OVERFLOW;
|
||||
if (outSize == 2) {
|
||||
dst.put(Surrogate.high(0x20000 + c));
|
||||
dst.put(Surrogate.low(0x20000 + c));
|
||||
} else {
|
||||
dst.put(c);
|
||||
}
|
||||
mark += inSize;
|
||||
}
|
||||
return CoderResult.UNDERFLOW;
|
||||
} finally {
|
||||
src.position(mark);
|
||||
}
|
||||
}
|
||||
|
||||
public int decode(byte[] src, int sp, int len, char[] dst) {
|
||||
int dp = 0;
|
||||
int sl = sp + len;
|
||||
char repl = replacement().charAt(0);
|
||||
while (sp < sl) {
|
||||
int b1 = src[sp++] & 0xff;
|
||||
char c = decodeSingle(b1);
|
||||
if (c == UNMAPPABLE_DECODING) {
|
||||
if (sl == sp) {
|
||||
c = repl;
|
||||
} else {
|
||||
int b2 = src[sp++] & 0xff;
|
||||
if (b2 < b2Min || b2 > b2Max) {
|
||||
c = repl;
|
||||
} else if ((c = decodeDouble(b1, b2)) == UNMAPPABLE_DECODING) {
|
||||
c = decodeDoubleEx(b1, b2); //supp
|
||||
if (c == UNMAPPABLE_DECODING) {
|
||||
c = decodeBig5(b1, b2); //big5
|
||||
if (c == UNMAPPABLE_DECODING)
|
||||
c = repl;
|
||||
} else {
|
||||
// supplementary character in u+2xxxx area
|
||||
dst[dp++] = Surrogate.high(0x20000 + c);
|
||||
dst[dp++] = Surrogate.low(0x20000 + c);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
dst[dp++] = c;
|
||||
}
|
||||
return dp;
|
||||
}
|
||||
|
||||
public CoderResult decodeLoop(ByteBuffer src, CharBuffer dst) {
|
||||
if (src.hasArray() && dst.hasArray())
|
||||
return decodeArrayLoop(src, dst);
|
||||
else
|
||||
return decodeBufferLoop(src, dst);
|
||||
}
|
||||
|
||||
static void initb2c(char[][]b2c, String[] b2cStr)
|
||||
{
|
||||
for (int i = 0; i < b2cStr.length; i++) {
|
||||
if (b2cStr[i] == null)
|
||||
b2c[i] = DoubleByte.B2C_UNMAPPABLE;
|
||||
else
|
||||
b2c[i] = b2cStr[i].toCharArray();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static class Encoder extends DoubleByte.Encoder {
|
||||
private DoubleByte.Encoder big5Enc;
|
||||
private char[][] c2bBmp;
|
||||
private char[][] c2bSupp;
|
||||
|
||||
protected Encoder(Charset cs,
|
||||
DoubleByte.Encoder big5Enc,
|
||||
char[][] c2bBmp,
|
||||
char[][] c2bSupp)
|
||||
{
|
||||
super(cs, null, null);
|
||||
this.big5Enc = big5Enc;
|
||||
this.c2bBmp = c2bBmp;
|
||||
this.c2bSupp = c2bSupp;
|
||||
}
|
||||
|
||||
public int encodeBig5(char ch) {
|
||||
return big5Enc.encodeChar(ch);
|
||||
}
|
||||
|
||||
public int encodeChar(char ch) {
|
||||
int bb = c2bBmp[ch >> 8][ch & 0xff];
|
||||
if (bb == UNMAPPABLE_ENCODING)
|
||||
return encodeBig5(ch);
|
||||
return bb;
|
||||
}
|
||||
|
||||
public int encodeSupp(int cp) {
|
||||
if ((cp & 0xf0000) != 0x20000)
|
||||
return UNMAPPABLE_ENCODING;
|
||||
return c2bSupp[(cp >> 8) & 0xff][cp & 0xff];
|
||||
}
|
||||
|
||||
public boolean canEncode(char c) {
|
||||
return encodeChar(c) != UNMAPPABLE_ENCODING;
|
||||
}
|
||||
|
||||
protected CoderResult encodeArrayLoop(CharBuffer src, ByteBuffer dst) {
|
||||
char[] sa = src.array();
|
||||
int sp = src.arrayOffset() + src.position();
|
||||
int sl = src.arrayOffset() + src.limit();
|
||||
|
||||
byte[] da = dst.array();
|
||||
int dp = dst.arrayOffset() + dst.position();
|
||||
int dl = dst.arrayOffset() + dst.limit();
|
||||
|
||||
try {
|
||||
while (sp < sl) {
|
||||
char c = sa[sp];
|
||||
int inSize = 1;
|
||||
int bb = encodeChar(c);
|
||||
if (bb == UNMAPPABLE_ENCODING) {
|
||||
if (Character.isSurrogate(c)) {
|
||||
int cp;
|
||||
if ((cp = sgp().parse(c, sa, sp, sl)) < 0)
|
||||
return sgp.error();
|
||||
bb = encodeSupp(cp);
|
||||
if (bb == UNMAPPABLE_ENCODING)
|
||||
return CoderResult.unmappableForLength(2);
|
||||
inSize = 2;
|
||||
} else {
|
||||
return CoderResult.unmappableForLength(1);
|
||||
}
|
||||
}
|
||||
if (bb > MAX_SINGLEBYTE) { // DoubleByte
|
||||
if (dl - dp < 2)
|
||||
return CoderResult.OVERFLOW;
|
||||
da[dp++] = (byte)(bb >> 8);
|
||||
da[dp++] = (byte)bb;
|
||||
} else { // SingleByte
|
||||
if (dl - dp < 1)
|
||||
return CoderResult.OVERFLOW;
|
||||
da[dp++] = (byte)bb;
|
||||
}
|
||||
sp += inSize;
|
||||
}
|
||||
return CoderResult.UNDERFLOW;
|
||||
} finally {
|
||||
src.position(sp - src.arrayOffset());
|
||||
dst.position(dp - dst.arrayOffset());
|
||||
}
|
||||
}
|
||||
|
||||
protected CoderResult encodeBufferLoop(CharBuffer src, ByteBuffer dst) {
|
||||
int mark = src.position();
|
||||
try {
|
||||
while (src.hasRemaining()) {
|
||||
int inSize = 1;
|
||||
char c = src.get();
|
||||
int bb = encodeChar(c);
|
||||
if (bb == UNMAPPABLE_ENCODING) {
|
||||
if (Character.isSurrogate(c)) {
|
||||
int cp;
|
||||
if ((cp = sgp().parse(c, src)) < 0)
|
||||
return sgp.error();
|
||||
bb = encodeSupp(cp);
|
||||
if (bb == UNMAPPABLE_ENCODING)
|
||||
return CoderResult.unmappableForLength(2);
|
||||
inSize = 2;
|
||||
} else {
|
||||
return CoderResult.unmappableForLength(1);
|
||||
}
|
||||
}
|
||||
if (bb > MAX_SINGLEBYTE) { // DoubleByte
|
||||
if (dst.remaining() < 2)
|
||||
return CoderResult.OVERFLOW;
|
||||
dst.put((byte)(bb >> 8));
|
||||
dst.put((byte)(bb));
|
||||
} else {
|
||||
if (dst.remaining() < 1)
|
||||
return CoderResult.OVERFLOW;
|
||||
dst.put((byte)bb);
|
||||
}
|
||||
mark += inSize;
|
||||
}
|
||||
return CoderResult.UNDERFLOW;
|
||||
} finally {
|
||||
src.position(mark);
|
||||
}
|
||||
}
|
||||
|
||||
protected CoderResult encodeLoop(CharBuffer src, ByteBuffer dst) {
|
||||
if (src.hasArray() && dst.hasArray())
|
||||
return encodeArrayLoop(src, dst);
|
||||
else
|
||||
return encodeBufferLoop(src, dst);
|
||||
}
|
||||
|
||||
private byte[] repl = replacement();
|
||||
protected void implReplaceWith(byte[] newReplacement) {
|
||||
repl = newReplacement;
|
||||
}
|
||||
|
||||
public int encode(char[] src, int sp, int len, byte[] dst) {
|
||||
int dp = 0;
|
||||
int sl = sp + len;
|
||||
while (sp < sl) {
|
||||
char c = src[sp++];
|
||||
int bb = encodeChar(c);
|
||||
if (bb == UNMAPPABLE_ENCODING) {
|
||||
if (!Character.isHighSurrogate(c) || sp == sl ||
|
||||
!Character.isLowSurrogate(src[sp]) ||
|
||||
(bb = encodeSupp(Character.toCodePoint(c, src[sp++])))
|
||||
== UNMAPPABLE_ENCODING) {
|
||||
dst[dp++] = repl[0];
|
||||
if (repl.length > 1)
|
||||
dst[dp++] = repl[1];
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if (bb > MAX_SINGLEBYTE) { // DoubleByte
|
||||
dst[dp++] = (byte)(bb >> 8);
|
||||
dst[dp++] = (byte)bb;
|
||||
} else { // SingleByte
|
||||
dst[dp++] = (byte)bb;
|
||||
}
|
||||
}
|
||||
return dp;
|
||||
}
|
||||
|
||||
|
||||
static char[] C2B_UNMAPPABLE = new char[0x100];
|
||||
static {
|
||||
Arrays.fill(C2B_UNMAPPABLE, (char)UNMAPPABLE_ENCODING);
|
||||
}
|
||||
|
||||
static void initc2b(char[][] c2b, String[] b2cStr, String pua) {
|
||||
// init c2b/c2bSupp from b2cStr and supp
|
||||
int b2Min = 0x40;
|
||||
Arrays.fill(c2b, C2B_UNMAPPABLE);
|
||||
for (int b1 = 0; b1 < 0x100; b1++) {
|
||||
String s = b2cStr[b1];
|
||||
if (s == null)
|
||||
continue;
|
||||
for (int i = 0; i < s.length(); i++) {
|
||||
char c = s.charAt(i);
|
||||
int hi = c >> 8;
|
||||
if (c2b[hi] == C2B_UNMAPPABLE) {
|
||||
c2b[hi] = new char[0x100];
|
||||
Arrays.fill(c2b[hi], (char)UNMAPPABLE_ENCODING);
|
||||
}
|
||||
c2b[hi][c & 0xff] = (char)((b1 << 8) | (i + b2Min));
|
||||
}
|
||||
}
|
||||
if (pua != null) { // add the compatibility pua entries
|
||||
char c = '\ue000'; //first pua character
|
||||
for (int i = 0; i < pua.length(); i++) {
|
||||
char bb = pua.charAt(i);
|
||||
if (bb != UNMAPPABLE_DECODING) {
|
||||
int hi = c >> 8;
|
||||
if (c2b[hi] == C2B_UNMAPPABLE) {
|
||||
c2b[hi] = new char[0x100];
|
||||
Arrays.fill(c2b[hi], (char)UNMAPPABLE_ENCODING);
|
||||
}
|
||||
c2b[hi][c & 0xff] = bb;
|
||||
}
|
||||
c++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
2855
jdkSrc/jdk8/sun/nio/cs/ext/HKSCS2001Mapping.java
Normal file
2855
jdkSrc/jdk8/sun/nio/cs/ext/HKSCS2001Mapping.java
Normal file
File diff suppressed because it is too large
Load Diff
2901
jdkSrc/jdk8/sun/nio/cs/ext/HKSCSMapping.java
Normal file
2901
jdkSrc/jdk8/sun/nio/cs/ext/HKSCSMapping.java
Normal file
File diff suppressed because it is too large
Load Diff
1054
jdkSrc/jdk8/sun/nio/cs/ext/HKSCS_XPMapping.java
Normal file
1054
jdkSrc/jdk8/sun/nio/cs/ext/HKSCS_XPMapping.java
Normal file
File diff suppressed because it is too large
Load Diff
110
jdkSrc/jdk8/sun/nio/cs/ext/IBM037.java
Normal file
110
jdkSrc/jdk8/sun/nio/cs/ext/IBM037.java
Normal file
@@ -0,0 +1,110 @@
|
||||
/*
|
||||
* Copyright (c) 2008, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package sun.nio.cs.ext;
|
||||
|
||||
import java.nio.charset.Charset;
|
||||
import java.nio.charset.CharsetDecoder;
|
||||
import java.nio.charset.CharsetEncoder;
|
||||
import sun.nio.cs.StandardCharsets;
|
||||
import sun.nio.cs.SingleByte;
|
||||
import sun.nio.cs.HistoricallyNamedCharset;
|
||||
import static sun.nio.cs.CharsetMapping.*;
|
||||
|
||||
public class IBM037 extends Charset implements HistoricallyNamedCharset
|
||||
{
|
||||
public IBM037() {
|
||||
super("IBM037", ExtendedCharsets.aliasesFor("IBM037"));
|
||||
}
|
||||
|
||||
public String historicalName() {
|
||||
return "Cp037";
|
||||
}
|
||||
|
||||
public boolean contains(Charset cs) {
|
||||
return (cs instanceof IBM037);
|
||||
}
|
||||
|
||||
public CharsetDecoder newDecoder() {
|
||||
return new SingleByte.Decoder(this, b2c);
|
||||
}
|
||||
|
||||
public CharsetEncoder newEncoder() {
|
||||
return new SingleByte.Encoder(this, c2b, c2bIndex);
|
||||
}
|
||||
|
||||
private final static String b2cTable =
|
||||
"\u00D8\u0061\u0062\u0063\u0064\u0065\u0066\u0067" + // 0x80 - 0x87
|
||||
"\u0068\u0069\u00AB\u00BB\u00F0\u00FD\u00FE\u00B1" + // 0x88 - 0x8f
|
||||
"\u00B0\u006A\u006B\u006C\u006D\u006E\u006F\u0070" + // 0x90 - 0x97
|
||||
"\u0071\u0072\u00AA\u00BA\u00E6\u00B8\u00C6\u00A4" + // 0x98 - 0x9f
|
||||
"\u00B5\u007E\u0073\u0074\u0075\u0076\u0077\u0078" + // 0xa0 - 0xa7
|
||||
"\u0079\u007A\u00A1\u00BF\u00D0\u00DD\u00DE\u00AE" + // 0xa8 - 0xaf
|
||||
"\u005E\u00A3\u00A5\u00B7\u00A9\u00A7\u00B6\u00BC" + // 0xb0 - 0xb7
|
||||
"\u00BD\u00BE\u005B\u005D\u00AF\u00A8\u00B4\u00D7" + // 0xb8 - 0xbf
|
||||
"\u007B\u0041\u0042\u0043\u0044\u0045\u0046\u0047" + // 0xc0 - 0xc7
|
||||
"\u0048\u0049\u00AD\u00F4\u00F6\u00F2\u00F3\u00F5" + // 0xc8 - 0xcf
|
||||
"\u007D\u004A\u004B\u004C\u004D\u004E\u004F\u0050" + // 0xd0 - 0xd7
|
||||
"\u0051\u0052\u00B9\u00FB\u00FC\u00F9\u00FA\u00FF" + // 0xd8 - 0xdf
|
||||
"\\\u00F7\u0053\u0054\u0055\u0056\u0057\u0058" + // 0xe0 - 0xe7
|
||||
"\u0059\u005A\u00B2\u00D4\u00D6\u00D2\u00D3\u00D5" + // 0xe8 - 0xef
|
||||
"\u0030\u0031\u0032\u0033\u0034\u0035\u0036\u0037" + // 0xf0 - 0xf7
|
||||
"\u0038\u0039\u00B3\u00DB\u00DC\u00D9\u00DA\u009F" + // 0xf8 - 0xff
|
||||
"\u0000\u0001\u0002\u0003\u009C\t\u0086\u007F" + // 0x00 - 0x07
|
||||
"\u0097\u008D\u008E\u000B\f\r\u000E\u000F" + // 0x08 - 0x0f
|
||||
"\u0010\u0011\u0012\u0013\u009D\n\b\u0087" + // 0x10 - 0x17
|
||||
"\u0018\u0019\u0092\u008F\u001C\u001D\u001E\u001F" + // 0x18 - 0x1f
|
||||
"\u0080\u0081\u0082\u0083\u0084\n\u0017\u001B" + // 0x20 - 0x27
|
||||
"\u0088\u0089\u008A\u008B\u008C\u0005\u0006\u0007" + // 0x28 - 0x2f
|
||||
"\u0090\u0091\u0016\u0093\u0094\u0095\u0096\u0004" + // 0x30 - 0x37
|
||||
"\u0098\u0099\u009A\u009B\u0014\u0015\u009E\u001A" + // 0x38 - 0x3f
|
||||
"\u0020\u00A0\u00E2\u00E4\u00E0\u00E1\u00E3\u00E5" + // 0x40 - 0x47
|
||||
"\u00E7\u00F1\u00A2\u002E\u003C\u0028\u002B\u007C" + // 0x48 - 0x4f
|
||||
"\u0026\u00E9\u00EA\u00EB\u00E8\u00ED\u00EE\u00EF" + // 0x50 - 0x57
|
||||
"\u00EC\u00DF\u0021\u0024\u002A\u0029\u003B\u00AC" + // 0x58 - 0x5f
|
||||
"\u002D\u002F\u00C2\u00C4\u00C0\u00C1\u00C3\u00C5" + // 0x60 - 0x67
|
||||
"\u00C7\u00D1\u00A6\u002C\u0025\u005F\u003E\u003F" + // 0x68 - 0x6f
|
||||
"\u00F8\u00C9\u00CA\u00CB\u00C8\u00CD\u00CE\u00CF" + // 0x70 - 0x77
|
||||
"\u00CC\u0060\u003A\u0023\u0040\'\u003D\"" ; // 0x78 - 0x7f
|
||||
|
||||
|
||||
private final static char[] b2c = b2cTable.toCharArray();
|
||||
private final static char[] c2b = new char[0x100];
|
||||
private final static char[] c2bIndex = new char[0x100];
|
||||
|
||||
static {
|
||||
char[] b2cMap = b2c;
|
||||
char[] c2bNR = null;
|
||||
// remove non-roundtrip entries
|
||||
b2cMap = b2cTable.toCharArray();
|
||||
b2cMap[165] = UNMAPPABLE_DECODING;
|
||||
|
||||
// non-roundtrip c2b only entries
|
||||
c2bNR = new char[2];
|
||||
c2bNR[0] = 0x15; c2bNR[1] = 0x85;
|
||||
|
||||
SingleByte.initC2B(b2cMap, c2bNR, c2b, c2bIndex);
|
||||
}
|
||||
}
|
||||
102
jdkSrc/jdk8/sun/nio/cs/ext/IBM1006.java
Normal file
102
jdkSrc/jdk8/sun/nio/cs/ext/IBM1006.java
Normal file
@@ -0,0 +1,102 @@
|
||||
/*
|
||||
* Copyright (c) 2008, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package sun.nio.cs.ext;
|
||||
|
||||
import java.nio.charset.Charset;
|
||||
import java.nio.charset.CharsetDecoder;
|
||||
import java.nio.charset.CharsetEncoder;
|
||||
import sun.nio.cs.StandardCharsets;
|
||||
import sun.nio.cs.SingleByte;
|
||||
import sun.nio.cs.HistoricallyNamedCharset;
|
||||
import static sun.nio.cs.CharsetMapping.*;
|
||||
|
||||
public class IBM1006 extends Charset implements HistoricallyNamedCharset
|
||||
{
|
||||
public IBM1006() {
|
||||
super("x-IBM1006", ExtendedCharsets.aliasesFor("x-IBM1006"));
|
||||
}
|
||||
|
||||
public String historicalName() {
|
||||
return "Cp1006";
|
||||
}
|
||||
|
||||
public boolean contains(Charset cs) {
|
||||
return (cs instanceof IBM1006);
|
||||
}
|
||||
|
||||
public CharsetDecoder newDecoder() {
|
||||
return new SingleByte.Decoder(this, b2c);
|
||||
}
|
||||
|
||||
public CharsetEncoder newEncoder() {
|
||||
return new SingleByte.Encoder(this, c2b, c2bIndex);
|
||||
}
|
||||
|
||||
private final static String b2cTable =
|
||||
"\u0080\u0081\u0082\u0083\u0084\u0085\u0086\u0087" + // 0x80 - 0x87
|
||||
"\u0088\u0089\u008A\u008B\u008C\u008D\u008E\u008F" + // 0x88 - 0x8f
|
||||
"\u0090\u0091\u0092\u0093\u0094\u0095\u0096\u0097" + // 0x90 - 0x97
|
||||
"\u0098\u0099\u009A\u009B\u009C\u009D\u009E\u009F" + // 0x98 - 0x9f
|
||||
"\u00A0\u06F0\u06F1\u06F2\u06F3\u06F4\u06F5\u06F6" + // 0xa0 - 0xa7
|
||||
"\u06F7\u06F8\u06F9\u060C\u061B\u00AD\u061F\uFE81" + // 0xa8 - 0xaf
|
||||
"\uFE8D\uFE8E\uF8FB\uFE8F\uFE91\uFB56\uFB58\uFE93" + // 0xb0 - 0xb7
|
||||
"\uFE95\uFE97\uFB66\uFB68\uFE99\uFE9B\uFE9D\uFE9F" + // 0xb8 - 0xbf
|
||||
"\uFB7A\uFB7C\uFEA1\uFEA3\uFEA5\uFEA7\uFEA9\uFB88" + // 0xc0 - 0xc7
|
||||
"\uFEAB\uFEAD\uFB8C\uFEAF\uFB8A\uFEB1\uFEB3\uFEB5" + // 0xc8 - 0xcf
|
||||
"\uFEB7\uFEB9\uFEBB\uFEBD\uFEBF\uFEC3\uFEC7\uFEC9" + // 0xd0 - 0xd7
|
||||
"\uFECA\uFECB\uFECC\uFECD\uFECE\uFECF\uFED0\uFED1" + // 0xd8 - 0xdf
|
||||
"\uFED3\uFED5\uFED7\uFB8E\uFEDB\uFB92\uFB94\uFEDD" + // 0xe0 - 0xe7
|
||||
"\uFEDF\uFEE0\uFEE1\uFEE3\uFB9E\uFEE5\uFEE7\uFE85" + // 0xe8 - 0xef
|
||||
"\uFEED\uFBA6\uFBA8\uFBA9\uFBAA\uFE80\uFE89\uFE8A" + // 0xf0 - 0xf7
|
||||
"\uFE8B\uFBFC\uFBFD\uFBFE\uFBB0\uFBAE\uFE7C\uFE7D" + // 0xf8 - 0xff
|
||||
"\u0000\u0001\u0002\u0003\u0004\u0005\u0006\u0007" + // 0x00 - 0x07
|
||||
"\b\t\n\u000B\f\r\u000E\u000F" + // 0x08 - 0x0f
|
||||
"\u0010\u0011\u0012\u0013\u0014\u0015\u0016\u0017" + // 0x10 - 0x17
|
||||
"\u0018\u0019\u001A\u001B\u001C\u001D\u001E\u001F" + // 0x18 - 0x1f
|
||||
"\u0020\u0021\"\u0023\u0024\u0025\u0026\'" + // 0x20 - 0x27
|
||||
"\u0028\u0029\u002A\u002B\u002C\u002D\u002E\u002F" + // 0x28 - 0x2f
|
||||
"\u0030\u0031\u0032\u0033\u0034\u0035\u0036\u0037" + // 0x30 - 0x37
|
||||
"\u0038\u0039\u003A\u003B\u003C\u003D\u003E\u003F" + // 0x38 - 0x3f
|
||||
"\u0040\u0041\u0042\u0043\u0044\u0045\u0046\u0047" + // 0x40 - 0x47
|
||||
"\u0048\u0049\u004A\u004B\u004C\u004D\u004E\u004F" + // 0x48 - 0x4f
|
||||
"\u0050\u0051\u0052\u0053\u0054\u0055\u0056\u0057" + // 0x50 - 0x57
|
||||
"\u0058\u0059\u005A\u005B\\\u005D\u005E\u005F" + // 0x58 - 0x5f
|
||||
"\u0060\u0061\u0062\u0063\u0064\u0065\u0066\u0067" + // 0x60 - 0x67
|
||||
"\u0068\u0069\u006A\u006B\u006C\u006D\u006E\u006F" + // 0x68 - 0x6f
|
||||
"\u0070\u0071\u0072\u0073\u0074\u0075\u0076\u0077" + // 0x70 - 0x77
|
||||
"\u0078\u0079\u007A\u007B\u007C\u007D\u007E\u007F" ; // 0x78 - 0x7f
|
||||
|
||||
|
||||
private final static char[] b2c = b2cTable.toCharArray();
|
||||
private final static char[] c2b = new char[0x500];
|
||||
private final static char[] c2bIndex = new char[0x100];
|
||||
|
||||
static {
|
||||
char[] b2cMap = b2c;
|
||||
char[] c2bNR = null;
|
||||
SingleByte.initC2B(b2cMap, c2bNR, c2b, c2bIndex);
|
||||
}
|
||||
}
|
||||
110
jdkSrc/jdk8/sun/nio/cs/ext/IBM1025.java
Normal file
110
jdkSrc/jdk8/sun/nio/cs/ext/IBM1025.java
Normal file
@@ -0,0 +1,110 @@
|
||||
/*
|
||||
* Copyright (c) 2008, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package sun.nio.cs.ext;
|
||||
|
||||
import java.nio.charset.Charset;
|
||||
import java.nio.charset.CharsetDecoder;
|
||||
import java.nio.charset.CharsetEncoder;
|
||||
import sun.nio.cs.StandardCharsets;
|
||||
import sun.nio.cs.SingleByte;
|
||||
import sun.nio.cs.HistoricallyNamedCharset;
|
||||
import static sun.nio.cs.CharsetMapping.*;
|
||||
|
||||
public class IBM1025 extends Charset implements HistoricallyNamedCharset
|
||||
{
|
||||
public IBM1025() {
|
||||
super("x-IBM1025", ExtendedCharsets.aliasesFor("x-IBM1025"));
|
||||
}
|
||||
|
||||
public String historicalName() {
|
||||
return "Cp1025";
|
||||
}
|
||||
|
||||
public boolean contains(Charset cs) {
|
||||
return (cs instanceof IBM1025);
|
||||
}
|
||||
|
||||
public CharsetDecoder newDecoder() {
|
||||
return new SingleByte.Decoder(this, b2c);
|
||||
}
|
||||
|
||||
public CharsetEncoder newEncoder() {
|
||||
return new SingleByte.Encoder(this, c2b, c2bIndex);
|
||||
}
|
||||
|
||||
private final static String b2cTable =
|
||||
"\u0446\u0061\u0062\u0063\u0064\u0065\u0066\u0067" + // 0x80 - 0x87
|
||||
"\u0068\u0069\u0434\u0435\u0444\u0433\u0445\u0438" + // 0x88 - 0x8f
|
||||
"\u0439\u006A\u006B\u006C\u006D\u006E\u006F\u0070" + // 0x90 - 0x97
|
||||
"\u0071\u0072\u043A\u043B\u043C\u043D\u043E\u043F" + // 0x98 - 0x9f
|
||||
"\u044F\u007E\u0073\u0074\u0075\u0076\u0077\u0078" + // 0xa0 - 0xa7
|
||||
"\u0079\u007A\u0440\u0441\u0442\u0443\u0436\u0432" + // 0xa8 - 0xaf
|
||||
"\u044C\u044B\u0437\u0448\u044D\u0449\u0447\u044A" + // 0xb0 - 0xb7
|
||||
"\u042E\u0410\u0411\u0426\u0414\u0415\u0424\u0413" + // 0xb8 - 0xbf
|
||||
"\u007B\u0041\u0042\u0043\u0044\u0045\u0046\u0047" + // 0xc0 - 0xc7
|
||||
"\u0048\u0049\u0425\u0418\u0419\u041A\u041B\u041C" + // 0xc8 - 0xcf
|
||||
"\u007D\u004A\u004B\u004C\u004D\u004E\u004F\u0050" + // 0xd0 - 0xd7
|
||||
"\u0051\u0052\u041D\u041E\u041F\u042F\u0420\u0421" + // 0xd8 - 0xdf
|
||||
"\\\u00A7\u0053\u0054\u0055\u0056\u0057\u0058" + // 0xe0 - 0xe7
|
||||
"\u0059\u005A\u0422\u0423\u0416\u0412\u042C\u042B" + // 0xe8 - 0xef
|
||||
"\u0030\u0031\u0032\u0033\u0034\u0035\u0036\u0037" + // 0xf0 - 0xf7
|
||||
"\u0038\u0039\u0417\u0428\u042D\u0429\u0427\u009F" + // 0xf8 - 0xff
|
||||
"\u0000\u0001\u0002\u0003\u009C\t\u0086\u007F" + // 0x00 - 0x07
|
||||
"\u0097\u008D\u008E\u000B\f\r\u000E\u000F" + // 0x08 - 0x0f
|
||||
"\u0010\u0011\u0012\u0013\u009D\n\b\u0087" + // 0x10 - 0x17
|
||||
"\u0018\u0019\u0092\u008F\u001C\u001D\u001E\u001F" + // 0x18 - 0x1f
|
||||
"\u0080\u0081\u0082\u0083\u0084\n\u0017\u001B" + // 0x20 - 0x27
|
||||
"\u0088\u0089\u008A\u008B\u008C\u0005\u0006\u0007" + // 0x28 - 0x2f
|
||||
"\u0090\u0091\u0016\u0093\u0094\u0095\u0096\u0004" + // 0x30 - 0x37
|
||||
"\u0098\u0099\u009A\u009B\u0014\u0015\u009E\u001A" + // 0x38 - 0x3f
|
||||
"\u0020\u00A0\u0452\u0453\u0451\u0454\u0455\u0456" + // 0x40 - 0x47
|
||||
"\u0457\u0458\u005B\u002E\u003C\u0028\u002B\u0021" + // 0x48 - 0x4f
|
||||
"\u0026\u0459\u045A\u045B\u045C\u045E\u045F\u042A" + // 0x50 - 0x57
|
||||
"\u2116\u0402\u005D\u0024\u002A\u0029\u003B\u005E" + // 0x58 - 0x5f
|
||||
"\u002D\u002F\u0403\u0401\u0404\u0405\u0406\u0407" + // 0x60 - 0x67
|
||||
"\u0408\u0409\u007C\u002C\u0025\u005F\u003E\u003F" + // 0x68 - 0x6f
|
||||
"\u040A\u040B\u040C\u00AD\u040E\u040F\u044E\u0430" + // 0x70 - 0x77
|
||||
"\u0431\u0060\u003A\u0023\u0040\'\u003D\"" ; // 0x78 - 0x7f
|
||||
|
||||
|
||||
private final static char[] b2c = b2cTable.toCharArray();
|
||||
private final static char[] c2b = new char[0x300];
|
||||
private final static char[] c2bIndex = new char[0x100];
|
||||
|
||||
static {
|
||||
char[] b2cMap = b2c;
|
||||
char[] c2bNR = null;
|
||||
// remove non-roundtrip entries
|
||||
b2cMap = b2cTable.toCharArray();
|
||||
b2cMap[165] = UNMAPPABLE_DECODING;
|
||||
|
||||
// non-roundtrip c2b only entries
|
||||
c2bNR = new char[2];
|
||||
c2bNR[0] = 0x15; c2bNR[1] = 0x85;
|
||||
|
||||
SingleByte.initC2B(b2cMap, c2bNR, c2b, c2bIndex);
|
||||
}
|
||||
}
|
||||
110
jdkSrc/jdk8/sun/nio/cs/ext/IBM1026.java
Normal file
110
jdkSrc/jdk8/sun/nio/cs/ext/IBM1026.java
Normal file
@@ -0,0 +1,110 @@
|
||||
/*
|
||||
* Copyright (c) 2008, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package sun.nio.cs.ext;
|
||||
|
||||
import java.nio.charset.Charset;
|
||||
import java.nio.charset.CharsetDecoder;
|
||||
import java.nio.charset.CharsetEncoder;
|
||||
import sun.nio.cs.StandardCharsets;
|
||||
import sun.nio.cs.SingleByte;
|
||||
import sun.nio.cs.HistoricallyNamedCharset;
|
||||
import static sun.nio.cs.CharsetMapping.*;
|
||||
|
||||
public class IBM1026 extends Charset implements HistoricallyNamedCharset
|
||||
{
|
||||
public IBM1026() {
|
||||
super("IBM1026", ExtendedCharsets.aliasesFor("IBM1026"));
|
||||
}
|
||||
|
||||
public String historicalName() {
|
||||
return "Cp1026";
|
||||
}
|
||||
|
||||
public boolean contains(Charset cs) {
|
||||
return (cs instanceof IBM1026);
|
||||
}
|
||||
|
||||
public CharsetDecoder newDecoder() {
|
||||
return new SingleByte.Decoder(this, b2c);
|
||||
}
|
||||
|
||||
public CharsetEncoder newEncoder() {
|
||||
return new SingleByte.Encoder(this, c2b, c2bIndex);
|
||||
}
|
||||
|
||||
private final static String b2cTable =
|
||||
"\u00D8\u0061\u0062\u0063\u0064\u0065\u0066\u0067" + // 0x80 - 0x87
|
||||
"\u0068\u0069\u00AB\u00BB\u007D\u0060\u00A6\u00B1" + // 0x88 - 0x8f
|
||||
"\u00B0\u006A\u006B\u006C\u006D\u006E\u006F\u0070" + // 0x90 - 0x97
|
||||
"\u0071\u0072\u00AA\u00BA\u00E6\u00B8\u00C6\u00A4" + // 0x98 - 0x9f
|
||||
"\u00B5\u00F6\u0073\u0074\u0075\u0076\u0077\u0078" + // 0xa0 - 0xa7
|
||||
"\u0079\u007A\u00A1\u00BF\u005D\u0024\u0040\u00AE" + // 0xa8 - 0xaf
|
||||
"\u00A2\u00A3\u00A5\u00B7\u00A9\u00A7\u00B6\u00BC" + // 0xb0 - 0xb7
|
||||
"\u00BD\u00BE\u00AC\u007C\u00AF\u00A8\u00B4\u00D7" + // 0xb8 - 0xbf
|
||||
"\u00E7\u0041\u0042\u0043\u0044\u0045\u0046\u0047" + // 0xc0 - 0xc7
|
||||
"\u0048\u0049\u00AD\u00F4\u007E\u00F2\u00F3\u00F5" + // 0xc8 - 0xcf
|
||||
"\u011F\u004A\u004B\u004C\u004D\u004E\u004F\u0050" + // 0xd0 - 0xd7
|
||||
"\u0051\u0052\u00B9\u00FB\\\u00F9\u00FA\u00FF" + // 0xd8 - 0xdf
|
||||
"\u00FC\u00F7\u0053\u0054\u0055\u0056\u0057\u0058" + // 0xe0 - 0xe7
|
||||
"\u0059\u005A\u00B2\u00D4\u0023\u00D2\u00D3\u00D5" + // 0xe8 - 0xef
|
||||
"\u0030\u0031\u0032\u0033\u0034\u0035\u0036\u0037" + // 0xf0 - 0xf7
|
||||
"\u0038\u0039\u00B3\u00DB\"\u00D9\u00DA\u009F" + // 0xf8 - 0xff
|
||||
"\u0000\u0001\u0002\u0003\u009C\t\u0086\u007F" + // 0x00 - 0x07
|
||||
"\u0097\u008D\u008E\u000B\f\r\u000E\u000F" + // 0x08 - 0x0f
|
||||
"\u0010\u0011\u0012\u0013\u009D\n\b\u0087" + // 0x10 - 0x17
|
||||
"\u0018\u0019\u0092\u008F\u001C\u001D\u001E\u001F" + // 0x18 - 0x1f
|
||||
"\u0080\u0081\u0082\u0083\u0084\n\u0017\u001B" + // 0x20 - 0x27
|
||||
"\u0088\u0089\u008A\u008B\u008C\u0005\u0006\u0007" + // 0x28 - 0x2f
|
||||
"\u0090\u0091\u0016\u0093\u0094\u0095\u0096\u0004" + // 0x30 - 0x37
|
||||
"\u0098\u0099\u009A\u009B\u0014\u0015\u009E\u001A" + // 0x38 - 0x3f
|
||||
"\u0020\u00A0\u00E2\u00E4\u00E0\u00E1\u00E3\u00E5" + // 0x40 - 0x47
|
||||
"\u007B\u00F1\u00C7\u002E\u003C\u0028\u002B\u0021" + // 0x48 - 0x4f
|
||||
"\u0026\u00E9\u00EA\u00EB\u00E8\u00ED\u00EE\u00EF" + // 0x50 - 0x57
|
||||
"\u00EC\u00DF\u011E\u0130\u002A\u0029\u003B\u005E" + // 0x58 - 0x5f
|
||||
"\u002D\u002F\u00C2\u00C4\u00C0\u00C1\u00C3\u00C5" + // 0x60 - 0x67
|
||||
"\u005B\u00D1\u015F\u002C\u0025\u005F\u003E\u003F" + // 0x68 - 0x6f
|
||||
"\u00F8\u00C9\u00CA\u00CB\u00C8\u00CD\u00CE\u00CF" + // 0x70 - 0x77
|
||||
"\u00CC\u0131\u003A\u00D6\u015E\'\u003D\u00DC" ; // 0x78 - 0x7f
|
||||
|
||||
|
||||
private final static char[] b2c = b2cTable.toCharArray();
|
||||
private final static char[] c2b = new char[0x200];
|
||||
private final static char[] c2bIndex = new char[0x100];
|
||||
|
||||
static {
|
||||
char[] b2cMap = b2c;
|
||||
char[] c2bNR = null;
|
||||
// remove non-roundtrip entries
|
||||
b2cMap = b2cTable.toCharArray();
|
||||
b2cMap[165] = UNMAPPABLE_DECODING;
|
||||
|
||||
// non-roundtrip c2b only entries
|
||||
c2bNR = new char[2];
|
||||
c2bNR[0] = 0x15; c2bNR[1] = 0x85;
|
||||
|
||||
SingleByte.initC2B(b2cMap, c2bNR, c2b, c2bIndex);
|
||||
}
|
||||
}
|
||||
102
jdkSrc/jdk8/sun/nio/cs/ext/IBM1046.java
Normal file
102
jdkSrc/jdk8/sun/nio/cs/ext/IBM1046.java
Normal file
@@ -0,0 +1,102 @@
|
||||
/*
|
||||
* Copyright (c) 2008, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package sun.nio.cs.ext;
|
||||
|
||||
import java.nio.charset.Charset;
|
||||
import java.nio.charset.CharsetDecoder;
|
||||
import java.nio.charset.CharsetEncoder;
|
||||
import sun.nio.cs.StandardCharsets;
|
||||
import sun.nio.cs.SingleByte;
|
||||
import sun.nio.cs.HistoricallyNamedCharset;
|
||||
import static sun.nio.cs.CharsetMapping.*;
|
||||
|
||||
public class IBM1046 extends Charset implements HistoricallyNamedCharset
|
||||
{
|
||||
public IBM1046() {
|
||||
super("x-IBM1046", ExtendedCharsets.aliasesFor("x-IBM1046"));
|
||||
}
|
||||
|
||||
public String historicalName() {
|
||||
return "Cp1046";
|
||||
}
|
||||
|
||||
public boolean contains(Charset cs) {
|
||||
return (cs instanceof IBM1046);
|
||||
}
|
||||
|
||||
public CharsetDecoder newDecoder() {
|
||||
return new SingleByte.Decoder(this, b2c);
|
||||
}
|
||||
|
||||
public CharsetEncoder newEncoder() {
|
||||
return new SingleByte.Encoder(this, c2b, c2bIndex);
|
||||
}
|
||||
|
||||
private final static String b2cTable =
|
||||
"\uFE88\u00D7\u00F7\uF8F6\uF8F5\uF8F4\uF8F7\uFE71" + // 0x80 - 0x87
|
||||
"\u0088\u25A0\u2502\u2500\u2510\u250C\u2514\u2518" + // 0x88 - 0x8f
|
||||
"\uFE79\uFE7B\uFE7D\uFE7F\uFE77\uFE8A\uFEF0\uFEF3" + // 0x90 - 0x97
|
||||
"\uFEF2\uFECE\uFECF\uFED0\uFEF6\uFEF8\uFEFA\uFEFC" + // 0x98 - 0x9f
|
||||
"\u00A0\uF8FA\uF8F9\uF8F8\u00A4\uF8FB\uFE8B\uFE91" + // 0xa0 - 0xa7
|
||||
"\uFE97\uFE9B\uFE9F\uFEA3\u060C\u00AD\uFEA7\uFEB3" + // 0xa8 - 0xaf
|
||||
"\u0660\u0661\u0662\u0663\u0664\u0665\u0666\u0667" + // 0xb0 - 0xb7
|
||||
"\u0668\u0669\uFEB7\u061B\uFEBB\uFEBF\uFECA\u061F" + // 0xb8 - 0xbf
|
||||
"\uFECB\uFE80\uFE81\uFE83\uFE85\uFE87\uFE89\uFE8D" + // 0xc0 - 0xc7
|
||||
"\uFE8F\uFE93\uFE95\uFE99\uFE9D\uFEA1\uFEA5\uFEA9" + // 0xc8 - 0xcf
|
||||
"\uFEAB\uFEAD\uFEAF\uFEB1\uFEB5\uFEB9\uFEBD\uFEC3" + // 0xd0 - 0xd7
|
||||
"\uFEC7\uFEC9\uFECD\uFECC\uFE82\uFE84\uFE8E\uFED3" + // 0xd8 - 0xdf
|
||||
"\u0640\uFED1\uFED5\uFED9\uFEDD\uFEE1\uFEE5\uFEEB" + // 0xe0 - 0xe7
|
||||
"\uFEED\uFEEF\uFEF1\uFE70\uFE72\uFE74\uFE76\uFE78" + // 0xe8 - 0xef
|
||||
"\uFE7A\uFE7C\uFE7E\uFED7\uFEDB\uFEDF\uF8FC\uFEF5" + // 0xf0 - 0xf7
|
||||
"\uFEF7\uFEF9\uFEFB\uFEE3\uFEE7\uFEEC\uFEE9\uFFFD" + // 0xf8 - 0xff
|
||||
"\u0000\u0001\u0002\u0003\u0004\u0005\u0006\u0007" + // 0x00 - 0x07
|
||||
"\b\t\n\u000B\f\r\u000E\u000F" + // 0x08 - 0x0f
|
||||
"\u0010\u0011\u0012\u0013\u0014\u0015\u0016\u0017" + // 0x10 - 0x17
|
||||
"\u0018\u0019\u001A\u001B\u001C\u001D\u001E\u001F" + // 0x18 - 0x1f
|
||||
"\u0020\u0021\"\u0023\u0024\u0025\u0026\'" + // 0x20 - 0x27
|
||||
"\u0028\u0029\u002A\u002B\u002C\u002D\u002E\u002F" + // 0x28 - 0x2f
|
||||
"\u0030\u0031\u0032\u0033\u0034\u0035\u0036\u0037" + // 0x30 - 0x37
|
||||
"\u0038\u0039\u003A\u003B\u003C\u003D\u003E\u003F" + // 0x38 - 0x3f
|
||||
"\u0040\u0041\u0042\u0043\u0044\u0045\u0046\u0047" + // 0x40 - 0x47
|
||||
"\u0048\u0049\u004A\u004B\u004C\u004D\u004E\u004F" + // 0x48 - 0x4f
|
||||
"\u0050\u0051\u0052\u0053\u0054\u0055\u0056\u0057" + // 0x50 - 0x57
|
||||
"\u0058\u0059\u005A\u005B\\\u005D\u005E\u005F" + // 0x58 - 0x5f
|
||||
"\u0060\u0061\u0062\u0063\u0064\u0065\u0066\u0067" + // 0x60 - 0x67
|
||||
"\u0068\u0069\u006A\u006B\u006C\u006D\u006E\u006F" + // 0x68 - 0x6f
|
||||
"\u0070\u0071\u0072\u0073\u0074\u0075\u0076\u0077" + // 0x70 - 0x77
|
||||
"\u0078\u0079\u007A\u007B\u007C\u007D\u007E\u007F" ; // 0x78 - 0x7f
|
||||
|
||||
|
||||
private final static char[] b2c = b2cTable.toCharArray();
|
||||
private final static char[] c2b = new char[0x600];
|
||||
private final static char[] c2bIndex = new char[0x100];
|
||||
|
||||
static {
|
||||
char[] b2cMap = b2c;
|
||||
char[] c2bNR = null;
|
||||
SingleByte.initC2B(b2cMap, c2bNR, c2b, c2bIndex);
|
||||
}
|
||||
}
|
||||
102
jdkSrc/jdk8/sun/nio/cs/ext/IBM1047.java
Normal file
102
jdkSrc/jdk8/sun/nio/cs/ext/IBM1047.java
Normal file
@@ -0,0 +1,102 @@
|
||||
/*
|
||||
* Copyright (c) 2008, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package sun.nio.cs.ext;
|
||||
|
||||
import java.nio.charset.Charset;
|
||||
import java.nio.charset.CharsetDecoder;
|
||||
import java.nio.charset.CharsetEncoder;
|
||||
import sun.nio.cs.StandardCharsets;
|
||||
import sun.nio.cs.SingleByte;
|
||||
import sun.nio.cs.HistoricallyNamedCharset;
|
||||
import static sun.nio.cs.CharsetMapping.*;
|
||||
|
||||
public class IBM1047 extends Charset implements HistoricallyNamedCharset
|
||||
{
|
||||
public IBM1047() {
|
||||
super("IBM1047", ExtendedCharsets.aliasesFor("IBM1047"));
|
||||
}
|
||||
|
||||
public String historicalName() {
|
||||
return "Cp1047";
|
||||
}
|
||||
|
||||
public boolean contains(Charset cs) {
|
||||
return (cs instanceof IBM1047);
|
||||
}
|
||||
|
||||
public CharsetDecoder newDecoder() {
|
||||
return new SingleByte.Decoder(this, b2c);
|
||||
}
|
||||
|
||||
public CharsetEncoder newEncoder() {
|
||||
return new SingleByte.Encoder(this, c2b, c2bIndex);
|
||||
}
|
||||
|
||||
private final static String b2cTable =
|
||||
"\u00D8\u0061\u0062\u0063\u0064\u0065\u0066\u0067" + // 0x80 - 0x87
|
||||
"\u0068\u0069\u00AB\u00BB\u00F0\u00FD\u00FE\u00B1" + // 0x88 - 0x8f
|
||||
"\u00B0\u006A\u006B\u006C\u006D\u006E\u006F\u0070" + // 0x90 - 0x97
|
||||
"\u0071\u0072\u00AA\u00BA\u00E6\u00B8\u00C6\u00A4" + // 0x98 - 0x9f
|
||||
"\u00B5\u007E\u0073\u0074\u0075\u0076\u0077\u0078" + // 0xa0 - 0xa7
|
||||
"\u0079\u007A\u00A1\u00BF\u00D0\u005B\u00DE\u00AE" + // 0xa8 - 0xaf
|
||||
"\u00AC\u00A3\u00A5\u00B7\u00A9\u00A7\u00B6\u00BC" + // 0xb0 - 0xb7
|
||||
"\u00BD\u00BE\u00DD\u00A8\u00AF\u005D\u00B4\u00D7" + // 0xb8 - 0xbf
|
||||
"\u007B\u0041\u0042\u0043\u0044\u0045\u0046\u0047" + // 0xc0 - 0xc7
|
||||
"\u0048\u0049\u00AD\u00F4\u00F6\u00F2\u00F3\u00F5" + // 0xc8 - 0xcf
|
||||
"\u007D\u004A\u004B\u004C\u004D\u004E\u004F\u0050" + // 0xd0 - 0xd7
|
||||
"\u0051\u0052\u00B9\u00FB\u00FC\u00F9\u00FA\u00FF" + // 0xd8 - 0xdf
|
||||
"\\\u00F7\u0053\u0054\u0055\u0056\u0057\u0058" + // 0xe0 - 0xe7
|
||||
"\u0059\u005A\u00B2\u00D4\u00D6\u00D2\u00D3\u00D5" + // 0xe8 - 0xef
|
||||
"\u0030\u0031\u0032\u0033\u0034\u0035\u0036\u0037" + // 0xf0 - 0xf7
|
||||
"\u0038\u0039\u00B3\u00DB\u00DC\u00D9\u00DA\u009F" + // 0xf8 - 0xff
|
||||
"\u0000\u0001\u0002\u0003\u009C\t\u0086\u007F" + // 0x00 - 0x07
|
||||
"\u0097\u008D\u008E\u000B\f\r\u000E\u000F" + // 0x08 - 0x0f
|
||||
"\u0010\u0011\u0012\u0013\u009D\n\b\u0087" + // 0x10 - 0x17
|
||||
"\u0018\u0019\u0092\u008F\u001C\u001D\u001E\u001F" + // 0x18 - 0x1f
|
||||
"\u0080\u0081\u0082\u0083\u0084\u0085\u0017\u001B" + // 0x20 - 0x27
|
||||
"\u0088\u0089\u008A\u008B\u008C\u0005\u0006\u0007" + // 0x28 - 0x2f
|
||||
"\u0090\u0091\u0016\u0093\u0094\u0095\u0096\u0004" + // 0x30 - 0x37
|
||||
"\u0098\u0099\u009A\u009B\u0014\u0015\u009E\u001A" + // 0x38 - 0x3f
|
||||
"\u0020\u00A0\u00E2\u00E4\u00E0\u00E1\u00E3\u00E5" + // 0x40 - 0x47
|
||||
"\u00E7\u00F1\u00A2\u002E\u003C\u0028\u002B\u007C" + // 0x48 - 0x4f
|
||||
"\u0026\u00E9\u00EA\u00EB\u00E8\u00ED\u00EE\u00EF" + // 0x50 - 0x57
|
||||
"\u00EC\u00DF\u0021\u0024\u002A\u0029\u003B\u005E" + // 0x58 - 0x5f
|
||||
"\u002D\u002F\u00C2\u00C4\u00C0\u00C1\u00C3\u00C5" + // 0x60 - 0x67
|
||||
"\u00C7\u00D1\u00A6\u002C\u0025\u005F\u003E\u003F" + // 0x68 - 0x6f
|
||||
"\u00F8\u00C9\u00CA\u00CB\u00C8\u00CD\u00CE\u00CF" + // 0x70 - 0x77
|
||||
"\u00CC\u0060\u003A\u0023\u0040\'\u003D\"" ; // 0x78 - 0x7f
|
||||
|
||||
|
||||
private final static char[] b2c = b2cTable.toCharArray();
|
||||
private final static char[] c2b = new char[0x100];
|
||||
private final static char[] c2bIndex = new char[0x100];
|
||||
|
||||
static {
|
||||
char[] b2cMap = b2c;
|
||||
char[] c2bNR = null;
|
||||
SingleByte.initC2B(b2cMap, c2bNR, c2b, c2bIndex);
|
||||
}
|
||||
}
|
||||
102
jdkSrc/jdk8/sun/nio/cs/ext/IBM1097.java
Normal file
102
jdkSrc/jdk8/sun/nio/cs/ext/IBM1097.java
Normal file
@@ -0,0 +1,102 @@
|
||||
/*
|
||||
* Copyright (c) 2008, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package sun.nio.cs.ext;
|
||||
|
||||
import java.nio.charset.Charset;
|
||||
import java.nio.charset.CharsetDecoder;
|
||||
import java.nio.charset.CharsetEncoder;
|
||||
import sun.nio.cs.StandardCharsets;
|
||||
import sun.nio.cs.SingleByte;
|
||||
import sun.nio.cs.HistoricallyNamedCharset;
|
||||
import static sun.nio.cs.CharsetMapping.*;
|
||||
|
||||
public class IBM1097 extends Charset implements HistoricallyNamedCharset
|
||||
{
|
||||
public IBM1097() {
|
||||
super("x-IBM1097", ExtendedCharsets.aliasesFor("x-IBM1097"));
|
||||
}
|
||||
|
||||
public String historicalName() {
|
||||
return "Cp1097";
|
||||
}
|
||||
|
||||
public boolean contains(Charset cs) {
|
||||
return (cs instanceof IBM1097);
|
||||
}
|
||||
|
||||
public CharsetDecoder newDecoder() {
|
||||
return new SingleByte.Decoder(this, b2c);
|
||||
}
|
||||
|
||||
public CharsetEncoder newEncoder() {
|
||||
return new SingleByte.Encoder(this, c2b, c2bIndex);
|
||||
}
|
||||
|
||||
private final static String b2cTable =
|
||||
"\uFB8A\u0061\u0062\u0063\u0064\u0065\u0066\u0067" + // 0x80 - 0x87
|
||||
"\u0068\u0069\u00AB\u00BB\uFEB1\uFEB3\uFEB5\uFEB7" + // 0x88 - 0x8f
|
||||
"\uFEB9\u006A\u006B\u006C\u006D\u006E\u006F\u0070" + // 0x90 - 0x97
|
||||
"\u0071\u0072\uFEBB\uFEBD\uFEBF\uFEC1\uFEC3\uFEC5" + // 0x98 - 0x9f
|
||||
"\uFEC7\u007E\u0073\u0074\u0075\u0076\u0077\u0078" + // 0xa0 - 0xa7
|
||||
"\u0079\u007A\uFEC9\uFECA\uFECB\uFECC\uFECD\uFECE" + // 0xa8 - 0xaf
|
||||
"\uFECF\uFED0\uFED1\uFED3\uFED5\uFED7\uFB8E\uFEDB" + // 0xb0 - 0xb7
|
||||
"\uFB92\uFB94\u005B\u005D\uFEDD\uFEDF\uFEE1\u00D7" + // 0xb8 - 0xbf
|
||||
"\u007B\u0041\u0042\u0043\u0044\u0045\u0046\u0047" + // 0xc0 - 0xc7
|
||||
"\u0048\u0049\u00AD\uFEE3\uFEE5\uFEE7\uFEED\uFEE9" + // 0xc8 - 0xcf
|
||||
"\u007D\u004A\u004B\u004C\u004D\u004E\u004F\u0050" + // 0xd0 - 0xd7
|
||||
"\u0051\u0052\uFEEB\uFEEC\uFBA4\uFBFC\uFBFD\uFBFE" + // 0xd8 - 0xdf
|
||||
"\\\u061F\u0053\u0054\u0055\u0056\u0057\u0058" + // 0xe0 - 0xe7
|
||||
"\u0059\u005A\u0640\u06F0\u06F1\u06F2\u06F3\u06F4" + // 0xe8 - 0xef
|
||||
"\u0030\u0031\u0032\u0033\u0034\u0035\u0036\u0037" + // 0xf0 - 0xf7
|
||||
"\u0038\u0039\u06F5\u06F6\u06F7\u06F8\u06F9\u009F" + // 0xf8 - 0xff
|
||||
"\u0000\u0001\u0002\u0003\u009C\t\u0086\u007F" + // 0x00 - 0x07
|
||||
"\u0097\u008D\u008E\u000B\f\r\u000E\u000F" + // 0x08 - 0x0f
|
||||
"\u0010\u0011\u0012\u0013\u009D\u0085\b\u0087" + // 0x10 - 0x17
|
||||
"\u0018\u0019\u0092\u008F\u001C\u001D\u001E\u001F" + // 0x18 - 0x1f
|
||||
"\u0080\u0081\u0082\u0083\u0084\n\u0017\u001B" + // 0x20 - 0x27
|
||||
"\u0088\u0089\u008A\u008B\u008C\u0005\u0006\u0007" + // 0x28 - 0x2f
|
||||
"\u0090\u0091\u0016\u0093\u0094\u0095\u0096\u0004" + // 0x30 - 0x37
|
||||
"\u0098\u0099\u009A\u009B\u0014\u0015\u009E\u001A" + // 0x38 - 0x3f
|
||||
"\u0020\u00A0\u060C\u064B\uFE81\uFE82\uF8FA\uFE8D" + // 0x40 - 0x47
|
||||
"\uFE8E\uF8FB\u00A4\u002E\u003C\u0028\u002B\u007C" + // 0x48 - 0x4f
|
||||
"\u0026\uFE80\uFE83\uFE84\uF8F9\uFE85\uFE8B\uFE8F" + // 0x50 - 0x57
|
||||
"\uFE91\uFB56\u0021\u0024\u002A\u0029\u003B\u00AC" + // 0x58 - 0x5f
|
||||
"\u002D\u002F\uFB58\uFE95\uFE97\uFE99\uFE9B\uFE9D" + // 0x60 - 0x67
|
||||
"\uFE9F\uFB7A\u061B\u002C\u0025\u005F\u003E\u003F" + // 0x68 - 0x6f
|
||||
"\uFB7C\uFEA1\uFEA3\uFEA5\uFEA7\uFEA9\uFEAB\uFEAD" + // 0x70 - 0x77
|
||||
"\uFEAF\u0060\u003A\u0023\u0040\'\u003D\"" ; // 0x78 - 0x7f
|
||||
|
||||
|
||||
private final static char[] b2c = b2cTable.toCharArray();
|
||||
private final static char[] c2b = new char[0x500];
|
||||
private final static char[] c2bIndex = new char[0x100];
|
||||
|
||||
static {
|
||||
char[] b2cMap = b2c;
|
||||
char[] c2bNR = null;
|
||||
SingleByte.initC2B(b2cMap, c2bNR, c2b, c2bIndex);
|
||||
}
|
||||
}
|
||||
102
jdkSrc/jdk8/sun/nio/cs/ext/IBM1098.java
Normal file
102
jdkSrc/jdk8/sun/nio/cs/ext/IBM1098.java
Normal file
@@ -0,0 +1,102 @@
|
||||
/*
|
||||
* Copyright (c) 2008, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package sun.nio.cs.ext;
|
||||
|
||||
import java.nio.charset.Charset;
|
||||
import java.nio.charset.CharsetDecoder;
|
||||
import java.nio.charset.CharsetEncoder;
|
||||
import sun.nio.cs.StandardCharsets;
|
||||
import sun.nio.cs.SingleByte;
|
||||
import sun.nio.cs.HistoricallyNamedCharset;
|
||||
import static sun.nio.cs.CharsetMapping.*;
|
||||
|
||||
public class IBM1098 extends Charset implements HistoricallyNamedCharset
|
||||
{
|
||||
public IBM1098() {
|
||||
super("x-IBM1098", ExtendedCharsets.aliasesFor("x-IBM1098"));
|
||||
}
|
||||
|
||||
public String historicalName() {
|
||||
return "Cp1098";
|
||||
}
|
||||
|
||||
public boolean contains(Charset cs) {
|
||||
return (cs instanceof IBM1098);
|
||||
}
|
||||
|
||||
public CharsetDecoder newDecoder() {
|
||||
return new SingleByte.Decoder(this, b2c);
|
||||
}
|
||||
|
||||
public CharsetEncoder newEncoder() {
|
||||
return new SingleByte.Encoder(this, c2b, c2bIndex);
|
||||
}
|
||||
|
||||
private final static String b2cTable =
|
||||
"\uFFFD\uFFFD\u060C\u061B\u061F\u064B\uFE81\uFE82" + // 0x80 - 0x87
|
||||
"\uF8FA\uFE8D\uFE8E\uF8FB\uFE80\uFE83\uFE84\uF8F9" + // 0x88 - 0x8f
|
||||
"\uFE85\uFE8B\uFE8F\uFE91\uFB56\uFB58\uFE95\uFE97" + // 0x90 - 0x97
|
||||
"\uFE99\uFE9B\uFE9D\uFE9F\uFB7A\uFB7C\u00D7\uFEA1" + // 0x98 - 0x9f
|
||||
"\uFEA3\uFEA5\uFEA7\uFEA9\uFEAB\uFEAD\uFEAF\uFB8A" + // 0xa0 - 0xa7
|
||||
"\uFEB1\uFEB3\uFEB5\uFEB7\uFEB9\uFEBB\u00AB\u00BB" + // 0xa8 - 0xaf
|
||||
"\u2591\u2592\u2593\u2502\u2524\uFEBD\uFEBF\uFEC1" + // 0xb0 - 0xb7
|
||||
"\uFEC3\u2563\u2551\u2557\u255D\u00A4\uFEC5\u2510" + // 0xb8 - 0xbf
|
||||
"\u2514\u2534\u252C\u251C\u2500\u253C\uFEC7\uFEC9" + // 0xc0 - 0xc7
|
||||
"\u255A\u2554\u2569\u2566\u2560\u2550\u256C\uFFFD" + // 0xc8 - 0xcf
|
||||
"\uFECA\uFECB\uFECC\uFECD\uFECE\uFECF\uFED0\uFED1" + // 0xd0 - 0xd7
|
||||
"\uFED3\u2518\u250C\u2588\u2584\uFED5\uFED7\u2580" + // 0xd8 - 0xdf
|
||||
"\uFB8E\uFEDB\uFB92\uFB94\uFEDD\uFEDF\uFEE1\uFEE3" + // 0xe0 - 0xe7
|
||||
"\uFEE5\uFEE7\uFEED\uFEE9\uFEEB\uFEEC\uFBA4\uFBFC" + // 0xe8 - 0xef
|
||||
"\u00AD\uFBFD\uFBFE\u0640\u06F0\u06F1\u06F2\u06F3" + // 0xf0 - 0xf7
|
||||
"\u06F4\u06F5\u06F6\u06F7\u06F8\u06F9\u25A0\u00A0" + // 0xf8 - 0xff
|
||||
"\u0000\u0001\u0002\u0003\u0004\u0005\u0006\u0007" + // 0x00 - 0x07
|
||||
"\b\t\n\u000B\f\r\u000E\u000F" + // 0x08 - 0x0f
|
||||
"\u0010\u0011\u0012\u0013\u0014\u0015\u0016\u0017" + // 0x10 - 0x17
|
||||
"\u0018\u0019\u001A\u001B\u001C\u001D\u001E\u001F" + // 0x18 - 0x1f
|
||||
"\u0020\u0021\"\u0023\u0024\u0025\u0026\'" + // 0x20 - 0x27
|
||||
"\u0028\u0029\u002A\u002B\u002C\u002D\u002E\u002F" + // 0x28 - 0x2f
|
||||
"\u0030\u0031\u0032\u0033\u0034\u0035\u0036\u0037" + // 0x30 - 0x37
|
||||
"\u0038\u0039\u003A\u003B\u003C\u003D\u003E\u003F" + // 0x38 - 0x3f
|
||||
"\u0040\u0041\u0042\u0043\u0044\u0045\u0046\u0047" + // 0x40 - 0x47
|
||||
"\u0048\u0049\u004A\u004B\u004C\u004D\u004E\u004F" + // 0x48 - 0x4f
|
||||
"\u0050\u0051\u0052\u0053\u0054\u0055\u0056\u0057" + // 0x50 - 0x57
|
||||
"\u0058\u0059\u005A\u005B\\\u005D\u005E\u005F" + // 0x58 - 0x5f
|
||||
"\u0060\u0061\u0062\u0063\u0064\u0065\u0066\u0067" + // 0x60 - 0x67
|
||||
"\u0068\u0069\u006A\u006B\u006C\u006D\u006E\u006F" + // 0x68 - 0x6f
|
||||
"\u0070\u0071\u0072\u0073\u0074\u0075\u0076\u0077" + // 0x70 - 0x77
|
||||
"\u0078\u0079\u007A\u007B\u007C\u007D\u007E\u007F" ; // 0x78 - 0x7f
|
||||
|
||||
|
||||
private final static char[] b2c = b2cTable.toCharArray();
|
||||
private final static char[] c2b = new char[0x700];
|
||||
private final static char[] c2bIndex = new char[0x100];
|
||||
|
||||
static {
|
||||
char[] b2cMap = b2c;
|
||||
char[] c2bNR = null;
|
||||
SingleByte.initC2B(b2cMap, c2bNR, c2b, c2bIndex);
|
||||
}
|
||||
}
|
||||
110
jdkSrc/jdk8/sun/nio/cs/ext/IBM1112.java
Normal file
110
jdkSrc/jdk8/sun/nio/cs/ext/IBM1112.java
Normal file
@@ -0,0 +1,110 @@
|
||||
/*
|
||||
* Copyright (c) 2008, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package sun.nio.cs.ext;
|
||||
|
||||
import java.nio.charset.Charset;
|
||||
import java.nio.charset.CharsetDecoder;
|
||||
import java.nio.charset.CharsetEncoder;
|
||||
import sun.nio.cs.StandardCharsets;
|
||||
import sun.nio.cs.SingleByte;
|
||||
import sun.nio.cs.HistoricallyNamedCharset;
|
||||
import static sun.nio.cs.CharsetMapping.*;
|
||||
|
||||
public class IBM1112 extends Charset implements HistoricallyNamedCharset
|
||||
{
|
||||
public IBM1112() {
|
||||
super("x-IBM1112", ExtendedCharsets.aliasesFor("x-IBM1112"));
|
||||
}
|
||||
|
||||
public String historicalName() {
|
||||
return "Cp1112";
|
||||
}
|
||||
|
||||
public boolean contains(Charset cs) {
|
||||
return (cs instanceof IBM1112);
|
||||
}
|
||||
|
||||
public CharsetDecoder newDecoder() {
|
||||
return new SingleByte.Decoder(this, b2c);
|
||||
}
|
||||
|
||||
public CharsetEncoder newEncoder() {
|
||||
return new SingleByte.Encoder(this, c2b, c2bIndex);
|
||||
}
|
||||
|
||||
private final static String b2cTable =
|
||||
"\u00D8\u0061\u0062\u0063\u0064\u0065\u0066\u0067" + // 0x80 - 0x87
|
||||
"\u0068\u0069\u00AB\u00BB\u0101\u017C\u0144\u00B1" + // 0x88 - 0x8f
|
||||
"\u00B0\u006A\u006B\u006C\u006D\u006E\u006F\u0070" + // 0x90 - 0x97
|
||||
"\u0071\u0072\u0156\u0157\u00E6\u0137\u00C6\u00A4" + // 0x98 - 0x9f
|
||||
"\u00B5\u007E\u0073\u0074\u0075\u0076\u0077\u0078" + // 0xa0 - 0xa7
|
||||
"\u0079\u007A\u201D\u017A\u0100\u017B\u0143\u00AE" + // 0xa8 - 0xaf
|
||||
"\u005E\u00A3\u012B\u00B7\u00A9\u00A7\u00B6\u00BC" + // 0xb0 - 0xb7
|
||||
"\u00BD\u00BE\u005B\u005D\u0179\u0136\u013C\u00D7" + // 0xb8 - 0xbf
|
||||
"\u007B\u0041\u0042\u0043\u0044\u0045\u0046\u0047" + // 0xc0 - 0xc7
|
||||
"\u0048\u0049\u00AD\u014D\u00F6\u0146\u00F3\u00F5" + // 0xc8 - 0xcf
|
||||
"\u007D\u004A\u004B\u004C\u004D\u004E\u004F\u0050" + // 0xd0 - 0xd7
|
||||
"\u0051\u0052\u00B9\u0107\u00FC\u0142\u015B\u2019" + // 0xd8 - 0xdf
|
||||
"\\\u00F7\u0053\u0054\u0055\u0056\u0057\u0058" + // 0xe0 - 0xe7
|
||||
"\u0059\u005A\u00B2\u014C\u00D6\u0145\u00D3\u00D5" + // 0xe8 - 0xef
|
||||
"\u0030\u0031\u0032\u0033\u0034\u0035\u0036\u0037" + // 0xf0 - 0xf7
|
||||
"\u0038\u0039\u00B3\u0106\u00DC\u0141\u015A\u009F" + // 0xf8 - 0xff
|
||||
"\u0000\u0001\u0002\u0003\u009C\t\u0086\u007F" + // 0x00 - 0x07
|
||||
"\u0097\u008D\u008E\u000B\f\r\u000E\u000F" + // 0x08 - 0x0f
|
||||
"\u0010\u0011\u0012\u0013\u009D\n\b\u0087" + // 0x10 - 0x17
|
||||
"\u0018\u0019\u0092\u008F\u001C\u001D\u001E\u001F" + // 0x18 - 0x1f
|
||||
"\u0080\u0081\u0082\u0083\u0084\n\u0017\u001B" + // 0x20 - 0x27
|
||||
"\u0088\u0089\u008A\u008B\u008C\u0005\u0006\u0007" + // 0x28 - 0x2f
|
||||
"\u0090\u0091\u0016\u0093\u0094\u0095\u0096\u0004" + // 0x30 - 0x37
|
||||
"\u0098\u0099\u009A\u009B\u0014\u0015\u009E\u001A" + // 0x38 - 0x3f
|
||||
"\u0020\u00A0\u0161\u00E4\u0105\u012F\u016B\u00E5" + // 0x40 - 0x47
|
||||
"\u0113\u017E\u00A2\u002E\u003C\u0028\u002B\u007C" + // 0x48 - 0x4f
|
||||
"\u0026\u00E9\u0119\u0117\u010D\u0173\u201E\u201C" + // 0x50 - 0x57
|
||||
"\u0123\u00DF\u0021\u0024\u002A\u0029\u003B\u00AC" + // 0x58 - 0x5f
|
||||
"\u002D\u002F\u0160\u00C4\u0104\u012E\u016A\u00C5" + // 0x60 - 0x67
|
||||
"\u0112\u017D\u00A6\u002C\u0025\u005F\u003E\u003F" + // 0x68 - 0x6f
|
||||
"\u00F8\u00C9\u0118\u0116\u010C\u0172\u012A\u013B" + // 0x70 - 0x77
|
||||
"\u0122\u0060\u003A\u0023\u0040\'\u003D\"" ; // 0x78 - 0x7f
|
||||
|
||||
|
||||
private final static char[] b2c = b2cTable.toCharArray();
|
||||
private final static char[] c2b = new char[0x300];
|
||||
private final static char[] c2bIndex = new char[0x100];
|
||||
|
||||
static {
|
||||
char[] b2cMap = b2c;
|
||||
char[] c2bNR = null;
|
||||
// remove non-roundtrip entries
|
||||
b2cMap = b2cTable.toCharArray();
|
||||
b2cMap[165] = UNMAPPABLE_DECODING;
|
||||
|
||||
// non-roundtrip c2b only entries
|
||||
c2bNR = new char[2];
|
||||
c2bNR[0] = 0x15; c2bNR[1] = 0x85;
|
||||
|
||||
SingleByte.initC2B(b2cMap, c2bNR, c2b, c2bIndex);
|
||||
}
|
||||
}
|
||||
110
jdkSrc/jdk8/sun/nio/cs/ext/IBM1122.java
Normal file
110
jdkSrc/jdk8/sun/nio/cs/ext/IBM1122.java
Normal file
@@ -0,0 +1,110 @@
|
||||
/*
|
||||
* Copyright (c) 2008, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package sun.nio.cs.ext;
|
||||
|
||||
import java.nio.charset.Charset;
|
||||
import java.nio.charset.CharsetDecoder;
|
||||
import java.nio.charset.CharsetEncoder;
|
||||
import sun.nio.cs.StandardCharsets;
|
||||
import sun.nio.cs.SingleByte;
|
||||
import sun.nio.cs.HistoricallyNamedCharset;
|
||||
import static sun.nio.cs.CharsetMapping.*;
|
||||
|
||||
public class IBM1122 extends Charset implements HistoricallyNamedCharset
|
||||
{
|
||||
public IBM1122() {
|
||||
super("x-IBM1122", ExtendedCharsets.aliasesFor("x-IBM1122"));
|
||||
}
|
||||
|
||||
public String historicalName() {
|
||||
return "Cp1122";
|
||||
}
|
||||
|
||||
public boolean contains(Charset cs) {
|
||||
return (cs instanceof IBM1122);
|
||||
}
|
||||
|
||||
public CharsetDecoder newDecoder() {
|
||||
return new SingleByte.Decoder(this, b2c);
|
||||
}
|
||||
|
||||
public CharsetEncoder newEncoder() {
|
||||
return new SingleByte.Encoder(this, c2b, c2bIndex);
|
||||
}
|
||||
|
||||
private final static String b2cTable =
|
||||
"\u00D8\u0061\u0062\u0063\u0064\u0065\u0066\u0067" + // 0x80 - 0x87
|
||||
"\u0068\u0069\u00AB\u00BB\u0161\u00FD\u017E\u00B1" + // 0x88 - 0x8f
|
||||
"\u00B0\u006A\u006B\u006C\u006D\u006E\u006F\u0070" + // 0x90 - 0x97
|
||||
"\u0071\u0072\u00AA\u00BA\u00E6\u00B8\u00C6\u005D" + // 0x98 - 0x9f
|
||||
"\u00B5\u00FC\u0073\u0074\u0075\u0076\u0077\u0078" + // 0xa0 - 0xa7
|
||||
"\u0079\u007A\u00A1\u00BF\u0160\u00DD\u017D\u00AE" + // 0xa8 - 0xaf
|
||||
"\u00A2\u00A3\u00A5\u00B7\u00A9\u005B\u00B6\u00BC" + // 0xb0 - 0xb7
|
||||
"\u00BD\u00BE\u00AC\u007C\u203E\u00A8\u00B4\u00D7" + // 0xb8 - 0xbf
|
||||
"\u00E4\u0041\u0042\u0043\u0044\u0045\u0046\u0047" + // 0xc0 - 0xc7
|
||||
"\u0048\u0049\u00AD\u00F4\u00A6\u00F2\u00F3\u00F5" + // 0xc8 - 0xcf
|
||||
"\u00E5\u004A\u004B\u004C\u004D\u004E\u004F\u0050" + // 0xd0 - 0xd7
|
||||
"\u0051\u0052\u00B9\u00FB\u007E\u00F9\u00FA\u00FF" + // 0xd8 - 0xdf
|
||||
"\u00C9\u00F7\u0053\u0054\u0055\u0056\u0057\u0058" + // 0xe0 - 0xe7
|
||||
"\u0059\u005A\u00B2\u00D4\u0040\u00D2\u00D3\u00D5" + // 0xe8 - 0xef
|
||||
"\u0030\u0031\u0032\u0033\u0034\u0035\u0036\u0037" + // 0xf0 - 0xf7
|
||||
"\u0038\u0039\u00B3\u00DB\u00DC\u00D9\u00DA\u009F" + // 0xf8 - 0xff
|
||||
"\u0000\u0001\u0002\u0003\u009C\t\u0086\u007F" + // 0x00 - 0x07
|
||||
"\u0097\u008D\u008E\u000B\f\r\u000E\u000F" + // 0x08 - 0x0f
|
||||
"\u0010\u0011\u0012\u0013\u009D\n\b\u0087" + // 0x10 - 0x17
|
||||
"\u0018\u0019\u0092\u008F\u001C\u001D\u001E\u001F" + // 0x18 - 0x1f
|
||||
"\u0080\u0081\u0082\u0083\u0084\n\u0017\u001B" + // 0x20 - 0x27
|
||||
"\u0088\u0089\u008A\u008B\u008C\u0005\u0006\u0007" + // 0x28 - 0x2f
|
||||
"\u0090\u0091\u0016\u0093\u0094\u0095\u0096\u0004" + // 0x30 - 0x37
|
||||
"\u0098\u0099\u009A\u009B\u0014\u0015\u009E\u001A" + // 0x38 - 0x3f
|
||||
"\u0020\u00A0\u00E2\u007B\u00E0\u00E1\u00E3\u007D" + // 0x40 - 0x47
|
||||
"\u00E7\u00F1\u00A7\u002E\u003C\u0028\u002B\u0021" + // 0x48 - 0x4f
|
||||
"\u0026\u0060\u00EA\u00EB\u00E8\u00ED\u00EE\u00EF" + // 0x50 - 0x57
|
||||
"\u00EC\u00DF\u00A4\u00C5\u002A\u0029\u003B\u005E" + // 0x58 - 0x5f
|
||||
"\u002D\u002F\u00C2\u0023\u00C0\u00C1\u00C3\u0024" + // 0x60 - 0x67
|
||||
"\u00C7\u00D1\u00F6\u002C\u0025\u005F\u003E\u003F" + // 0x68 - 0x6f
|
||||
"\u00F8\\\u00CA\u00CB\u00C8\u00CD\u00CE\u00CF" + // 0x70 - 0x77
|
||||
"\u00CC\u00E9\u003A\u00C4\u00D6\'\u003D\"" ; // 0x78 - 0x7f
|
||||
|
||||
|
||||
private final static char[] b2c = b2cTable.toCharArray();
|
||||
private final static char[] c2b = new char[0x300];
|
||||
private final static char[] c2bIndex = new char[0x100];
|
||||
|
||||
static {
|
||||
char[] b2cMap = b2c;
|
||||
char[] c2bNR = null;
|
||||
// remove non-roundtrip entries
|
||||
b2cMap = b2cTable.toCharArray();
|
||||
b2cMap[165] = UNMAPPABLE_DECODING;
|
||||
|
||||
// non-roundtrip c2b only entries
|
||||
c2bNR = new char[2];
|
||||
c2bNR[0] = 0x15; c2bNR[1] = 0x85;
|
||||
|
||||
SingleByte.initC2B(b2cMap, c2bNR, c2b, c2bIndex);
|
||||
}
|
||||
}
|
||||
110
jdkSrc/jdk8/sun/nio/cs/ext/IBM1123.java
Normal file
110
jdkSrc/jdk8/sun/nio/cs/ext/IBM1123.java
Normal file
@@ -0,0 +1,110 @@
|
||||
/*
|
||||
* Copyright (c) 2008, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package sun.nio.cs.ext;
|
||||
|
||||
import java.nio.charset.Charset;
|
||||
import java.nio.charset.CharsetDecoder;
|
||||
import java.nio.charset.CharsetEncoder;
|
||||
import sun.nio.cs.StandardCharsets;
|
||||
import sun.nio.cs.SingleByte;
|
||||
import sun.nio.cs.HistoricallyNamedCharset;
|
||||
import static sun.nio.cs.CharsetMapping.*;
|
||||
|
||||
public class IBM1123 extends Charset implements HistoricallyNamedCharset
|
||||
{
|
||||
public IBM1123() {
|
||||
super("x-IBM1123", ExtendedCharsets.aliasesFor("x-IBM1123"));
|
||||
}
|
||||
|
||||
public String historicalName() {
|
||||
return "Cp1123";
|
||||
}
|
||||
|
||||
public boolean contains(Charset cs) {
|
||||
return (cs instanceof IBM1123);
|
||||
}
|
||||
|
||||
public CharsetDecoder newDecoder() {
|
||||
return new SingleByte.Decoder(this, b2c);
|
||||
}
|
||||
|
||||
public CharsetEncoder newEncoder() {
|
||||
return new SingleByte.Encoder(this, c2b, c2bIndex);
|
||||
}
|
||||
|
||||
private final static String b2cTable =
|
||||
"\u0446\u0061\u0062\u0063\u0064\u0065\u0066\u0067" + // 0x80 - 0x87
|
||||
"\u0068\u0069\u0434\u0435\u0444\u0433\u0445\u0438" + // 0x88 - 0x8f
|
||||
"\u0439\u006A\u006B\u006C\u006D\u006E\u006F\u0070" + // 0x90 - 0x97
|
||||
"\u0071\u0072\u043A\u043B\u043C\u043D\u043E\u043F" + // 0x98 - 0x9f
|
||||
"\u044F\u007E\u0073\u0074\u0075\u0076\u0077\u0078" + // 0xa0 - 0xa7
|
||||
"\u0079\u007A\u0440\u0441\u0442\u0443\u0436\u0432" + // 0xa8 - 0xaf
|
||||
"\u044C\u044B\u0437\u0448\u044D\u0449\u0447\u044A" + // 0xb0 - 0xb7
|
||||
"\u042E\u0410\u0411\u0426\u0414\u0415\u0424\u0413" + // 0xb8 - 0xbf
|
||||
"\u007B\u0041\u0042\u0043\u0044\u0045\u0046\u0047" + // 0xc0 - 0xc7
|
||||
"\u0048\u0049\u0425\u0418\u0419\u041A\u041B\u041C" + // 0xc8 - 0xcf
|
||||
"\u007D\u004A\u004B\u004C\u004D\u004E\u004F\u0050" + // 0xd0 - 0xd7
|
||||
"\u0051\u0052\u041D\u041E\u041F\u042F\u0420\u0421" + // 0xd8 - 0xdf
|
||||
"\\\u00A7\u0053\u0054\u0055\u0056\u0057\u0058" + // 0xe0 - 0xe7
|
||||
"\u0059\u005A\u0422\u0423\u0416\u0412\u042C\u042B" + // 0xe8 - 0xef
|
||||
"\u0030\u0031\u0032\u0033\u0034\u0035\u0036\u0037" + // 0xf0 - 0xf7
|
||||
"\u0038\u0039\u0417\u0428\u042D\u0429\u0427\u009F" + // 0xf8 - 0xff
|
||||
"\u0000\u0001\u0002\u0003\u009C\t\u0086\u007F" + // 0x00 - 0x07
|
||||
"\u0097\u008D\u008E\u000B\f\r\u000E\u000F" + // 0x08 - 0x0f
|
||||
"\u0010\u0011\u0012\u0013\u009D\n\b\u0087" + // 0x10 - 0x17
|
||||
"\u0018\u0019\u0092\u008F\u001C\u001D\u001E\u001F" + // 0x18 - 0x1f
|
||||
"\u0080\u0081\u0082\u0083\u0084\n\u0017\u001B" + // 0x20 - 0x27
|
||||
"\u0088\u0089\u008A\u008B\u008C\u0005\u0006\u0007" + // 0x28 - 0x2f
|
||||
"\u0090\u0091\u0016\u0093\u0094\u0095\u0096\u0004" + // 0x30 - 0x37
|
||||
"\u0098\u0099\u009A\u009B\u0014\u0015\u009E\u001A" + // 0x38 - 0x3f
|
||||
"\u0020\u00A0\u0452\u0491\u0451\u0454\u0455\u0456" + // 0x40 - 0x47
|
||||
"\u0457\u0458\u005B\u002E\u003C\u0028\u002B\u0021" + // 0x48 - 0x4f
|
||||
"\u0026\u0459\u045A\u045B\u045C\u045E\u045F\u042A" + // 0x50 - 0x57
|
||||
"\u2116\u0402\u005D\u0024\u002A\u0029\u003B\u005E" + // 0x58 - 0x5f
|
||||
"\u002D\u002F\u0490\u0401\u0404\u0405\u0406\u0407" + // 0x60 - 0x67
|
||||
"\u0408\u0409\u007C\u002C\u0025\u005F\u003E\u003F" + // 0x68 - 0x6f
|
||||
"\u040A\u040B\u040C\u00AD\u040E\u040F\u044E\u0430" + // 0x70 - 0x77
|
||||
"\u0431\u0060\u003A\u0023\u0040\'\u003D\"" ; // 0x78 - 0x7f
|
||||
|
||||
|
||||
private final static char[] b2c = b2cTable.toCharArray();
|
||||
private final static char[] c2b = new char[0x300];
|
||||
private final static char[] c2bIndex = new char[0x100];
|
||||
|
||||
static {
|
||||
char[] b2cMap = b2c;
|
||||
char[] c2bNR = null;
|
||||
// remove non-roundtrip entries
|
||||
b2cMap = b2cTable.toCharArray();
|
||||
b2cMap[165] = UNMAPPABLE_DECODING;
|
||||
|
||||
// non-roundtrip c2b only entries
|
||||
c2bNR = new char[2];
|
||||
c2bNR[0] = 0x15; c2bNR[1] = 0x85;
|
||||
|
||||
SingleByte.initC2B(b2cMap, c2bNR, c2b, c2bIndex);
|
||||
}
|
||||
}
|
||||
102
jdkSrc/jdk8/sun/nio/cs/ext/IBM1124.java
Normal file
102
jdkSrc/jdk8/sun/nio/cs/ext/IBM1124.java
Normal file
@@ -0,0 +1,102 @@
|
||||
/*
|
||||
* Copyright (c) 2008, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package sun.nio.cs.ext;
|
||||
|
||||
import java.nio.charset.Charset;
|
||||
import java.nio.charset.CharsetDecoder;
|
||||
import java.nio.charset.CharsetEncoder;
|
||||
import sun.nio.cs.StandardCharsets;
|
||||
import sun.nio.cs.SingleByte;
|
||||
import sun.nio.cs.HistoricallyNamedCharset;
|
||||
import static sun.nio.cs.CharsetMapping.*;
|
||||
|
||||
public class IBM1124 extends Charset implements HistoricallyNamedCharset
|
||||
{
|
||||
public IBM1124() {
|
||||
super("x-IBM1124", ExtendedCharsets.aliasesFor("x-IBM1124"));
|
||||
}
|
||||
|
||||
public String historicalName() {
|
||||
return "Cp1124";
|
||||
}
|
||||
|
||||
public boolean contains(Charset cs) {
|
||||
return (cs instanceof IBM1124);
|
||||
}
|
||||
|
||||
public CharsetDecoder newDecoder() {
|
||||
return new SingleByte.Decoder(this, b2c);
|
||||
}
|
||||
|
||||
public CharsetEncoder newEncoder() {
|
||||
return new SingleByte.Encoder(this, c2b, c2bIndex);
|
||||
}
|
||||
|
||||
private final static String b2cTable =
|
||||
"\u0080\u0081\u0082\u0083\u0084\u0085\u0086\u0087" + // 0x80 - 0x87
|
||||
"\u0088\u0089\u008A\u008B\u008C\u008D\u008E\u008F" + // 0x88 - 0x8f
|
||||
"\u0090\u0091\u0092\u0093\u0094\u0095\u0096\u0097" + // 0x90 - 0x97
|
||||
"\u0098\u0099\u009A\u009B\u009C\u009D\u009E\u009F" + // 0x98 - 0x9f
|
||||
"\u00A0\u0401\u0402\u0490\u0404\u0405\u0406\u0407" + // 0xa0 - 0xa7
|
||||
"\u0408\u0409\u040A\u040B\u040C\u00AD\u040E\u040F" + // 0xa8 - 0xaf
|
||||
"\u0410\u0411\u0412\u0413\u0414\u0415\u0416\u0417" + // 0xb0 - 0xb7
|
||||
"\u0418\u0419\u041A\u041B\u041C\u041D\u041E\u041F" + // 0xb8 - 0xbf
|
||||
"\u0420\u0421\u0422\u0423\u0424\u0425\u0426\u0427" + // 0xc0 - 0xc7
|
||||
"\u0428\u0429\u042A\u042B\u042C\u042D\u042E\u042F" + // 0xc8 - 0xcf
|
||||
"\u0430\u0431\u0432\u0433\u0434\u0435\u0436\u0437" + // 0xd0 - 0xd7
|
||||
"\u0438\u0439\u043A\u043B\u043C\u043D\u043E\u043F" + // 0xd8 - 0xdf
|
||||
"\u0440\u0441\u0442\u0443\u0444\u0445\u0446\u0447" + // 0xe0 - 0xe7
|
||||
"\u0448\u0449\u044A\u044B\u044C\u044D\u044E\u044F" + // 0xe8 - 0xef
|
||||
"\u2116\u0451\u0452\u0491\u0454\u0455\u0456\u0457" + // 0xf0 - 0xf7
|
||||
"\u0458\u0459\u045A\u045B\u045C\u00A7\u045E\u045F" + // 0xf8 - 0xff
|
||||
"\u0000\u0001\u0002\u0003\u0004\u0005\u0006\u0007" + // 0x00 - 0x07
|
||||
"\b\t\n\u000B\f\r\u000E\u000F" + // 0x08 - 0x0f
|
||||
"\u0010\u0011\u0012\u0013\u0014\u0015\u0016\u0017" + // 0x10 - 0x17
|
||||
"\u0018\u0019\u001A\u001B\u001C\u001D\u001E\u001F" + // 0x18 - 0x1f
|
||||
"\u0020\u0021\"\u0023\u0024\u0025\u0026\'" + // 0x20 - 0x27
|
||||
"\u0028\u0029\u002A\u002B\u002C\u002D\u002E\u002F" + // 0x28 - 0x2f
|
||||
"\u0030\u0031\u0032\u0033\u0034\u0035\u0036\u0037" + // 0x30 - 0x37
|
||||
"\u0038\u0039\u003A\u003B\u003C\u003D\u003E\u003F" + // 0x38 - 0x3f
|
||||
"\u0040\u0041\u0042\u0043\u0044\u0045\u0046\u0047" + // 0x40 - 0x47
|
||||
"\u0048\u0049\u004A\u004B\u004C\u004D\u004E\u004F" + // 0x48 - 0x4f
|
||||
"\u0050\u0051\u0052\u0053\u0054\u0055\u0056\u0057" + // 0x50 - 0x57
|
||||
"\u0058\u0059\u005A\u005B\\\u005D\u005E\u005F" + // 0x58 - 0x5f
|
||||
"\u0060\u0061\u0062\u0063\u0064\u0065\u0066\u0067" + // 0x60 - 0x67
|
||||
"\u0068\u0069\u006A\u006B\u006C\u006D\u006E\u006F" + // 0x68 - 0x6f
|
||||
"\u0070\u0071\u0072\u0073\u0074\u0075\u0076\u0077" + // 0x70 - 0x77
|
||||
"\u0078\u0079\u007A\u007B\u007C\u007D\u007E\u007F" ; // 0x78 - 0x7f
|
||||
|
||||
|
||||
private final static char[] b2c = b2cTable.toCharArray();
|
||||
private final static char[] c2b = new char[0x300];
|
||||
private final static char[] c2bIndex = new char[0x100];
|
||||
|
||||
static {
|
||||
char[] b2cMap = b2c;
|
||||
char[] c2bNR = null;
|
||||
SingleByte.initC2B(b2cMap, c2bNR, c2b, c2bIndex);
|
||||
}
|
||||
}
|
||||
106
jdkSrc/jdk8/sun/nio/cs/ext/IBM1140.java
Normal file
106
jdkSrc/jdk8/sun/nio/cs/ext/IBM1140.java
Normal file
@@ -0,0 +1,106 @@
|
||||
/*
|
||||
* Copyright (c) 2008, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package sun.nio.cs.ext;
|
||||
|
||||
import java.nio.charset.Charset;
|
||||
import java.nio.charset.CharsetDecoder;
|
||||
import java.nio.charset.CharsetEncoder;
|
||||
import sun.nio.cs.StandardCharsets;
|
||||
import sun.nio.cs.SingleByte;
|
||||
import sun.nio.cs.HistoricallyNamedCharset;
|
||||
import static sun.nio.cs.CharsetMapping.*;
|
||||
|
||||
public class IBM1140 extends Charset implements HistoricallyNamedCharset
|
||||
{
|
||||
public IBM1140() {
|
||||
super("IBM01140", ExtendedCharsets.aliasesFor("IBM01140"));
|
||||
}
|
||||
|
||||
public String historicalName() {
|
||||
return "Cp1140";
|
||||
}
|
||||
|
||||
public boolean contains(Charset cs) {
|
||||
return (cs instanceof IBM1140);
|
||||
}
|
||||
|
||||
public CharsetDecoder newDecoder() {
|
||||
return new SingleByte.Decoder(this, b2c);
|
||||
}
|
||||
|
||||
public CharsetEncoder newEncoder() {
|
||||
return new SingleByte.Encoder(this, c2b, c2bIndex);
|
||||
}
|
||||
|
||||
private final static String b2cTable =
|
||||
"\u00D8\u0061\u0062\u0063\u0064\u0065\u0066\u0067" + // 0x80 - 0x87
|
||||
"\u0068\u0069\u00AB\u00BB\u00F0\u00FD\u00FE\u00B1" + // 0x88 - 0x8f
|
||||
"\u00B0\u006A\u006B\u006C\u006D\u006E\u006F\u0070" + // 0x90 - 0x97
|
||||
"\u0071\u0072\u00AA\u00BA\u00E6\u00B8\u00C6\u20AC" + // 0x98 - 0x9f
|
||||
"\u00B5\u007E\u0073\u0074\u0075\u0076\u0077\u0078" + // 0xa0 - 0xa7
|
||||
"\u0079\u007A\u00A1\u00BF\u00D0\u00DD\u00DE\u00AE" + // 0xa8 - 0xaf
|
||||
"\u005E\u00A3\u00A5\u00B7\u00A9\u00A7\u00B6\u00BC" + // 0xb0 - 0xb7
|
||||
"\u00BD\u00BE\u005B\u005D\u00AF\u00A8\u00B4\u00D7" + // 0xb8 - 0xbf
|
||||
"\u007B\u0041\u0042\u0043\u0044\u0045\u0046\u0047" + // 0xc0 - 0xc7
|
||||
"\u0048\u0049\u00AD\u00F4\u00F6\u00F2\u00F3\u00F5" + // 0xc8 - 0xcf
|
||||
"\u007D\u004A\u004B\u004C\u004D\u004E\u004F\u0050" + // 0xd0 - 0xd7
|
||||
"\u0051\u0052\u00B9\u00FB\u00FC\u00F9\u00FA\u00FF" + // 0xd8 - 0xdf
|
||||
"\\\u00F7\u0053\u0054\u0055\u0056\u0057\u0058" + // 0xe0 - 0xe7
|
||||
"\u0059\u005A\u00B2\u00D4\u00D6\u00D2\u00D3\u00D5" + // 0xe8 - 0xef
|
||||
"\u0030\u0031\u0032\u0033\u0034\u0035\u0036\u0037" + // 0xf0 - 0xf7
|
||||
"\u0038\u0039\u00B3\u00DB\u00DC\u00D9\u00DA\u009F" + // 0xf8 - 0xff
|
||||
"\u0000\u0001\u0002\u0003\u009C\t\u0086\u007F" + // 0x00 - 0x07
|
||||
"\u0097\u008D\u008E\u000B\f\r\u000E\u000F" + // 0x08 - 0x0f
|
||||
"\u0010\u0011\u0012\u0013\u009D\n\b\u0087" + // 0x10 - 0x17
|
||||
"\u0018\u0019\u0092\u008F\u001C\u001D\u001E\u001F" + // 0x18 - 0x1f
|
||||
"\u0080\u0081\u0082\u0083\u0084\n\u0017\u001B" + // 0x20 - 0x27
|
||||
"\u0088\u0089\u008A\u008B\u008C\u0005\u0006\u0007" + // 0x28 - 0x2f
|
||||
"\u0090\u0091\u0016\u0093\u0094\u0095\u0096\u0004" + // 0x30 - 0x37
|
||||
"\u0098\u0099\u009A\u009B\u0014\u0015\u009E\u001A" + // 0x38 - 0x3f
|
||||
"\u0020\u00A0\u00E2\u00E4\u00E0\u00E1\u00E3\u00E5" + // 0x40 - 0x47
|
||||
"\u00E7\u00F1\u00A2\u002E\u003C\u0028\u002B\u007C" + // 0x48 - 0x4f
|
||||
"\u0026\u00E9\u00EA\u00EB\u00E8\u00ED\u00EE\u00EF" + // 0x50 - 0x57
|
||||
"\u00EC\u00DF\u0021\u0024\u002A\u0029\u003B\u00AC" + // 0x58 - 0x5f
|
||||
"\u002D\u002F\u00C2\u00C4\u00C0\u00C1\u00C3\u00C5" + // 0x60 - 0x67
|
||||
"\u00C7\u00D1\u00A6\u002C\u0025\u005F\u003E\u003F" + // 0x68 - 0x6f
|
||||
"\u00F8\u00C9\u00CA\u00CB\u00C8\u00CD\u00CE\u00CF" + // 0x70 - 0x77
|
||||
"\u00CC\u0060\u003A\u0023\u0040\'\u003D\"" ; // 0x78 - 0x7f
|
||||
|
||||
|
||||
private final static char[] b2c = b2cTable.toCharArray();
|
||||
private final static char[] c2b = new char[0x200];
|
||||
private final static char[] c2bIndex = new char[0x100];
|
||||
|
||||
static {
|
||||
char[] b2cMap = b2c;
|
||||
char[] c2bNR = null;
|
||||
// non-roundtrip c2b only entries
|
||||
c2bNR = new char[2];
|
||||
c2bNR[0] = 0x15; c2bNR[1] = 0x85;
|
||||
|
||||
SingleByte.initC2B(b2cMap, c2bNR, c2b, c2bIndex);
|
||||
}
|
||||
}
|
||||
106
jdkSrc/jdk8/sun/nio/cs/ext/IBM1141.java
Normal file
106
jdkSrc/jdk8/sun/nio/cs/ext/IBM1141.java
Normal file
@@ -0,0 +1,106 @@
|
||||
/*
|
||||
* Copyright (c) 2008, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package sun.nio.cs.ext;
|
||||
|
||||
import java.nio.charset.Charset;
|
||||
import java.nio.charset.CharsetDecoder;
|
||||
import java.nio.charset.CharsetEncoder;
|
||||
import sun.nio.cs.StandardCharsets;
|
||||
import sun.nio.cs.SingleByte;
|
||||
import sun.nio.cs.HistoricallyNamedCharset;
|
||||
import static sun.nio.cs.CharsetMapping.*;
|
||||
|
||||
public class IBM1141 extends Charset implements HistoricallyNamedCharset
|
||||
{
|
||||
public IBM1141() {
|
||||
super("IBM01141", ExtendedCharsets.aliasesFor("IBM01141"));
|
||||
}
|
||||
|
||||
public String historicalName() {
|
||||
return "Cp1141";
|
||||
}
|
||||
|
||||
public boolean contains(Charset cs) {
|
||||
return (cs instanceof IBM1141);
|
||||
}
|
||||
|
||||
public CharsetDecoder newDecoder() {
|
||||
return new SingleByte.Decoder(this, b2c);
|
||||
}
|
||||
|
||||
public CharsetEncoder newEncoder() {
|
||||
return new SingleByte.Encoder(this, c2b, c2bIndex);
|
||||
}
|
||||
|
||||
private final static String b2cTable =
|
||||
"\u00D8\u0061\u0062\u0063\u0064\u0065\u0066\u0067" + // 0x80 - 0x87
|
||||
"\u0068\u0069\u00AB\u00BB\u00F0\u00FD\u00FE\u00B1" + // 0x88 - 0x8f
|
||||
"\u00B0\u006A\u006B\u006C\u006D\u006E\u006F\u0070" + // 0x90 - 0x97
|
||||
"\u0071\u0072\u00AA\u00BA\u00E6\u00B8\u00C6\u20AC" + // 0x98 - 0x9f
|
||||
"\u00B5\u00DF\u0073\u0074\u0075\u0076\u0077\u0078" + // 0xa0 - 0xa7
|
||||
"\u0079\u007A\u00A1\u00BF\u00D0\u00DD\u00DE\u00AE" + // 0xa8 - 0xaf
|
||||
"\u00A2\u00A3\u00A5\u00B7\u00A9\u0040\u00B6\u00BC" + // 0xb0 - 0xb7
|
||||
"\u00BD\u00BE\u00AC\u007C\u00AF\u00A8\u00B4\u00D7" + // 0xb8 - 0xbf
|
||||
"\u00E4\u0041\u0042\u0043\u0044\u0045\u0046\u0047" + // 0xc0 - 0xc7
|
||||
"\u0048\u0049\u00AD\u00F4\u00A6\u00F2\u00F3\u00F5" + // 0xc8 - 0xcf
|
||||
"\u00FC\u004A\u004B\u004C\u004D\u004E\u004F\u0050" + // 0xd0 - 0xd7
|
||||
"\u0051\u0052\u00B9\u00FB\u007D\u00F9\u00FA\u00FF" + // 0xd8 - 0xdf
|
||||
"\u00D6\u00F7\u0053\u0054\u0055\u0056\u0057\u0058" + // 0xe0 - 0xe7
|
||||
"\u0059\u005A\u00B2\u00D4\\\u00D2\u00D3\u00D5" + // 0xe8 - 0xef
|
||||
"\u0030\u0031\u0032\u0033\u0034\u0035\u0036\u0037" + // 0xf0 - 0xf7
|
||||
"\u0038\u0039\u00B3\u00DB\u005D\u00D9\u00DA\u009F" + // 0xf8 - 0xff
|
||||
"\u0000\u0001\u0002\u0003\u009C\t\u0086\u007F" + // 0x00 - 0x07
|
||||
"\u0097\u008D\u008E\u000B\f\r\u000E\u000F" + // 0x08 - 0x0f
|
||||
"\u0010\u0011\u0012\u0013\u009D\n\b\u0087" + // 0x10 - 0x17
|
||||
"\u0018\u0019\u0092\u008F\u001C\u001D\u001E\u001F" + // 0x18 - 0x1f
|
||||
"\u0080\u0081\u0082\u0083\u0084\n\u0017\u001B" + // 0x20 - 0x27
|
||||
"\u0088\u0089\u008A\u008B\u008C\u0005\u0006\u0007" + // 0x28 - 0x2f
|
||||
"\u0090\u0091\u0016\u0093\u0094\u0095\u0096\u0004" + // 0x30 - 0x37
|
||||
"\u0098\u0099\u009A\u009B\u0014\u0015\u009E\u001A" + // 0x38 - 0x3f
|
||||
"\u0020\u00A0\u00E2\u007B\u00E0\u00E1\u00E3\u00E5" + // 0x40 - 0x47
|
||||
"\u00E7\u00F1\u00C4\u002E\u003C\u0028\u002B\u0021" + // 0x48 - 0x4f
|
||||
"\u0026\u00E9\u00EA\u00EB\u00E8\u00ED\u00EE\u00EF" + // 0x50 - 0x57
|
||||
"\u00EC\u007E\u00DC\u0024\u002A\u0029\u003B\u005E" + // 0x58 - 0x5f
|
||||
"\u002D\u002F\u00C2\u005B\u00C0\u00C1\u00C3\u00C5" + // 0x60 - 0x67
|
||||
"\u00C7\u00D1\u00F6\u002C\u0025\u005F\u003E\u003F" + // 0x68 - 0x6f
|
||||
"\u00F8\u00C9\u00CA\u00CB\u00C8\u00CD\u00CE\u00CF" + // 0x70 - 0x77
|
||||
"\u00CC\u0060\u003A\u0023\u00A7\'\u003D\"" ; // 0x78 - 0x7f
|
||||
|
||||
|
||||
private final static char[] b2c = b2cTable.toCharArray();
|
||||
private final static char[] c2b = new char[0x200];
|
||||
private final static char[] c2bIndex = new char[0x100];
|
||||
|
||||
static {
|
||||
char[] b2cMap = b2c;
|
||||
char[] c2bNR = null;
|
||||
// non-roundtrip c2b only entries
|
||||
c2bNR = new char[2];
|
||||
c2bNR[0] = 0x15; c2bNR[1] = 0x85;
|
||||
|
||||
SingleByte.initC2B(b2cMap, c2bNR, c2b, c2bIndex);
|
||||
}
|
||||
}
|
||||
106
jdkSrc/jdk8/sun/nio/cs/ext/IBM1142.java
Normal file
106
jdkSrc/jdk8/sun/nio/cs/ext/IBM1142.java
Normal file
@@ -0,0 +1,106 @@
|
||||
/*
|
||||
* Copyright (c) 2008, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package sun.nio.cs.ext;
|
||||
|
||||
import java.nio.charset.Charset;
|
||||
import java.nio.charset.CharsetDecoder;
|
||||
import java.nio.charset.CharsetEncoder;
|
||||
import sun.nio.cs.StandardCharsets;
|
||||
import sun.nio.cs.SingleByte;
|
||||
import sun.nio.cs.HistoricallyNamedCharset;
|
||||
import static sun.nio.cs.CharsetMapping.*;
|
||||
|
||||
public class IBM1142 extends Charset implements HistoricallyNamedCharset
|
||||
{
|
||||
public IBM1142() {
|
||||
super("IBM01142", ExtendedCharsets.aliasesFor("IBM01142"));
|
||||
}
|
||||
|
||||
public String historicalName() {
|
||||
return "Cp1142";
|
||||
}
|
||||
|
||||
public boolean contains(Charset cs) {
|
||||
return (cs instanceof IBM1142);
|
||||
}
|
||||
|
||||
public CharsetDecoder newDecoder() {
|
||||
return new SingleByte.Decoder(this, b2c);
|
||||
}
|
||||
|
||||
public CharsetEncoder newEncoder() {
|
||||
return new SingleByte.Encoder(this, c2b, c2bIndex);
|
||||
}
|
||||
|
||||
private final static String b2cTable =
|
||||
"\u0040\u0061\u0062\u0063\u0064\u0065\u0066\u0067" + // 0x80 - 0x87
|
||||
"\u0068\u0069\u00AB\u00BB\u00F0\u00FD\u00FE\u00B1" + // 0x88 - 0x8f
|
||||
"\u00B0\u006A\u006B\u006C\u006D\u006E\u006F\u0070" + // 0x90 - 0x97
|
||||
"\u0071\u0072\u00AA\u00BA\u007B\u00B8\u005B\u005D" + // 0x98 - 0x9f
|
||||
"\u00B5\u00FC\u0073\u0074\u0075\u0076\u0077\u0078" + // 0xa0 - 0xa7
|
||||
"\u0079\u007A\u00A1\u00BF\u00D0\u00DD\u00DE\u00AE" + // 0xa8 - 0xaf
|
||||
"\u00A2\u00A3\u00A5\u00B7\u00A9\u00A7\u00B6\u00BC" + // 0xb0 - 0xb7
|
||||
"\u00BD\u00BE\u00AC\u007C\u00AF\u00A8\u00B4\u00D7" + // 0xb8 - 0xbf
|
||||
"\u00E6\u0041\u0042\u0043\u0044\u0045\u0046\u0047" + // 0xc0 - 0xc7
|
||||
"\u0048\u0049\u00AD\u00F4\u00F6\u00F2\u00F3\u00F5" + // 0xc8 - 0xcf
|
||||
"\u00E5\u004A\u004B\u004C\u004D\u004E\u004F\u0050" + // 0xd0 - 0xd7
|
||||
"\u0051\u0052\u00B9\u00FB\u007E\u00F9\u00FA\u00FF" + // 0xd8 - 0xdf
|
||||
"\\\u00F7\u0053\u0054\u0055\u0056\u0057\u0058" + // 0xe0 - 0xe7
|
||||
"\u0059\u005A\u00B2\u00D4\u00D6\u00D2\u00D3\u00D5" + // 0xe8 - 0xef
|
||||
"\u0030\u0031\u0032\u0033\u0034\u0035\u0036\u0037" + // 0xf0 - 0xf7
|
||||
"\u0038\u0039\u00B3\u00DB\u00DC\u00D9\u00DA\u009F" + // 0xf8 - 0xff
|
||||
"\u0000\u0001\u0002\u0003\u009C\t\u0086\u007F" + // 0x00 - 0x07
|
||||
"\u0097\u008D\u008E\u000B\f\r\u000E\u000F" + // 0x08 - 0x0f
|
||||
"\u0010\u0011\u0012\u0013\u009D\n\b\u0087" + // 0x10 - 0x17
|
||||
"\u0018\u0019\u0092\u008F\u001C\u001D\u001E\u001F" + // 0x18 - 0x1f
|
||||
"\u0080\u0081\u0082\u0083\u0084\n\u0017\u001B" + // 0x20 - 0x27
|
||||
"\u0088\u0089\u008A\u008B\u008C\u0005\u0006\u0007" + // 0x28 - 0x2f
|
||||
"\u0090\u0091\u0016\u0093\u0094\u0095\u0096\u0004" + // 0x30 - 0x37
|
||||
"\u0098\u0099\u009A\u009B\u0014\u0015\u009E\u001A" + // 0x38 - 0x3f
|
||||
"\u0020\u00A0\u00E2\u00E4\u00E0\u00E1\u00E3\u007D" + // 0x40 - 0x47
|
||||
"\u00E7\u00F1\u0023\u002E\u003C\u0028\u002B\u0021" + // 0x48 - 0x4f
|
||||
"\u0026\u00E9\u00EA\u00EB\u00E8\u00ED\u00EE\u00EF" + // 0x50 - 0x57
|
||||
"\u00EC\u00DF\u20AC\u00C5\u002A\u0029\u003B\u005E" + // 0x58 - 0x5f
|
||||
"\u002D\u002F\u00C2\u00C4\u00C0\u00C1\u00C3\u0024" + // 0x60 - 0x67
|
||||
"\u00C7\u00D1\u00F8\u002C\u0025\u005F\u003E\u003F" + // 0x68 - 0x6f
|
||||
"\u00A6\u00C9\u00CA\u00CB\u00C8\u00CD\u00CE\u00CF" + // 0x70 - 0x77
|
||||
"\u00CC\u0060\u003A\u00C6\u00D8\'\u003D\"" ; // 0x78 - 0x7f
|
||||
|
||||
|
||||
private final static char[] b2c = b2cTable.toCharArray();
|
||||
private final static char[] c2b = new char[0x200];
|
||||
private final static char[] c2bIndex = new char[0x100];
|
||||
|
||||
static {
|
||||
char[] b2cMap = b2c;
|
||||
char[] c2bNR = null;
|
||||
// non-roundtrip c2b only entries
|
||||
c2bNR = new char[2];
|
||||
c2bNR[0] = 0x15; c2bNR[1] = 0x85;
|
||||
|
||||
SingleByte.initC2B(b2cMap, c2bNR, c2b, c2bIndex);
|
||||
}
|
||||
}
|
||||
106
jdkSrc/jdk8/sun/nio/cs/ext/IBM1143.java
Normal file
106
jdkSrc/jdk8/sun/nio/cs/ext/IBM1143.java
Normal file
@@ -0,0 +1,106 @@
|
||||
/*
|
||||
* Copyright (c) 2008, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package sun.nio.cs.ext;
|
||||
|
||||
import java.nio.charset.Charset;
|
||||
import java.nio.charset.CharsetDecoder;
|
||||
import java.nio.charset.CharsetEncoder;
|
||||
import sun.nio.cs.StandardCharsets;
|
||||
import sun.nio.cs.SingleByte;
|
||||
import sun.nio.cs.HistoricallyNamedCharset;
|
||||
import static sun.nio.cs.CharsetMapping.*;
|
||||
|
||||
public class IBM1143 extends Charset implements HistoricallyNamedCharset
|
||||
{
|
||||
public IBM1143() {
|
||||
super("IBM01143", ExtendedCharsets.aliasesFor("IBM01143"));
|
||||
}
|
||||
|
||||
public String historicalName() {
|
||||
return "Cp1143";
|
||||
}
|
||||
|
||||
public boolean contains(Charset cs) {
|
||||
return (cs instanceof IBM1143);
|
||||
}
|
||||
|
||||
public CharsetDecoder newDecoder() {
|
||||
return new SingleByte.Decoder(this, b2c);
|
||||
}
|
||||
|
||||
public CharsetEncoder newEncoder() {
|
||||
return new SingleByte.Encoder(this, c2b, c2bIndex);
|
||||
}
|
||||
|
||||
private final static String b2cTable =
|
||||
"\u00D8\u0061\u0062\u0063\u0064\u0065\u0066\u0067" + // 0x80 - 0x87
|
||||
"\u0068\u0069\u00AB\u00BB\u00F0\u00FD\u00FE\u00B1" + // 0x88 - 0x8f
|
||||
"\u00B0\u006A\u006B\u006C\u006D\u006E\u006F\u0070" + // 0x90 - 0x97
|
||||
"\u0071\u0072\u00AA\u00BA\u00E6\u00B8\u00C6\u005D" + // 0x98 - 0x9f
|
||||
"\u00B5\u00FC\u0073\u0074\u0075\u0076\u0077\u0078" + // 0xa0 - 0xa7
|
||||
"\u0079\u007A\u00A1\u00BF\u00D0\u00DD\u00DE\u00AE" + // 0xa8 - 0xaf
|
||||
"\u00A2\u00A3\u00A5\u00B7\u00A9\u005B\u00B6\u00BC" + // 0xb0 - 0xb7
|
||||
"\u00BD\u00BE\u00AC\u007C\u00AF\u00A8\u00B4\u00D7" + // 0xb8 - 0xbf
|
||||
"\u00E4\u0041\u0042\u0043\u0044\u0045\u0046\u0047" + // 0xc0 - 0xc7
|
||||
"\u0048\u0049\u00AD\u00F4\u00A6\u00F2\u00F3\u00F5" + // 0xc8 - 0xcf
|
||||
"\u00E5\u004A\u004B\u004C\u004D\u004E\u004F\u0050" + // 0xd0 - 0xd7
|
||||
"\u0051\u0052\u00B9\u00FB\u007E\u00F9\u00FA\u00FF" + // 0xd8 - 0xdf
|
||||
"\u00C9\u00F7\u0053\u0054\u0055\u0056\u0057\u0058" + // 0xe0 - 0xe7
|
||||
"\u0059\u005A\u00B2\u00D4\u0040\u00D2\u00D3\u00D5" + // 0xe8 - 0xef
|
||||
"\u0030\u0031\u0032\u0033\u0034\u0035\u0036\u0037" + // 0xf0 - 0xf7
|
||||
"\u0038\u0039\u00B3\u00DB\u00DC\u00D9\u00DA\u009F" + // 0xf8 - 0xff
|
||||
"\u0000\u0001\u0002\u0003\u009C\t\u0086\u007F" + // 0x00 - 0x07
|
||||
"\u0097\u008D\u008E\u000B\f\r\u000E\u000F" + // 0x08 - 0x0f
|
||||
"\u0010\u0011\u0012\u0013\u009D\n\b\u0087" + // 0x10 - 0x17
|
||||
"\u0018\u0019\u0092\u008F\u001C\u001D\u001E\u001F" + // 0x18 - 0x1f
|
||||
"\u0080\u0081\u0082\u0083\u0084\n\u0017\u001B" + // 0x20 - 0x27
|
||||
"\u0088\u0089\u008A\u008B\u008C\u0005\u0006\u0007" + // 0x28 - 0x2f
|
||||
"\u0090\u0091\u0016\u0093\u0094\u0095\u0096\u0004" + // 0x30 - 0x37
|
||||
"\u0098\u0099\u009A\u009B\u0014\u0015\u009E\u001A" + // 0x38 - 0x3f
|
||||
"\u0020\u00A0\u00E2\u007B\u00E0\u00E1\u00E3\u007D" + // 0x40 - 0x47
|
||||
"\u00E7\u00F1\u00A7\u002E\u003C\u0028\u002B\u0021" + // 0x48 - 0x4f
|
||||
"\u0026\u0060\u00EA\u00EB\u00E8\u00ED\u00EE\u00EF" + // 0x50 - 0x57
|
||||
"\u00EC\u00DF\u20AC\u00C5\u002A\u0029\u003B\u005E" + // 0x58 - 0x5f
|
||||
"\u002D\u002F\u00C2\u0023\u00C0\u00C1\u00C3\u0024" + // 0x60 - 0x67
|
||||
"\u00C7\u00D1\u00F6\u002C\u0025\u005F\u003E\u003F" + // 0x68 - 0x6f
|
||||
"\u00F8\\\u00CA\u00CB\u00C8\u00CD\u00CE\u00CF" + // 0x70 - 0x77
|
||||
"\u00CC\u00E9\u003A\u00C4\u00D6\'\u003D\"" ; // 0x78 - 0x7f
|
||||
|
||||
|
||||
private final static char[] b2c = b2cTable.toCharArray();
|
||||
private final static char[] c2b = new char[0x200];
|
||||
private final static char[] c2bIndex = new char[0x100];
|
||||
|
||||
static {
|
||||
char[] b2cMap = b2c;
|
||||
char[] c2bNR = null;
|
||||
// non-roundtrip c2b only entries
|
||||
c2bNR = new char[2];
|
||||
c2bNR[0] = 0x15; c2bNR[1] = 0x85;
|
||||
|
||||
SingleByte.initC2B(b2cMap, c2bNR, c2b, c2bIndex);
|
||||
}
|
||||
}
|
||||
106
jdkSrc/jdk8/sun/nio/cs/ext/IBM1144.java
Normal file
106
jdkSrc/jdk8/sun/nio/cs/ext/IBM1144.java
Normal file
@@ -0,0 +1,106 @@
|
||||
/*
|
||||
* Copyright (c) 2008, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package sun.nio.cs.ext;
|
||||
|
||||
import java.nio.charset.Charset;
|
||||
import java.nio.charset.CharsetDecoder;
|
||||
import java.nio.charset.CharsetEncoder;
|
||||
import sun.nio.cs.StandardCharsets;
|
||||
import sun.nio.cs.SingleByte;
|
||||
import sun.nio.cs.HistoricallyNamedCharset;
|
||||
import static sun.nio.cs.CharsetMapping.*;
|
||||
|
||||
public class IBM1144 extends Charset implements HistoricallyNamedCharset
|
||||
{
|
||||
public IBM1144() {
|
||||
super("IBM01144", ExtendedCharsets.aliasesFor("IBM01144"));
|
||||
}
|
||||
|
||||
public String historicalName() {
|
||||
return "Cp1144";
|
||||
}
|
||||
|
||||
public boolean contains(Charset cs) {
|
||||
return (cs instanceof IBM1144);
|
||||
}
|
||||
|
||||
public CharsetDecoder newDecoder() {
|
||||
return new SingleByte.Decoder(this, b2c);
|
||||
}
|
||||
|
||||
public CharsetEncoder newEncoder() {
|
||||
return new SingleByte.Encoder(this, c2b, c2bIndex);
|
||||
}
|
||||
|
||||
private final static String b2cTable =
|
||||
"\u00D8\u0061\u0062\u0063\u0064\u0065\u0066\u0067" + // 0x80 - 0x87
|
||||
"\u0068\u0069\u00AB\u00BB\u00F0\u00FD\u00FE\u00B1" + // 0x88 - 0x8f
|
||||
"\u005B\u006A\u006B\u006C\u006D\u006E\u006F\u0070" + // 0x90 - 0x97
|
||||
"\u0071\u0072\u00AA\u00BA\u00E6\u00B8\u00C6\u20AC" + // 0x98 - 0x9f
|
||||
"\u00B5\u00EC\u0073\u0074\u0075\u0076\u0077\u0078" + // 0xa0 - 0xa7
|
||||
"\u0079\u007A\u00A1\u00BF\u00D0\u00DD\u00DE\u00AE" + // 0xa8 - 0xaf
|
||||
"\u00A2\u0023\u00A5\u00B7\u00A9\u0040\u00B6\u00BC" + // 0xb0 - 0xb7
|
||||
"\u00BD\u00BE\u00AC\u007C\u00AF\u00A8\u00B4\u00D7" + // 0xb8 - 0xbf
|
||||
"\u00E0\u0041\u0042\u0043\u0044\u0045\u0046\u0047" + // 0xc0 - 0xc7
|
||||
"\u0048\u0049\u00AD\u00F4\u00F6\u00A6\u00F3\u00F5" + // 0xc8 - 0xcf
|
||||
"\u00E8\u004A\u004B\u004C\u004D\u004E\u004F\u0050" + // 0xd0 - 0xd7
|
||||
"\u0051\u0052\u00B9\u00FB\u00FC\u0060\u00FA\u00FF" + // 0xd8 - 0xdf
|
||||
"\u00E7\u00F7\u0053\u0054\u0055\u0056\u0057\u0058" + // 0xe0 - 0xe7
|
||||
"\u0059\u005A\u00B2\u00D4\u00D6\u00D2\u00D3\u00D5" + // 0xe8 - 0xef
|
||||
"\u0030\u0031\u0032\u0033\u0034\u0035\u0036\u0037" + // 0xf0 - 0xf7
|
||||
"\u0038\u0039\u00B3\u00DB\u00DC\u00D9\u00DA\u009F" + // 0xf8 - 0xff
|
||||
"\u0000\u0001\u0002\u0003\u009C\t\u0086\u007F" + // 0x00 - 0x07
|
||||
"\u0097\u008D\u008E\u000B\f\r\u000E\u000F" + // 0x08 - 0x0f
|
||||
"\u0010\u0011\u0012\u0013\u009D\n\b\u0087" + // 0x10 - 0x17
|
||||
"\u0018\u0019\u0092\u008F\u001C\u001D\u001E\u001F" + // 0x18 - 0x1f
|
||||
"\u0080\u0081\u0082\u0083\u0084\n\u0017\u001B" + // 0x20 - 0x27
|
||||
"\u0088\u0089\u008A\u008B\u008C\u0005\u0006\u0007" + // 0x28 - 0x2f
|
||||
"\u0090\u0091\u0016\u0093\u0094\u0095\u0096\u0004" + // 0x30 - 0x37
|
||||
"\u0098\u0099\u009A\u009B\u0014\u0015\u009E\u001A" + // 0x38 - 0x3f
|
||||
"\u0020\u00A0\u00E2\u00E4\u007B\u00E1\u00E3\u00E5" + // 0x40 - 0x47
|
||||
"\\\u00F1\u00B0\u002E\u003C\u0028\u002B\u0021" + // 0x48 - 0x4f
|
||||
"\u0026\u005D\u00EA\u00EB\u007D\u00ED\u00EE\u00EF" + // 0x50 - 0x57
|
||||
"\u007E\u00DF\u00E9\u0024\u002A\u0029\u003B\u005E" + // 0x58 - 0x5f
|
||||
"\u002D\u002F\u00C2\u00C4\u00C0\u00C1\u00C3\u00C5" + // 0x60 - 0x67
|
||||
"\u00C7\u00D1\u00F2\u002C\u0025\u005F\u003E\u003F" + // 0x68 - 0x6f
|
||||
"\u00F8\u00C9\u00CA\u00CB\u00C8\u00CD\u00CE\u00CF" + // 0x70 - 0x77
|
||||
"\u00CC\u00F9\u003A\u00A3\u00A7\'\u003D\"" ; // 0x78 - 0x7f
|
||||
|
||||
|
||||
private final static char[] b2c = b2cTable.toCharArray();
|
||||
private final static char[] c2b = new char[0x200];
|
||||
private final static char[] c2bIndex = new char[0x100];
|
||||
|
||||
static {
|
||||
char[] b2cMap = b2c;
|
||||
char[] c2bNR = null;
|
||||
// non-roundtrip c2b only entries
|
||||
c2bNR = new char[2];
|
||||
c2bNR[0] = 0x15; c2bNR[1] = 0x85;
|
||||
|
||||
SingleByte.initC2B(b2cMap, c2bNR, c2b, c2bIndex);
|
||||
}
|
||||
}
|
||||
106
jdkSrc/jdk8/sun/nio/cs/ext/IBM1145.java
Normal file
106
jdkSrc/jdk8/sun/nio/cs/ext/IBM1145.java
Normal file
@@ -0,0 +1,106 @@
|
||||
/*
|
||||
* Copyright (c) 2008, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package sun.nio.cs.ext;
|
||||
|
||||
import java.nio.charset.Charset;
|
||||
import java.nio.charset.CharsetDecoder;
|
||||
import java.nio.charset.CharsetEncoder;
|
||||
import sun.nio.cs.StandardCharsets;
|
||||
import sun.nio.cs.SingleByte;
|
||||
import sun.nio.cs.HistoricallyNamedCharset;
|
||||
import static sun.nio.cs.CharsetMapping.*;
|
||||
|
||||
public class IBM1145 extends Charset implements HistoricallyNamedCharset
|
||||
{
|
||||
public IBM1145() {
|
||||
super("IBM01145", ExtendedCharsets.aliasesFor("IBM01145"));
|
||||
}
|
||||
|
||||
public String historicalName() {
|
||||
return "Cp1145";
|
||||
}
|
||||
|
||||
public boolean contains(Charset cs) {
|
||||
return (cs instanceof IBM1145);
|
||||
}
|
||||
|
||||
public CharsetDecoder newDecoder() {
|
||||
return new SingleByte.Decoder(this, b2c);
|
||||
}
|
||||
|
||||
public CharsetEncoder newEncoder() {
|
||||
return new SingleByte.Encoder(this, c2b, c2bIndex);
|
||||
}
|
||||
|
||||
private final static String b2cTable =
|
||||
"\u00D8\u0061\u0062\u0063\u0064\u0065\u0066\u0067" + // 0x80 - 0x87
|
||||
"\u0068\u0069\u00AB\u00BB\u00F0\u00FD\u00FE\u00B1" + // 0x88 - 0x8f
|
||||
"\u00B0\u006A\u006B\u006C\u006D\u006E\u006F\u0070" + // 0x90 - 0x97
|
||||
"\u0071\u0072\u00AA\u00BA\u00E6\u00B8\u00C6\u20AC" + // 0x98 - 0x9f
|
||||
"\u00B5\u00A8\u0073\u0074\u0075\u0076\u0077\u0078" + // 0xa0 - 0xa7
|
||||
"\u0079\u007A\u00A1\u00BF\u00D0\u00DD\u00DE\u00AE" + // 0xa8 - 0xaf
|
||||
"\u00A2\u00A3\u00A5\u00B7\u00A9\u00A7\u00B6\u00BC" + // 0xb0 - 0xb7
|
||||
"\u00BD\u00BE\u005E\u0021\u00AF\u007E\u00B4\u00D7" + // 0xb8 - 0xbf
|
||||
"\u007B\u0041\u0042\u0043\u0044\u0045\u0046\u0047" + // 0xc0 - 0xc7
|
||||
"\u0048\u0049\u00AD\u00F4\u00F6\u00F2\u00F3\u00F5" + // 0xc8 - 0xcf
|
||||
"\u007D\u004A\u004B\u004C\u004D\u004E\u004F\u0050" + // 0xd0 - 0xd7
|
||||
"\u0051\u0052\u00B9\u00FB\u00FC\u00F9\u00FA\u00FF" + // 0xd8 - 0xdf
|
||||
"\\\u00F7\u0053\u0054\u0055\u0056\u0057\u0058" + // 0xe0 - 0xe7
|
||||
"\u0059\u005A\u00B2\u00D4\u00D6\u00D2\u00D3\u00D5" + // 0xe8 - 0xef
|
||||
"\u0030\u0031\u0032\u0033\u0034\u0035\u0036\u0037" + // 0xf0 - 0xf7
|
||||
"\u0038\u0039\u00B3\u00DB\u00DC\u00D9\u00DA\u009F" + // 0xf8 - 0xff
|
||||
"\u0000\u0001\u0002\u0003\u009C\t\u0086\u007F" + // 0x00 - 0x07
|
||||
"\u0097\u008D\u008E\u000B\f\r\u000E\u000F" + // 0x08 - 0x0f
|
||||
"\u0010\u0011\u0012\u0013\u009D\n\b\u0087" + // 0x10 - 0x17
|
||||
"\u0018\u0019\u0092\u008F\u001C\u001D\u001E\u001F" + // 0x18 - 0x1f
|
||||
"\u0080\u0081\u0082\u0083\u0084\n\u0017\u001B" + // 0x20 - 0x27
|
||||
"\u0088\u0089\u008A\u008B\u008C\u0005\u0006\u0007" + // 0x28 - 0x2f
|
||||
"\u0090\u0091\u0016\u0093\u0094\u0095\u0096\u0004" + // 0x30 - 0x37
|
||||
"\u0098\u0099\u009A\u009B\u0014\u0015\u009E\u001A" + // 0x38 - 0x3f
|
||||
"\u0020\u00A0\u00E2\u00E4\u00E0\u00E1\u00E3\u00E5" + // 0x40 - 0x47
|
||||
"\u00E7\u00A6\u005B\u002E\u003C\u0028\u002B\u007C" + // 0x48 - 0x4f
|
||||
"\u0026\u00E9\u00EA\u00EB\u00E8\u00ED\u00EE\u00EF" + // 0x50 - 0x57
|
||||
"\u00EC\u00DF\u005D\u0024\u002A\u0029\u003B\u00AC" + // 0x58 - 0x5f
|
||||
"\u002D\u002F\u00C2\u00C4\u00C0\u00C1\u00C3\u00C5" + // 0x60 - 0x67
|
||||
"\u00C7\u0023\u00F1\u002C\u0025\u005F\u003E\u003F" + // 0x68 - 0x6f
|
||||
"\u00F8\u00C9\u00CA\u00CB\u00C8\u00CD\u00CE\u00CF" + // 0x70 - 0x77
|
||||
"\u00CC\u0060\u003A\u00D1\u0040\'\u003D\"" ; // 0x78 - 0x7f
|
||||
|
||||
|
||||
private final static char[] b2c = b2cTable.toCharArray();
|
||||
private final static char[] c2b = new char[0x200];
|
||||
private final static char[] c2bIndex = new char[0x100];
|
||||
|
||||
static {
|
||||
char[] b2cMap = b2c;
|
||||
char[] c2bNR = null;
|
||||
// non-roundtrip c2b only entries
|
||||
c2bNR = new char[2];
|
||||
c2bNR[0] = 0x15; c2bNR[1] = 0x85;
|
||||
|
||||
SingleByte.initC2B(b2cMap, c2bNR, c2b, c2bIndex);
|
||||
}
|
||||
}
|
||||
106
jdkSrc/jdk8/sun/nio/cs/ext/IBM1146.java
Normal file
106
jdkSrc/jdk8/sun/nio/cs/ext/IBM1146.java
Normal file
@@ -0,0 +1,106 @@
|
||||
/*
|
||||
* Copyright (c) 2008, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package sun.nio.cs.ext;
|
||||
|
||||
import java.nio.charset.Charset;
|
||||
import java.nio.charset.CharsetDecoder;
|
||||
import java.nio.charset.CharsetEncoder;
|
||||
import sun.nio.cs.StandardCharsets;
|
||||
import sun.nio.cs.SingleByte;
|
||||
import sun.nio.cs.HistoricallyNamedCharset;
|
||||
import static sun.nio.cs.CharsetMapping.*;
|
||||
|
||||
public class IBM1146 extends Charset implements HistoricallyNamedCharset
|
||||
{
|
||||
public IBM1146() {
|
||||
super("IBM01146", ExtendedCharsets.aliasesFor("IBM01146"));
|
||||
}
|
||||
|
||||
public String historicalName() {
|
||||
return "Cp1146";
|
||||
}
|
||||
|
||||
public boolean contains(Charset cs) {
|
||||
return (cs instanceof IBM1146);
|
||||
}
|
||||
|
||||
public CharsetDecoder newDecoder() {
|
||||
return new SingleByte.Decoder(this, b2c);
|
||||
}
|
||||
|
||||
public CharsetEncoder newEncoder() {
|
||||
return new SingleByte.Encoder(this, c2b, c2bIndex);
|
||||
}
|
||||
|
||||
private final static String b2cTable =
|
||||
"\u00D8\u0061\u0062\u0063\u0064\u0065\u0066\u0067" + // 0x80 - 0x87
|
||||
"\u0068\u0069\u00AB\u00BB\u00F0\u00FD\u00FE\u00B1" + // 0x88 - 0x8f
|
||||
"\u00B0\u006A\u006B\u006C\u006D\u006E\u006F\u0070" + // 0x90 - 0x97
|
||||
"\u0071\u0072\u00AA\u00BA\u00E6\u00B8\u00C6\u20AC" + // 0x98 - 0x9f
|
||||
"\u00B5\u00AF\u0073\u0074\u0075\u0076\u0077\u0078" + // 0xa0 - 0xa7
|
||||
"\u0079\u007A\u00A1\u00BF\u00D0\u00DD\u00DE\u00AE" + // 0xa8 - 0xaf
|
||||
"\u00A2\u005B\u00A5\u00B7\u00A9\u00A7\u00B6\u00BC" + // 0xb0 - 0xb7
|
||||
"\u00BD\u00BE\u005E\u005D\u007E\u00A8\u00B4\u00D7" + // 0xb8 - 0xbf
|
||||
"\u007B\u0041\u0042\u0043\u0044\u0045\u0046\u0047" + // 0xc0 - 0xc7
|
||||
"\u0048\u0049\u00AD\u00F4\u00F6\u00F2\u00F3\u00F5" + // 0xc8 - 0xcf
|
||||
"\u007D\u004A\u004B\u004C\u004D\u004E\u004F\u0050" + // 0xd0 - 0xd7
|
||||
"\u0051\u0052\u00B9\u00FB\u00FC\u00F9\u00FA\u00FF" + // 0xd8 - 0xdf
|
||||
"\\\u00F7\u0053\u0054\u0055\u0056\u0057\u0058" + // 0xe0 - 0xe7
|
||||
"\u0059\u005A\u00B2\u00D4\u00D6\u00D2\u00D3\u00D5" + // 0xe8 - 0xef
|
||||
"\u0030\u0031\u0032\u0033\u0034\u0035\u0036\u0037" + // 0xf0 - 0xf7
|
||||
"\u0038\u0039\u00B3\u00DB\u00DC\u00D9\u00DA\u009F" + // 0xf8 - 0xff
|
||||
"\u0000\u0001\u0002\u0003\u009C\t\u0086\u007F" + // 0x00 - 0x07
|
||||
"\u0097\u008D\u008E\u000B\f\r\u000E\u000F" + // 0x08 - 0x0f
|
||||
"\u0010\u0011\u0012\u0013\u009D\n\b\u0087" + // 0x10 - 0x17
|
||||
"\u0018\u0019\u0092\u008F\u001C\u001D\u001E\u001F" + // 0x18 - 0x1f
|
||||
"\u0080\u0081\u0082\u0083\u0084\n\u0017\u001B" + // 0x20 - 0x27
|
||||
"\u0088\u0089\u008A\u008B\u008C\u0005\u0006\u0007" + // 0x28 - 0x2f
|
||||
"\u0090\u0091\u0016\u0093\u0094\u0095\u0096\u0004" + // 0x30 - 0x37
|
||||
"\u0098\u0099\u009A\u009B\u0014\u0015\u009E\u001A" + // 0x38 - 0x3f
|
||||
"\u0020\u00A0\u00E2\u00E4\u00E0\u00E1\u00E3\u00E5" + // 0x40 - 0x47
|
||||
"\u00E7\u00F1\u0024\u002E\u003C\u0028\u002B\u007C" + // 0x48 - 0x4f
|
||||
"\u0026\u00E9\u00EA\u00EB\u00E8\u00ED\u00EE\u00EF" + // 0x50 - 0x57
|
||||
"\u00EC\u00DF\u0021\u00A3\u002A\u0029\u003B\u00AC" + // 0x58 - 0x5f
|
||||
"\u002D\u002F\u00C2\u00C4\u00C0\u00C1\u00C3\u00C5" + // 0x60 - 0x67
|
||||
"\u00C7\u00D1\u00A6\u002C\u0025\u005F\u003E\u003F" + // 0x68 - 0x6f
|
||||
"\u00F8\u00C9\u00CA\u00CB\u00C8\u00CD\u00CE\u00CF" + // 0x70 - 0x77
|
||||
"\u00CC\u0060\u003A\u0023\u0040\'\u003D\"" ; // 0x78 - 0x7f
|
||||
|
||||
|
||||
private final static char[] b2c = b2cTable.toCharArray();
|
||||
private final static char[] c2b = new char[0x200];
|
||||
private final static char[] c2bIndex = new char[0x100];
|
||||
|
||||
static {
|
||||
char[] b2cMap = b2c;
|
||||
char[] c2bNR = null;
|
||||
// non-roundtrip c2b only entries
|
||||
c2bNR = new char[2];
|
||||
c2bNR[0] = 0x15; c2bNR[1] = 0x85;
|
||||
|
||||
SingleByte.initC2B(b2cMap, c2bNR, c2b, c2bIndex);
|
||||
}
|
||||
}
|
||||
106
jdkSrc/jdk8/sun/nio/cs/ext/IBM1147.java
Normal file
106
jdkSrc/jdk8/sun/nio/cs/ext/IBM1147.java
Normal file
@@ -0,0 +1,106 @@
|
||||
/*
|
||||
* Copyright (c) 2008, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package sun.nio.cs.ext;
|
||||
|
||||
import java.nio.charset.Charset;
|
||||
import java.nio.charset.CharsetDecoder;
|
||||
import java.nio.charset.CharsetEncoder;
|
||||
import sun.nio.cs.StandardCharsets;
|
||||
import sun.nio.cs.SingleByte;
|
||||
import sun.nio.cs.HistoricallyNamedCharset;
|
||||
import static sun.nio.cs.CharsetMapping.*;
|
||||
|
||||
public class IBM1147 extends Charset implements HistoricallyNamedCharset
|
||||
{
|
||||
public IBM1147() {
|
||||
super("IBM01147", ExtendedCharsets.aliasesFor("IBM01147"));
|
||||
}
|
||||
|
||||
public String historicalName() {
|
||||
return "Cp1147";
|
||||
}
|
||||
|
||||
public boolean contains(Charset cs) {
|
||||
return (cs instanceof IBM1147);
|
||||
}
|
||||
|
||||
public CharsetDecoder newDecoder() {
|
||||
return new SingleByte.Decoder(this, b2c);
|
||||
}
|
||||
|
||||
public CharsetEncoder newEncoder() {
|
||||
return new SingleByte.Encoder(this, c2b, c2bIndex);
|
||||
}
|
||||
|
||||
private final static String b2cTable =
|
||||
"\u00D8\u0061\u0062\u0063\u0064\u0065\u0066\u0067" + // 0x80 - 0x87
|
||||
"\u0068\u0069\u00AB\u00BB\u00F0\u00FD\u00FE\u00B1" + // 0x88 - 0x8f
|
||||
"\u005B\u006A\u006B\u006C\u006D\u006E\u006F\u0070" + // 0x90 - 0x97
|
||||
"\u0071\u0072\u00AA\u00BA\u00E6\u00B8\u00C6\u20AC" + // 0x98 - 0x9f
|
||||
"\u0060\u00A8\u0073\u0074\u0075\u0076\u0077\u0078" + // 0xa0 - 0xa7
|
||||
"\u0079\u007A\u00A1\u00BF\u00D0\u00DD\u00DE\u00AE" + // 0xa8 - 0xaf
|
||||
"\u00A2\u0023\u00A5\u00B7\u00A9\u005D\u00B6\u00BC" + // 0xb0 - 0xb7
|
||||
"\u00BD\u00BE\u00AC\u007C\u00AF\u007E\u00B4\u00D7" + // 0xb8 - 0xbf
|
||||
"\u00E9\u0041\u0042\u0043\u0044\u0045\u0046\u0047" + // 0xc0 - 0xc7
|
||||
"\u0048\u0049\u00AD\u00F4\u00F6\u00F2\u00F3\u00F5" + // 0xc8 - 0xcf
|
||||
"\u00E8\u004A\u004B\u004C\u004D\u004E\u004F\u0050" + // 0xd0 - 0xd7
|
||||
"\u0051\u0052\u00B9\u00FB\u00FC\u00A6\u00FA\u00FF" + // 0xd8 - 0xdf
|
||||
"\u00E7\u00F7\u0053\u0054\u0055\u0056\u0057\u0058" + // 0xe0 - 0xe7
|
||||
"\u0059\u005A\u00B2\u00D4\u00D6\u00D2\u00D3\u00D5" + // 0xe8 - 0xef
|
||||
"\u0030\u0031\u0032\u0033\u0034\u0035\u0036\u0037" + // 0xf0 - 0xf7
|
||||
"\u0038\u0039\u00B3\u00DB\u00DC\u00D9\u00DA\u009F" + // 0xf8 - 0xff
|
||||
"\u0000\u0001\u0002\u0003\u009C\t\u0086\u007F" + // 0x00 - 0x07
|
||||
"\u0097\u008D\u008E\u000B\f\r\u000E\u000F" + // 0x08 - 0x0f
|
||||
"\u0010\u0011\u0012\u0013\u009D\n\b\u0087" + // 0x10 - 0x17
|
||||
"\u0018\u0019\u0092\u008F\u001C\u001D\u001E\u001F" + // 0x18 - 0x1f
|
||||
"\u0080\u0081\u0082\u0083\u0084\n\u0017\u001B" + // 0x20 - 0x27
|
||||
"\u0088\u0089\u008A\u008B\u008C\u0005\u0006\u0007" + // 0x28 - 0x2f
|
||||
"\u0090\u0091\u0016\u0093\u0094\u0095\u0096\u0004" + // 0x30 - 0x37
|
||||
"\u0098\u0099\u009A\u009B\u0014\u0015\u009E\u001A" + // 0x38 - 0x3f
|
||||
"\u0020\u00A0\u00E2\u00E4\u0040\u00E1\u00E3\u00E5" + // 0x40 - 0x47
|
||||
"\\\u00F1\u00B0\u002E\u003C\u0028\u002B\u0021" + // 0x48 - 0x4f
|
||||
"\u0026\u007B\u00EA\u00EB\u007D\u00ED\u00EE\u00EF" + // 0x50 - 0x57
|
||||
"\u00EC\u00DF\u00A7\u0024\u002A\u0029\u003B\u005E" + // 0x58 - 0x5f
|
||||
"\u002D\u002F\u00C2\u00C4\u00C0\u00C1\u00C3\u00C5" + // 0x60 - 0x67
|
||||
"\u00C7\u00D1\u00F9\u002C\u0025\u005F\u003E\u003F" + // 0x68 - 0x6f
|
||||
"\u00F8\u00C9\u00CA\u00CB\u00C8\u00CD\u00CE\u00CF" + // 0x70 - 0x77
|
||||
"\u00CC\u00B5\u003A\u00A3\u00E0\'\u003D\"" ; // 0x78 - 0x7f
|
||||
|
||||
|
||||
private final static char[] b2c = b2cTable.toCharArray();
|
||||
private final static char[] c2b = new char[0x200];
|
||||
private final static char[] c2bIndex = new char[0x100];
|
||||
|
||||
static {
|
||||
char[] b2cMap = b2c;
|
||||
char[] c2bNR = null;
|
||||
// non-roundtrip c2b only entries
|
||||
c2bNR = new char[2];
|
||||
c2bNR[0] = 0x15; c2bNR[1] = 0x85;
|
||||
|
||||
SingleByte.initC2B(b2cMap, c2bNR, c2b, c2bIndex);
|
||||
}
|
||||
}
|
||||
106
jdkSrc/jdk8/sun/nio/cs/ext/IBM1148.java
Normal file
106
jdkSrc/jdk8/sun/nio/cs/ext/IBM1148.java
Normal file
@@ -0,0 +1,106 @@
|
||||
/*
|
||||
* Copyright (c) 2008, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package sun.nio.cs.ext;
|
||||
|
||||
import java.nio.charset.Charset;
|
||||
import java.nio.charset.CharsetDecoder;
|
||||
import java.nio.charset.CharsetEncoder;
|
||||
import sun.nio.cs.StandardCharsets;
|
||||
import sun.nio.cs.SingleByte;
|
||||
import sun.nio.cs.HistoricallyNamedCharset;
|
||||
import static sun.nio.cs.CharsetMapping.*;
|
||||
|
||||
public class IBM1148 extends Charset implements HistoricallyNamedCharset
|
||||
{
|
||||
public IBM1148() {
|
||||
super("IBM01148", ExtendedCharsets.aliasesFor("IBM01148"));
|
||||
}
|
||||
|
||||
public String historicalName() {
|
||||
return "Cp1148";
|
||||
}
|
||||
|
||||
public boolean contains(Charset cs) {
|
||||
return (cs instanceof IBM1148);
|
||||
}
|
||||
|
||||
public CharsetDecoder newDecoder() {
|
||||
return new SingleByte.Decoder(this, b2c);
|
||||
}
|
||||
|
||||
public CharsetEncoder newEncoder() {
|
||||
return new SingleByte.Encoder(this, c2b, c2bIndex);
|
||||
}
|
||||
|
||||
private final static String b2cTable =
|
||||
"\u00D8\u0061\u0062\u0063\u0064\u0065\u0066\u0067" + // 0x80 - 0x87
|
||||
"\u0068\u0069\u00AB\u00BB\u00F0\u00FD\u00FE\u00B1" + // 0x88 - 0x8f
|
||||
"\u00B0\u006A\u006B\u006C\u006D\u006E\u006F\u0070" + // 0x90 - 0x97
|
||||
"\u0071\u0072\u00AA\u00BA\u00E6\u00B8\u00C6\u20AC" + // 0x98 - 0x9f
|
||||
"\u00B5\u007E\u0073\u0074\u0075\u0076\u0077\u0078" + // 0xa0 - 0xa7
|
||||
"\u0079\u007A\u00A1\u00BF\u00D0\u00DD\u00DE\u00AE" + // 0xa8 - 0xaf
|
||||
"\u00A2\u00A3\u00A5\u00B7\u00A9\u00A7\u00B6\u00BC" + // 0xb0 - 0xb7
|
||||
"\u00BD\u00BE\u00AC\u007C\u00AF\u00A8\u00B4\u00D7" + // 0xb8 - 0xbf
|
||||
"\u007B\u0041\u0042\u0043\u0044\u0045\u0046\u0047" + // 0xc0 - 0xc7
|
||||
"\u0048\u0049\u00AD\u00F4\u00F6\u00F2\u00F3\u00F5" + // 0xc8 - 0xcf
|
||||
"\u007D\u004A\u004B\u004C\u004D\u004E\u004F\u0050" + // 0xd0 - 0xd7
|
||||
"\u0051\u0052\u00B9\u00FB\u00FC\u00F9\u00FA\u00FF" + // 0xd8 - 0xdf
|
||||
"\\\u00F7\u0053\u0054\u0055\u0056\u0057\u0058" + // 0xe0 - 0xe7
|
||||
"\u0059\u005A\u00B2\u00D4\u00D6\u00D2\u00D3\u00D5" + // 0xe8 - 0xef
|
||||
"\u0030\u0031\u0032\u0033\u0034\u0035\u0036\u0037" + // 0xf0 - 0xf7
|
||||
"\u0038\u0039\u00B3\u00DB\u00DC\u00D9\u00DA\u009F" + // 0xf8 - 0xff
|
||||
"\u0000\u0001\u0002\u0003\u009C\t\u0086\u007F" + // 0x00 - 0x07
|
||||
"\u0097\u008D\u008E\u000B\f\r\u000E\u000F" + // 0x08 - 0x0f
|
||||
"\u0010\u0011\u0012\u0013\u009D\n\b\u0087" + // 0x10 - 0x17
|
||||
"\u0018\u0019\u0092\u008F\u001C\u001D\u001E\u001F" + // 0x18 - 0x1f
|
||||
"\u0080\u0081\u0082\u0083\u0084\n\u0017\u001B" + // 0x20 - 0x27
|
||||
"\u0088\u0089\u008A\u008B\u008C\u0005\u0006\u0007" + // 0x28 - 0x2f
|
||||
"\u0090\u0091\u0016\u0093\u0094\u0095\u0096\u0004" + // 0x30 - 0x37
|
||||
"\u0098\u0099\u009A\u009B\u0014\u0015\u009E\u001A" + // 0x38 - 0x3f
|
||||
"\u0020\u00A0\u00E2\u00E4\u00E0\u00E1\u00E3\u00E5" + // 0x40 - 0x47
|
||||
"\u00E7\u00F1\u005B\u002E\u003C\u0028\u002B\u0021" + // 0x48 - 0x4f
|
||||
"\u0026\u00E9\u00EA\u00EB\u00E8\u00ED\u00EE\u00EF" + // 0x50 - 0x57
|
||||
"\u00EC\u00DF\u005D\u0024\u002A\u0029\u003B\u005E" + // 0x58 - 0x5f
|
||||
"\u002D\u002F\u00C2\u00C4\u00C0\u00C1\u00C3\u00C5" + // 0x60 - 0x67
|
||||
"\u00C7\u00D1\u00A6\u002C\u0025\u005F\u003E\u003F" + // 0x68 - 0x6f
|
||||
"\u00F8\u00C9\u00CA\u00CB\u00C8\u00CD\u00CE\u00CF" + // 0x70 - 0x77
|
||||
"\u00CC\u0060\u003A\u0023\u0040\'\u003D\"" ; // 0x78 - 0x7f
|
||||
|
||||
|
||||
private final static char[] b2c = b2cTable.toCharArray();
|
||||
private final static char[] c2b = new char[0x200];
|
||||
private final static char[] c2bIndex = new char[0x100];
|
||||
|
||||
static {
|
||||
char[] b2cMap = b2c;
|
||||
char[] c2bNR = null;
|
||||
// non-roundtrip c2b only entries
|
||||
c2bNR = new char[2];
|
||||
c2bNR[0] = 0x15; c2bNR[1] = 0x85;
|
||||
|
||||
SingleByte.initC2B(b2cMap, c2bNR, c2b, c2bIndex);
|
||||
}
|
||||
}
|
||||
106
jdkSrc/jdk8/sun/nio/cs/ext/IBM1149.java
Normal file
106
jdkSrc/jdk8/sun/nio/cs/ext/IBM1149.java
Normal file
@@ -0,0 +1,106 @@
|
||||
/*
|
||||
* Copyright (c) 2008, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package sun.nio.cs.ext;
|
||||
|
||||
import java.nio.charset.Charset;
|
||||
import java.nio.charset.CharsetDecoder;
|
||||
import java.nio.charset.CharsetEncoder;
|
||||
import sun.nio.cs.StandardCharsets;
|
||||
import sun.nio.cs.SingleByte;
|
||||
import sun.nio.cs.HistoricallyNamedCharset;
|
||||
import static sun.nio.cs.CharsetMapping.*;
|
||||
|
||||
public class IBM1149 extends Charset implements HistoricallyNamedCharset
|
||||
{
|
||||
public IBM1149() {
|
||||
super("IBM01149", ExtendedCharsets.aliasesFor("IBM01149"));
|
||||
}
|
||||
|
||||
public String historicalName() {
|
||||
return "Cp1149";
|
||||
}
|
||||
|
||||
public boolean contains(Charset cs) {
|
||||
return (cs instanceof IBM1149);
|
||||
}
|
||||
|
||||
public CharsetDecoder newDecoder() {
|
||||
return new SingleByte.Decoder(this, b2c);
|
||||
}
|
||||
|
||||
public CharsetEncoder newEncoder() {
|
||||
return new SingleByte.Encoder(this, c2b, c2bIndex);
|
||||
}
|
||||
|
||||
private final static String b2cTable =
|
||||
"\u00D8\u0061\u0062\u0063\u0064\u0065\u0066\u0067" + // 0x80 - 0x87
|
||||
"\u0068\u0069\u00AB\u00BB\u0060\u00FD\u007B\u00B1" + // 0x88 - 0x8f
|
||||
"\u00B0\u006A\u006B\u006C\u006D\u006E\u006F\u0070" + // 0x90 - 0x97
|
||||
"\u0071\u0072\u00AA\u00BA\u007D\u00B8\u005D\u20AC" + // 0x98 - 0x9f
|
||||
"\u00B5\u00F6\u0073\u0074\u0075\u0076\u0077\u0078" + // 0xa0 - 0xa7
|
||||
"\u0079\u007A\u00A1\u00BF\u0040\u00DD\u005B\u00AE" + // 0xa8 - 0xaf
|
||||
"\u00A2\u00A3\u00A5\u00B7\u00A9\u00A7\u00B6\u00BC" + // 0xb0 - 0xb7
|
||||
"\u00BD\u00BE\u00AC\u007C\u00AF\u00A8\\\u00D7" + // 0xb8 - 0xbf
|
||||
"\u00FE\u0041\u0042\u0043\u0044\u0045\u0046\u0047" + // 0xc0 - 0xc7
|
||||
"\u0048\u0049\u00AD\u00F4\u007E\u00F2\u00F3\u00F5" + // 0xc8 - 0xcf
|
||||
"\u00E6\u004A\u004B\u004C\u004D\u004E\u004F\u0050" + // 0xd0 - 0xd7
|
||||
"\u0051\u0052\u00B9\u00FB\u00FC\u00F9\u00FA\u00FF" + // 0xd8 - 0xdf
|
||||
"\u00B4\u00F7\u0053\u0054\u0055\u0056\u0057\u0058" + // 0xe0 - 0xe7
|
||||
"\u0059\u005A\u00B2\u00D4\u005E\u00D2\u00D3\u00D5" + // 0xe8 - 0xef
|
||||
"\u0030\u0031\u0032\u0033\u0034\u0035\u0036\u0037" + // 0xf0 - 0xf7
|
||||
"\u0038\u0039\u00B3\u00DB\u00DC\u00D9\u00DA\u009F" + // 0xf8 - 0xff
|
||||
"\u0000\u0001\u0002\u0003\u009C\t\u0086\u007F" + // 0x00 - 0x07
|
||||
"\u0097\u008D\u008E\u000B\f\r\u000E\u000F" + // 0x08 - 0x0f
|
||||
"\u0010\u0011\u0012\u0013\u009D\n\b\u0087" + // 0x10 - 0x17
|
||||
"\u0018\u0019\u0092\u008F\u001C\u001D\u001E\u001F" + // 0x18 - 0x1f
|
||||
"\u0080\u0081\u0082\u0083\u0084\n\u0017\u001B" + // 0x20 - 0x27
|
||||
"\u0088\u0089\u008A\u008B\u008C\u0005\u0006\u0007" + // 0x28 - 0x2f
|
||||
"\u0090\u0091\u0016\u0093\u0094\u0095\u0096\u0004" + // 0x30 - 0x37
|
||||
"\u0098\u0099\u009A\u009B\u0014\u0015\u009E\u001A" + // 0x38 - 0x3f
|
||||
"\u0020\u00A0\u00E2\u00E4\u00E0\u00E1\u00E3\u00E5" + // 0x40 - 0x47
|
||||
"\u00E7\u00F1\u00DE\u002E\u003C\u0028\u002B\u0021" + // 0x48 - 0x4f
|
||||
"\u0026\u00E9\u00EA\u00EB\u00E8\u00ED\u00EE\u00EF" + // 0x50 - 0x57
|
||||
"\u00EC\u00DF\u00C6\u0024\u002A\u0029\u003B\u00D6" + // 0x58 - 0x5f
|
||||
"\u002D\u002F\u00C2\u00C4\u00C0\u00C1\u00C3\u00C5" + // 0x60 - 0x67
|
||||
"\u00C7\u00D1\u00A6\u002C\u0025\u005F\u003E\u003F" + // 0x68 - 0x6f
|
||||
"\u00F8\u00C9\u00CA\u00CB\u00C8\u00CD\u00CE\u00CF" + // 0x70 - 0x77
|
||||
"\u00CC\u00F0\u003A\u0023\u00D0\'\u003D\"" ; // 0x78 - 0x7f
|
||||
|
||||
|
||||
private final static char[] b2c = b2cTable.toCharArray();
|
||||
private final static char[] c2b = new char[0x200];
|
||||
private final static char[] c2bIndex = new char[0x100];
|
||||
|
||||
static {
|
||||
char[] b2cMap = b2c;
|
||||
char[] c2bNR = null;
|
||||
// non-roundtrip c2b only entries
|
||||
c2bNR = new char[2];
|
||||
c2bNR[0] = 0x15; c2bNR[1] = 0x85;
|
||||
|
||||
SingleByte.initC2B(b2cMap, c2bNR, c2b, c2bIndex);
|
||||
}
|
||||
}
|
||||
110
jdkSrc/jdk8/sun/nio/cs/ext/IBM1166.java
Normal file
110
jdkSrc/jdk8/sun/nio/cs/ext/IBM1166.java
Normal file
@@ -0,0 +1,110 @@
|
||||
/*
|
||||
* Copyright (c) 2008, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package sun.nio.cs.ext;
|
||||
|
||||
import java.nio.charset.Charset;
|
||||
import java.nio.charset.CharsetDecoder;
|
||||
import java.nio.charset.CharsetEncoder;
|
||||
import sun.nio.cs.StandardCharsets;
|
||||
import sun.nio.cs.SingleByte;
|
||||
import sun.nio.cs.HistoricallyNamedCharset;
|
||||
import static sun.nio.cs.CharsetMapping.*;
|
||||
|
||||
public class IBM1166 extends Charset implements HistoricallyNamedCharset
|
||||
{
|
||||
public IBM1166() {
|
||||
super("x-IBM1166", ExtendedCharsets.aliasesFor("x-IBM1166"));
|
||||
}
|
||||
|
||||
public String historicalName() {
|
||||
return "Cp1166";
|
||||
}
|
||||
|
||||
public boolean contains(Charset cs) {
|
||||
return (cs instanceof IBM1166);
|
||||
}
|
||||
|
||||
public CharsetDecoder newDecoder() {
|
||||
return new SingleByte.Decoder(this, b2c);
|
||||
}
|
||||
|
||||
public CharsetEncoder newEncoder() {
|
||||
return new SingleByte.Encoder(this, c2b, c2bIndex);
|
||||
}
|
||||
|
||||
private final static String b2cTable =
|
||||
"\u0446\u0061\u0062\u0063\u0064\u0065\u0066\u0067" + // 0x80 - 0x87
|
||||
"\u0068\u0069\u0434\u0435\u0444\u0433\u0445\u0438" + // 0x88 - 0x8f
|
||||
"\u0439\u006A\u006B\u006C\u006D\u006E\u006F\u0070" + // 0x90 - 0x97
|
||||
"\u0071\u0072\u043A\u043B\u043C\u043D\u043E\u043F" + // 0x98 - 0x9f
|
||||
"\u044F\u007E\u0073\u0074\u0075\u0076\u0077\u0078" + // 0xa0 - 0xa7
|
||||
"\u0079\u007A\u0440\u0441\u0442\u0443\u0436\u0432" + // 0xa8 - 0xaf
|
||||
"\u044C\u044B\u0437\u0448\u044D\u0449\u0447\u044A" + // 0xb0 - 0xb7
|
||||
"\u042E\u0410\u0411\u0426\u0414\u0415\u0424\u0413" + // 0xb8 - 0xbf
|
||||
"\u007B\u0041\u0042\u0043\u0044\u0045\u0046\u0047" + // 0xc0 - 0xc7
|
||||
"\u0048\u0049\u0425\u0418\u0419\u041A\u041B\u041C" + // 0xc8 - 0xcf
|
||||
"\u007D\u004A\u004B\u004C\u004D\u004E\u004F\u0050" + // 0xd0 - 0xd7
|
||||
"\u0051\u0052\u041D\u041E\u041F\u042F\u0420\u0421" + // 0xd8 - 0xdf
|
||||
"\\\u20AC\u0053\u0054\u0055\u0056\u0057\u0058" + // 0xe0 - 0xe7
|
||||
"\u0059\u005A\u0422\u0423\u0416\u0412\u042C\u042B" + // 0xe8 - 0xef
|
||||
"\u0030\u0031\u0032\u0033\u0034\u0035\u0036\u0037" + // 0xf0 - 0xf7
|
||||
"\u0038\u0039\u0417\u0428\u042D\u0429\u0427\u009F" + // 0xf8 - 0xff
|
||||
"\u0000\u0001\u0002\u0003\u009C\t\u0086\u007F" + // 0x00 - 0x07
|
||||
"\u0097\u008D\u008E\u000B\f\r\u000E\u000F" + // 0x08 - 0x0f
|
||||
"\u0010\u0011\u0012\u0013\u009D\n\b\u0087" + // 0x10 - 0x17
|
||||
"\u0018\u0019\u0092\u008F\u001C\u001D\u001E\u001F" + // 0x18 - 0x1f
|
||||
"\u0080\u0081\u0082\u0083\u0084\n\u0017\u001B" + // 0x20 - 0x27
|
||||
"\u0088\u0089\u008A\u008B\u008C\u0005\u0006\u0007" + // 0x28 - 0x2f
|
||||
"\u0090\u0091\u0016\u0093\u0094\u0095\u0096\u0004" + // 0x30 - 0x37
|
||||
"\u0098\u0099\u009A\u009B\u0014\u0015\u009E\u001A" + // 0x38 - 0x3f
|
||||
"\u0020\u00A0\u04D9\u0493\u0451\u0454\u0455\u0456" + // 0x40 - 0x47
|
||||
"\u049B\u0458\u005B\u002E\u003C\u0028\u002B\u0021" + // 0x48 - 0x4f
|
||||
"\u0026\u04A3\u04E9\u04B1\u04AF\u045E\u04BB\u042A" + // 0x50 - 0x57
|
||||
"\u2116\u04D8\u005D\u0024\u002A\u0029\u003B\u005E" + // 0x58 - 0x5f
|
||||
"\u002D\u002F\u0492\u0401\u0404\u0405\u0406\u049A" + // 0x60 - 0x67
|
||||
"\u0408\u04A2\u007C\u002C\u0025\u005F\u003E\u003F" + // 0x68 - 0x6f
|
||||
"\u04E8\u04B0\u04AE\u00AD\u040E\u04BA\u044E\u0430" + // 0x70 - 0x77
|
||||
"\u0431\u0060\u003A\u0023\u0040\'\u003D\"" ; // 0x78 - 0x7f
|
||||
|
||||
|
||||
private final static char[] b2c = b2cTable.toCharArray();
|
||||
private final static char[] c2b = new char[0x400];
|
||||
private final static char[] c2bIndex = new char[0x100];
|
||||
|
||||
static {
|
||||
char[] b2cMap = b2c;
|
||||
char[] c2bNR = null;
|
||||
// remove non-roundtrip entries
|
||||
b2cMap = b2cTable.toCharArray();
|
||||
b2cMap[165] = UNMAPPABLE_DECODING;
|
||||
|
||||
// non-roundtrip c2b only entries
|
||||
c2bNR = new char[2];
|
||||
c2bNR[0] = 0x15; c2bNR[1] = 0x85;
|
||||
|
||||
SingleByte.initC2B(b2cMap, c2bNR, c2b, c2bIndex);
|
||||
}
|
||||
}
|
||||
3478
jdkSrc/jdk8/sun/nio/cs/ext/IBM1364.java
Normal file
3478
jdkSrc/jdk8/sun/nio/cs/ext/IBM1364.java
Normal file
File diff suppressed because it is too large
Load Diff
1517
jdkSrc/jdk8/sun/nio/cs/ext/IBM1381.java
Normal file
1517
jdkSrc/jdk8/sun/nio/cs/ext/IBM1381.java
Normal file
File diff suppressed because it is too large
Load Diff
1432
jdkSrc/jdk8/sun/nio/cs/ext/IBM1383.java
Normal file
1432
jdkSrc/jdk8/sun/nio/cs/ext/IBM1383.java
Normal file
File diff suppressed because it is too large
Load Diff
110
jdkSrc/jdk8/sun/nio/cs/ext/IBM273.java
Normal file
110
jdkSrc/jdk8/sun/nio/cs/ext/IBM273.java
Normal file
@@ -0,0 +1,110 @@
|
||||
/*
|
||||
* Copyright (c) 2008, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package sun.nio.cs.ext;
|
||||
|
||||
import java.nio.charset.Charset;
|
||||
import java.nio.charset.CharsetDecoder;
|
||||
import java.nio.charset.CharsetEncoder;
|
||||
import sun.nio.cs.StandardCharsets;
|
||||
import sun.nio.cs.SingleByte;
|
||||
import sun.nio.cs.HistoricallyNamedCharset;
|
||||
import static sun.nio.cs.CharsetMapping.*;
|
||||
|
||||
public class IBM273 extends Charset implements HistoricallyNamedCharset
|
||||
{
|
||||
public IBM273() {
|
||||
super("IBM273", ExtendedCharsets.aliasesFor("IBM273"));
|
||||
}
|
||||
|
||||
public String historicalName() {
|
||||
return "Cp273";
|
||||
}
|
||||
|
||||
public boolean contains(Charset cs) {
|
||||
return (cs instanceof IBM273);
|
||||
}
|
||||
|
||||
public CharsetDecoder newDecoder() {
|
||||
return new SingleByte.Decoder(this, b2c);
|
||||
}
|
||||
|
||||
public CharsetEncoder newEncoder() {
|
||||
return new SingleByte.Encoder(this, c2b, c2bIndex);
|
||||
}
|
||||
|
||||
private final static String b2cTable =
|
||||
"\u00D8\u0061\u0062\u0063\u0064\u0065\u0066\u0067" + // 0x80 - 0x87
|
||||
"\u0068\u0069\u00AB\u00BB\u00F0\u00FD\u00FE\u00B1" + // 0x88 - 0x8f
|
||||
"\u00B0\u006A\u006B\u006C\u006D\u006E\u006F\u0070" + // 0x90 - 0x97
|
||||
"\u0071\u0072\u00AA\u00BA\u00E6\u00B8\u00C6\u00A4" + // 0x98 - 0x9f
|
||||
"\u00B5\u00DF\u0073\u0074\u0075\u0076\u0077\u0078" + // 0xa0 - 0xa7
|
||||
"\u0079\u007A\u00A1\u00BF\u00D0\u00DD\u00DE\u00AE" + // 0xa8 - 0xaf
|
||||
"\u00A2\u00A3\u00A5\u00B7\u00A9\u0040\u00B6\u00BC" + // 0xb0 - 0xb7
|
||||
"\u00BD\u00BE\u00AC\u007C\u00AF\u00A8\u00B4\u00D7" + // 0xb8 - 0xbf
|
||||
"\u00E4\u0041\u0042\u0043\u0044\u0045\u0046\u0047" + // 0xc0 - 0xc7
|
||||
"\u0048\u0049\u00AD\u00F4\u00A6\u00F2\u00F3\u00F5" + // 0xc8 - 0xcf
|
||||
"\u00FC\u004A\u004B\u004C\u004D\u004E\u004F\u0050" + // 0xd0 - 0xd7
|
||||
"\u0051\u0052\u00B9\u00FB\u007D\u00F9\u00FA\u00FF" + // 0xd8 - 0xdf
|
||||
"\u00D6\u00F7\u0053\u0054\u0055\u0056\u0057\u0058" + // 0xe0 - 0xe7
|
||||
"\u0059\u005A\u00B2\u00D4\\\u00D2\u00D3\u00D5" + // 0xe8 - 0xef
|
||||
"\u0030\u0031\u0032\u0033\u0034\u0035\u0036\u0037" + // 0xf0 - 0xf7
|
||||
"\u0038\u0039\u00B3\u00DB\u005D\u00D9\u00DA\u009F" + // 0xf8 - 0xff
|
||||
"\u0000\u0001\u0002\u0003\u009C\t\u0086\u007F" + // 0x00 - 0x07
|
||||
"\u0097\u008D\u008E\u000B\f\r\u000E\u000F" + // 0x08 - 0x0f
|
||||
"\u0010\u0011\u0012\u0013\u009D\n\b\u0087" + // 0x10 - 0x17
|
||||
"\u0018\u0019\u0092\u008F\u001C\u001D\u001E\u001F" + // 0x18 - 0x1f
|
||||
"\u0080\u0081\u0082\u0083\u0084\n\u0017\u001B" + // 0x20 - 0x27
|
||||
"\u0088\u0089\u008A\u008B\u008C\u0005\u0006\u0007" + // 0x28 - 0x2f
|
||||
"\u0090\u0091\u0016\u0093\u0094\u0095\u0096\u0004" + // 0x30 - 0x37
|
||||
"\u0098\u0099\u009A\u009B\u0014\u0015\u009E\u001A" + // 0x38 - 0x3f
|
||||
"\u0020\u00A0\u00E2\u007B\u00E0\u00E1\u00E3\u00E5" + // 0x40 - 0x47
|
||||
"\u00E7\u00F1\u00C4\u002E\u003C\u0028\u002B\u0021" + // 0x48 - 0x4f
|
||||
"\u0026\u00E9\u00EA\u00EB\u00E8\u00ED\u00EE\u00EF" + // 0x50 - 0x57
|
||||
"\u00EC\u007E\u00DC\u0024\u002A\u0029\u003B\u005E" + // 0x58 - 0x5f
|
||||
"\u002D\u002F\u00C2\u005B\u00C0\u00C1\u00C3\u00C5" + // 0x60 - 0x67
|
||||
"\u00C7\u00D1\u00F6\u002C\u0025\u005F\u003E\u003F" + // 0x68 - 0x6f
|
||||
"\u00F8\u00C9\u00CA\u00CB\u00C8\u00CD\u00CE\u00CF" + // 0x70 - 0x77
|
||||
"\u00CC\u0060\u003A\u0023\u00A7\'\u003D\"" ; // 0x78 - 0x7f
|
||||
|
||||
|
||||
private final static char[] b2c = b2cTable.toCharArray();
|
||||
private final static char[] c2b = new char[0x100];
|
||||
private final static char[] c2bIndex = new char[0x100];
|
||||
|
||||
static {
|
||||
char[] b2cMap = b2c;
|
||||
char[] c2bNR = null;
|
||||
// remove non-roundtrip entries
|
||||
b2cMap = b2cTable.toCharArray();
|
||||
b2cMap[165] = UNMAPPABLE_DECODING;
|
||||
|
||||
// non-roundtrip c2b only entries
|
||||
c2bNR = new char[2];
|
||||
c2bNR[0] = 0x15; c2bNR[1] = 0x85;
|
||||
|
||||
SingleByte.initC2B(b2cMap, c2bNR, c2b, c2bIndex);
|
||||
}
|
||||
}
|
||||
110
jdkSrc/jdk8/sun/nio/cs/ext/IBM277.java
Normal file
110
jdkSrc/jdk8/sun/nio/cs/ext/IBM277.java
Normal file
@@ -0,0 +1,110 @@
|
||||
/*
|
||||
* Copyright (c) 2008, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package sun.nio.cs.ext;
|
||||
|
||||
import java.nio.charset.Charset;
|
||||
import java.nio.charset.CharsetDecoder;
|
||||
import java.nio.charset.CharsetEncoder;
|
||||
import sun.nio.cs.StandardCharsets;
|
||||
import sun.nio.cs.SingleByte;
|
||||
import sun.nio.cs.HistoricallyNamedCharset;
|
||||
import static sun.nio.cs.CharsetMapping.*;
|
||||
|
||||
public class IBM277 extends Charset implements HistoricallyNamedCharset
|
||||
{
|
||||
public IBM277() {
|
||||
super("IBM277", ExtendedCharsets.aliasesFor("IBM277"));
|
||||
}
|
||||
|
||||
public String historicalName() {
|
||||
return "Cp277";
|
||||
}
|
||||
|
||||
public boolean contains(Charset cs) {
|
||||
return (cs instanceof IBM277);
|
||||
}
|
||||
|
||||
public CharsetDecoder newDecoder() {
|
||||
return new SingleByte.Decoder(this, b2c);
|
||||
}
|
||||
|
||||
public CharsetEncoder newEncoder() {
|
||||
return new SingleByte.Encoder(this, c2b, c2bIndex);
|
||||
}
|
||||
|
||||
private final static String b2cTable =
|
||||
"\u0040\u0061\u0062\u0063\u0064\u0065\u0066\u0067" + // 0x80 - 0x87
|
||||
"\u0068\u0069\u00AB\u00BB\u00F0\u00FD\u00FE\u00B1" + // 0x88 - 0x8f
|
||||
"\u00B0\u006A\u006B\u006C\u006D\u006E\u006F\u0070" + // 0x90 - 0x97
|
||||
"\u0071\u0072\u00AA\u00BA\u007B\u00B8\u005B\u005D" + // 0x98 - 0x9f
|
||||
"\u00B5\u00FC\u0073\u0074\u0075\u0076\u0077\u0078" + // 0xa0 - 0xa7
|
||||
"\u0079\u007A\u00A1\u00BF\u00D0\u00DD\u00DE\u00AE" + // 0xa8 - 0xaf
|
||||
"\u00A2\u00A3\u00A5\u00B7\u00A9\u00A7\u00B6\u00BC" + // 0xb0 - 0xb7
|
||||
"\u00BD\u00BE\u00AC\u007C\u00AF\u00A8\u00B4\u00D7" + // 0xb8 - 0xbf
|
||||
"\u00E6\u0041\u0042\u0043\u0044\u0045\u0046\u0047" + // 0xc0 - 0xc7
|
||||
"\u0048\u0049\u00AD\u00F4\u00F6\u00F2\u00F3\u00F5" + // 0xc8 - 0xcf
|
||||
"\u00E5\u004A\u004B\u004C\u004D\u004E\u004F\u0050" + // 0xd0 - 0xd7
|
||||
"\u0051\u0052\u00B9\u00FB\u007E\u00F9\u00FA\u00FF" + // 0xd8 - 0xdf
|
||||
"\\\u00F7\u0053\u0054\u0055\u0056\u0057\u0058" + // 0xe0 - 0xe7
|
||||
"\u0059\u005A\u00B2\u00D4\u00D6\u00D2\u00D3\u00D5" + // 0xe8 - 0xef
|
||||
"\u0030\u0031\u0032\u0033\u0034\u0035\u0036\u0037" + // 0xf0 - 0xf7
|
||||
"\u0038\u0039\u00B3\u00DB\u00DC\u00D9\u00DA\u009F" + // 0xf8 - 0xff
|
||||
"\u0000\u0001\u0002\u0003\u009C\t\u0086\u007F" + // 0x00 - 0x07
|
||||
"\u0097\u008D\u008E\u000B\f\r\u000E\u000F" + // 0x08 - 0x0f
|
||||
"\u0010\u0011\u0012\u0013\u009D\n\b\u0087" + // 0x10 - 0x17
|
||||
"\u0018\u0019\u0092\u008F\u001C\u001D\u001E\u001F" + // 0x18 - 0x1f
|
||||
"\u0080\u0081\u0082\u0083\u0084\n\u0017\u001B" + // 0x20 - 0x27
|
||||
"\u0088\u0089\u008A\u008B\u008C\u0005\u0006\u0007" + // 0x28 - 0x2f
|
||||
"\u0090\u0091\u0016\u0093\u0094\u0095\u0096\u0004" + // 0x30 - 0x37
|
||||
"\u0098\u0099\u009A\u009B\u0014\u0015\u009E\u001A" + // 0x38 - 0x3f
|
||||
"\u0020\u00A0\u00E2\u00E4\u00E0\u00E1\u00E3\u007D" + // 0x40 - 0x47
|
||||
"\u00E7\u00F1\u0023\u002E\u003C\u0028\u002B\u0021" + // 0x48 - 0x4f
|
||||
"\u0026\u00E9\u00EA\u00EB\u00E8\u00ED\u00EE\u00EF" + // 0x50 - 0x57
|
||||
"\u00EC\u00DF\u00A4\u00C5\u002A\u0029\u003B\u005E" + // 0x58 - 0x5f
|
||||
"\u002D\u002F\u00C2\u00C4\u00C0\u00C1\u00C3\u0024" + // 0x60 - 0x67
|
||||
"\u00C7\u00D1\u00F8\u002C\u0025\u005F\u003E\u003F" + // 0x68 - 0x6f
|
||||
"\u00A6\u00C9\u00CA\u00CB\u00C8\u00CD\u00CE\u00CF" + // 0x70 - 0x77
|
||||
"\u00CC\u0060\u003A\u00C6\u00D8\'\u003D\"" ; // 0x78 - 0x7f
|
||||
|
||||
|
||||
private final static char[] b2c = b2cTable.toCharArray();
|
||||
private final static char[] c2b = new char[0x100];
|
||||
private final static char[] c2bIndex = new char[0x100];
|
||||
|
||||
static {
|
||||
char[] b2cMap = b2c;
|
||||
char[] c2bNR = null;
|
||||
// remove non-roundtrip entries
|
||||
b2cMap = b2cTable.toCharArray();
|
||||
b2cMap[165] = UNMAPPABLE_DECODING;
|
||||
|
||||
// non-roundtrip c2b only entries
|
||||
c2bNR = new char[2];
|
||||
c2bNR[0] = 0x15; c2bNR[1] = 0x85;
|
||||
|
||||
SingleByte.initC2B(b2cMap, c2bNR, c2b, c2bIndex);
|
||||
}
|
||||
}
|
||||
110
jdkSrc/jdk8/sun/nio/cs/ext/IBM278.java
Normal file
110
jdkSrc/jdk8/sun/nio/cs/ext/IBM278.java
Normal file
@@ -0,0 +1,110 @@
|
||||
/*
|
||||
* Copyright (c) 2008, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package sun.nio.cs.ext;
|
||||
|
||||
import java.nio.charset.Charset;
|
||||
import java.nio.charset.CharsetDecoder;
|
||||
import java.nio.charset.CharsetEncoder;
|
||||
import sun.nio.cs.StandardCharsets;
|
||||
import sun.nio.cs.SingleByte;
|
||||
import sun.nio.cs.HistoricallyNamedCharset;
|
||||
import static sun.nio.cs.CharsetMapping.*;
|
||||
|
||||
public class IBM278 extends Charset implements HistoricallyNamedCharset
|
||||
{
|
||||
public IBM278() {
|
||||
super("IBM278", ExtendedCharsets.aliasesFor("IBM278"));
|
||||
}
|
||||
|
||||
public String historicalName() {
|
||||
return "Cp278";
|
||||
}
|
||||
|
||||
public boolean contains(Charset cs) {
|
||||
return (cs instanceof IBM278);
|
||||
}
|
||||
|
||||
public CharsetDecoder newDecoder() {
|
||||
return new SingleByte.Decoder(this, b2c);
|
||||
}
|
||||
|
||||
public CharsetEncoder newEncoder() {
|
||||
return new SingleByte.Encoder(this, c2b, c2bIndex);
|
||||
}
|
||||
|
||||
private final static String b2cTable =
|
||||
"\u00D8\u0061\u0062\u0063\u0064\u0065\u0066\u0067" + // 0x80 - 0x87
|
||||
"\u0068\u0069\u00AB\u00BB\u00F0\u00FD\u00FE\u00B1" + // 0x88 - 0x8f
|
||||
"\u00B0\u006A\u006B\u006C\u006D\u006E\u006F\u0070" + // 0x90 - 0x97
|
||||
"\u0071\u0072\u00AA\u00BA\u00E6\u00B8\u00C6\u005D" + // 0x98 - 0x9f
|
||||
"\u00B5\u00FC\u0073\u0074\u0075\u0076\u0077\u0078" + // 0xa0 - 0xa7
|
||||
"\u0079\u007A\u00A1\u00BF\u00D0\u00DD\u00DE\u00AE" + // 0xa8 - 0xaf
|
||||
"\u00A2\u00A3\u00A5\u00B7\u00A9\u005B\u00B6\u00BC" + // 0xb0 - 0xb7
|
||||
"\u00BD\u00BE\u00AC\u007C\u00AF\u00A8\u00B4\u00D7" + // 0xb8 - 0xbf
|
||||
"\u00E4\u0041\u0042\u0043\u0044\u0045\u0046\u0047" + // 0xc0 - 0xc7
|
||||
"\u0048\u0049\u00AD\u00F4\u00A6\u00F2\u00F3\u00F5" + // 0xc8 - 0xcf
|
||||
"\u00E5\u004A\u004B\u004C\u004D\u004E\u004F\u0050" + // 0xd0 - 0xd7
|
||||
"\u0051\u0052\u00B9\u00FB\u007E\u00F9\u00FA\u00FF" + // 0xd8 - 0xdf
|
||||
"\u00C9\u00F7\u0053\u0054\u0055\u0056\u0057\u0058" + // 0xe0 - 0xe7
|
||||
"\u0059\u005A\u00B2\u00D4\u0040\u00D2\u00D3\u00D5" + // 0xe8 - 0xef
|
||||
"\u0030\u0031\u0032\u0033\u0034\u0035\u0036\u0037" + // 0xf0 - 0xf7
|
||||
"\u0038\u0039\u00B3\u00DB\u00DC\u00D9\u00DA\u009F" + // 0xf8 - 0xff
|
||||
"\u0000\u0001\u0002\u0003\u009C\t\u0086\u007F" + // 0x00 - 0x07
|
||||
"\u0097\u008D\u008E\u000B\f\r\u000E\u000F" + // 0x08 - 0x0f
|
||||
"\u0010\u0011\u0012\u0013\u009D\n\b\u0087" + // 0x10 - 0x17
|
||||
"\u0018\u0019\u0092\u008F\u001C\u001D\u001E\u001F" + // 0x18 - 0x1f
|
||||
"\u0080\u0081\u0082\u0083\u0084\n\u0017\u001B" + // 0x20 - 0x27
|
||||
"\u0088\u0089\u008A\u008B\u008C\u0005\u0006\u0007" + // 0x28 - 0x2f
|
||||
"\u0090\u0091\u0016\u0093\u0094\u0095\u0096\u0004" + // 0x30 - 0x37
|
||||
"\u0098\u0099\u009A\u009B\u0014\u0015\u009E\u001A" + // 0x38 - 0x3f
|
||||
"\u0020\u00A0\u00E2\u007B\u00E0\u00E1\u00E3\u007D" + // 0x40 - 0x47
|
||||
"\u00E7\u00F1\u00A7\u002E\u003C\u0028\u002B\u0021" + // 0x48 - 0x4f
|
||||
"\u0026\u0060\u00EA\u00EB\u00E8\u00ED\u00EE\u00EF" + // 0x50 - 0x57
|
||||
"\u00EC\u00DF\u00A4\u00C5\u002A\u0029\u003B\u005E" + // 0x58 - 0x5f
|
||||
"\u002D\u002F\u00C2\u0023\u00C0\u00C1\u00C3\u0024" + // 0x60 - 0x67
|
||||
"\u00C7\u00D1\u00F6\u002C\u0025\u005F\u003E\u003F" + // 0x68 - 0x6f
|
||||
"\u00F8\\\u00CA\u00CB\u00C8\u00CD\u00CE\u00CF" + // 0x70 - 0x77
|
||||
"\u00CC\u00E9\u003A\u00C4\u00D6\'\u003D\"" ; // 0x78 - 0x7f
|
||||
|
||||
|
||||
private final static char[] b2c = b2cTable.toCharArray();
|
||||
private final static char[] c2b = new char[0x100];
|
||||
private final static char[] c2bIndex = new char[0x100];
|
||||
|
||||
static {
|
||||
char[] b2cMap = b2c;
|
||||
char[] c2bNR = null;
|
||||
// remove non-roundtrip entries
|
||||
b2cMap = b2cTable.toCharArray();
|
||||
b2cMap[165] = UNMAPPABLE_DECODING;
|
||||
|
||||
// non-roundtrip c2b only entries
|
||||
c2bNR = new char[2];
|
||||
c2bNR[0] = 0x15; c2bNR[1] = 0x85;
|
||||
|
||||
SingleByte.initC2B(b2cMap, c2bNR, c2b, c2bIndex);
|
||||
}
|
||||
}
|
||||
110
jdkSrc/jdk8/sun/nio/cs/ext/IBM280.java
Normal file
110
jdkSrc/jdk8/sun/nio/cs/ext/IBM280.java
Normal file
@@ -0,0 +1,110 @@
|
||||
/*
|
||||
* Copyright (c) 2008, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package sun.nio.cs.ext;
|
||||
|
||||
import java.nio.charset.Charset;
|
||||
import java.nio.charset.CharsetDecoder;
|
||||
import java.nio.charset.CharsetEncoder;
|
||||
import sun.nio.cs.StandardCharsets;
|
||||
import sun.nio.cs.SingleByte;
|
||||
import sun.nio.cs.HistoricallyNamedCharset;
|
||||
import static sun.nio.cs.CharsetMapping.*;
|
||||
|
||||
public class IBM280 extends Charset implements HistoricallyNamedCharset
|
||||
{
|
||||
public IBM280() {
|
||||
super("IBM280", ExtendedCharsets.aliasesFor("IBM280"));
|
||||
}
|
||||
|
||||
public String historicalName() {
|
||||
return "Cp280";
|
||||
}
|
||||
|
||||
public boolean contains(Charset cs) {
|
||||
return (cs instanceof IBM280);
|
||||
}
|
||||
|
||||
public CharsetDecoder newDecoder() {
|
||||
return new SingleByte.Decoder(this, b2c);
|
||||
}
|
||||
|
||||
public CharsetEncoder newEncoder() {
|
||||
return new SingleByte.Encoder(this, c2b, c2bIndex);
|
||||
}
|
||||
|
||||
private final static String b2cTable =
|
||||
"\u00D8\u0061\u0062\u0063\u0064\u0065\u0066\u0067" + // 0x80 - 0x87
|
||||
"\u0068\u0069\u00AB\u00BB\u00F0\u00FD\u00FE\u00B1" + // 0x88 - 0x8f
|
||||
"\u005B\u006A\u006B\u006C\u006D\u006E\u006F\u0070" + // 0x90 - 0x97
|
||||
"\u0071\u0072\u00AA\u00BA\u00E6\u00B8\u00C6\u00A4" + // 0x98 - 0x9f
|
||||
"\u00B5\u00EC\u0073\u0074\u0075\u0076\u0077\u0078" + // 0xa0 - 0xa7
|
||||
"\u0079\u007A\u00A1\u00BF\u00D0\u00DD\u00DE\u00AE" + // 0xa8 - 0xaf
|
||||
"\u00A2\u0023\u00A5\u00B7\u00A9\u0040\u00B6\u00BC" + // 0xb0 - 0xb7
|
||||
"\u00BD\u00BE\u00AC\u007C\u00AF\u00A8\u00B4\u00D7" + // 0xb8 - 0xbf
|
||||
"\u00E0\u0041\u0042\u0043\u0044\u0045\u0046\u0047" + // 0xc0 - 0xc7
|
||||
"\u0048\u0049\u00AD\u00F4\u00F6\u00A6\u00F3\u00F5" + // 0xc8 - 0xcf
|
||||
"\u00E8\u004A\u004B\u004C\u004D\u004E\u004F\u0050" + // 0xd0 - 0xd7
|
||||
"\u0051\u0052\u00B9\u00FB\u00FC\u0060\u00FA\u00FF" + // 0xd8 - 0xdf
|
||||
"\u00E7\u00F7\u0053\u0054\u0055\u0056\u0057\u0058" + // 0xe0 - 0xe7
|
||||
"\u0059\u005A\u00B2\u00D4\u00D6\u00D2\u00D3\u00D5" + // 0xe8 - 0xef
|
||||
"\u0030\u0031\u0032\u0033\u0034\u0035\u0036\u0037" + // 0xf0 - 0xf7
|
||||
"\u0038\u0039\u00B3\u00DB\u00DC\u00D9\u00DA\u009F" + // 0xf8 - 0xff
|
||||
"\u0000\u0001\u0002\u0003\u009C\t\u0086\u007F" + // 0x00 - 0x07
|
||||
"\u0097\u008D\u008E\u000B\f\r\u000E\u000F" + // 0x08 - 0x0f
|
||||
"\u0010\u0011\u0012\u0013\u009D\n\b\u0087" + // 0x10 - 0x17
|
||||
"\u0018\u0019\u0092\u008F\u001C\u001D\u001E\u001F" + // 0x18 - 0x1f
|
||||
"\u0080\u0081\u0082\u0083\u0084\n\u0017\u001B" + // 0x20 - 0x27
|
||||
"\u0088\u0089\u008A\u008B\u008C\u0005\u0006\u0007" + // 0x28 - 0x2f
|
||||
"\u0090\u0091\u0016\u0093\u0094\u0095\u0096\u0004" + // 0x30 - 0x37
|
||||
"\u0098\u0099\u009A\u009B\u0014\u0015\u009E\u001A" + // 0x38 - 0x3f
|
||||
"\u0020\u00A0\u00E2\u00E4\u007B\u00E1\u00E3\u00E5" + // 0x40 - 0x47
|
||||
"\\\u00F1\u00B0\u002E\u003C\u0028\u002B\u0021" + // 0x48 - 0x4f
|
||||
"\u0026\u005D\u00EA\u00EB\u007D\u00ED\u00EE\u00EF" + // 0x50 - 0x57
|
||||
"\u007E\u00DF\u00E9\u0024\u002A\u0029\u003B\u005E" + // 0x58 - 0x5f
|
||||
"\u002D\u002F\u00C2\u00C4\u00C0\u00C1\u00C3\u00C5" + // 0x60 - 0x67
|
||||
"\u00C7\u00D1\u00F2\u002C\u0025\u005F\u003E\u003F" + // 0x68 - 0x6f
|
||||
"\u00F8\u00C9\u00CA\u00CB\u00C8\u00CD\u00CE\u00CF" + // 0x70 - 0x77
|
||||
"\u00CC\u00F9\u003A\u00A3\u00A7\'\u003D\"" ; // 0x78 - 0x7f
|
||||
|
||||
|
||||
private final static char[] b2c = b2cTable.toCharArray();
|
||||
private final static char[] c2b = new char[0x100];
|
||||
private final static char[] c2bIndex = new char[0x100];
|
||||
|
||||
static {
|
||||
char[] b2cMap = b2c;
|
||||
char[] c2bNR = null;
|
||||
// remove non-roundtrip entries
|
||||
b2cMap = b2cTable.toCharArray();
|
||||
b2cMap[165] = UNMAPPABLE_DECODING;
|
||||
|
||||
// non-roundtrip c2b only entries
|
||||
c2bNR = new char[2];
|
||||
c2bNR[0] = 0x15; c2bNR[1] = 0x85;
|
||||
|
||||
SingleByte.initC2B(b2cMap, c2bNR, c2b, c2bIndex);
|
||||
}
|
||||
}
|
||||
110
jdkSrc/jdk8/sun/nio/cs/ext/IBM284.java
Normal file
110
jdkSrc/jdk8/sun/nio/cs/ext/IBM284.java
Normal file
@@ -0,0 +1,110 @@
|
||||
/*
|
||||
* Copyright (c) 2008, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package sun.nio.cs.ext;
|
||||
|
||||
import java.nio.charset.Charset;
|
||||
import java.nio.charset.CharsetDecoder;
|
||||
import java.nio.charset.CharsetEncoder;
|
||||
import sun.nio.cs.StandardCharsets;
|
||||
import sun.nio.cs.SingleByte;
|
||||
import sun.nio.cs.HistoricallyNamedCharset;
|
||||
import static sun.nio.cs.CharsetMapping.*;
|
||||
|
||||
public class IBM284 extends Charset implements HistoricallyNamedCharset
|
||||
{
|
||||
public IBM284() {
|
||||
super("IBM284", ExtendedCharsets.aliasesFor("IBM284"));
|
||||
}
|
||||
|
||||
public String historicalName() {
|
||||
return "Cp284";
|
||||
}
|
||||
|
||||
public boolean contains(Charset cs) {
|
||||
return (cs instanceof IBM284);
|
||||
}
|
||||
|
||||
public CharsetDecoder newDecoder() {
|
||||
return new SingleByte.Decoder(this, b2c);
|
||||
}
|
||||
|
||||
public CharsetEncoder newEncoder() {
|
||||
return new SingleByte.Encoder(this, c2b, c2bIndex);
|
||||
}
|
||||
|
||||
private final static String b2cTable =
|
||||
"\u00D8\u0061\u0062\u0063\u0064\u0065\u0066\u0067" + // 0x80 - 0x87
|
||||
"\u0068\u0069\u00AB\u00BB\u00F0\u00FD\u00FE\u00B1" + // 0x88 - 0x8f
|
||||
"\u00B0\u006A\u006B\u006C\u006D\u006E\u006F\u0070" + // 0x90 - 0x97
|
||||
"\u0071\u0072\u00AA\u00BA\u00E6\u00B8\u00C6\u00A4" + // 0x98 - 0x9f
|
||||
"\u00B5\u00A8\u0073\u0074\u0075\u0076\u0077\u0078" + // 0xa0 - 0xa7
|
||||
"\u0079\u007A\u00A1\u00BF\u00D0\u00DD\u00DE\u00AE" + // 0xa8 - 0xaf
|
||||
"\u00A2\u00A3\u00A5\u00B7\u00A9\u00A7\u00B6\u00BC" + // 0xb0 - 0xb7
|
||||
"\u00BD\u00BE\u005E\u0021\u00AF\u007E\u00B4\u00D7" + // 0xb8 - 0xbf
|
||||
"\u007B\u0041\u0042\u0043\u0044\u0045\u0046\u0047" + // 0xc0 - 0xc7
|
||||
"\u0048\u0049\u00AD\u00F4\u00F6\u00F2\u00F3\u00F5" + // 0xc8 - 0xcf
|
||||
"\u007D\u004A\u004B\u004C\u004D\u004E\u004F\u0050" + // 0xd0 - 0xd7
|
||||
"\u0051\u0052\u00B9\u00FB\u00FC\u00F9\u00FA\u00FF" + // 0xd8 - 0xdf
|
||||
"\\\u00F7\u0053\u0054\u0055\u0056\u0057\u0058" + // 0xe0 - 0xe7
|
||||
"\u0059\u005A\u00B2\u00D4\u00D6\u00D2\u00D3\u00D5" + // 0xe8 - 0xef
|
||||
"\u0030\u0031\u0032\u0033\u0034\u0035\u0036\u0037" + // 0xf0 - 0xf7
|
||||
"\u0038\u0039\u00B3\u00DB\u00DC\u00D9\u00DA\u009F" + // 0xf8 - 0xff
|
||||
"\u0000\u0001\u0002\u0003\u009C\t\u0086\u007F" + // 0x00 - 0x07
|
||||
"\u0097\u008D\u008E\u000B\f\r\u000E\u000F" + // 0x08 - 0x0f
|
||||
"\u0010\u0011\u0012\u0013\u009D\n\b\u0087" + // 0x10 - 0x17
|
||||
"\u0018\u0019\u0092\u008F\u001C\u001D\u001E\u001F" + // 0x18 - 0x1f
|
||||
"\u0080\u0081\u0082\u0083\u0084\n\u0017\u001B" + // 0x20 - 0x27
|
||||
"\u0088\u0089\u008A\u008B\u008C\u0005\u0006\u0007" + // 0x28 - 0x2f
|
||||
"\u0090\u0091\u0016\u0093\u0094\u0095\u0096\u0004" + // 0x30 - 0x37
|
||||
"\u0098\u0099\u009A\u009B\u0014\u0015\u009E\u001A" + // 0x38 - 0x3f
|
||||
"\u0020\u00A0\u00E2\u00E4\u00E0\u00E1\u00E3\u00E5" + // 0x40 - 0x47
|
||||
"\u00E7\u00A6\u005B\u002E\u003C\u0028\u002B\u007C" + // 0x48 - 0x4f
|
||||
"\u0026\u00E9\u00EA\u00EB\u00E8\u00ED\u00EE\u00EF" + // 0x50 - 0x57
|
||||
"\u00EC\u00DF\u005D\u0024\u002A\u0029\u003B\u00AC" + // 0x58 - 0x5f
|
||||
"\u002D\u002F\u00C2\u00C4\u00C0\u00C1\u00C3\u00C5" + // 0x60 - 0x67
|
||||
"\u00C7\u0023\u00F1\u002C\u0025\u005F\u003E\u003F" + // 0x68 - 0x6f
|
||||
"\u00F8\u00C9\u00CA\u00CB\u00C8\u00CD\u00CE\u00CF" + // 0x70 - 0x77
|
||||
"\u00CC\u0060\u003A\u00D1\u0040\'\u003D\"" ; // 0x78 - 0x7f
|
||||
|
||||
|
||||
private final static char[] b2c = b2cTable.toCharArray();
|
||||
private final static char[] c2b = new char[0x100];
|
||||
private final static char[] c2bIndex = new char[0x100];
|
||||
|
||||
static {
|
||||
char[] b2cMap = b2c;
|
||||
char[] c2bNR = null;
|
||||
// remove non-roundtrip entries
|
||||
b2cMap = b2cTable.toCharArray();
|
||||
b2cMap[165] = UNMAPPABLE_DECODING;
|
||||
|
||||
// non-roundtrip c2b only entries
|
||||
c2bNR = new char[2];
|
||||
c2bNR[0] = 0x15; c2bNR[1] = 0x85;
|
||||
|
||||
SingleByte.initC2B(b2cMap, c2bNR, c2b, c2bIndex);
|
||||
}
|
||||
}
|
||||
110
jdkSrc/jdk8/sun/nio/cs/ext/IBM285.java
Normal file
110
jdkSrc/jdk8/sun/nio/cs/ext/IBM285.java
Normal file
@@ -0,0 +1,110 @@
|
||||
/*
|
||||
* Copyright (c) 2008, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package sun.nio.cs.ext;
|
||||
|
||||
import java.nio.charset.Charset;
|
||||
import java.nio.charset.CharsetDecoder;
|
||||
import java.nio.charset.CharsetEncoder;
|
||||
import sun.nio.cs.StandardCharsets;
|
||||
import sun.nio.cs.SingleByte;
|
||||
import sun.nio.cs.HistoricallyNamedCharset;
|
||||
import static sun.nio.cs.CharsetMapping.*;
|
||||
|
||||
public class IBM285 extends Charset implements HistoricallyNamedCharset
|
||||
{
|
||||
public IBM285() {
|
||||
super("IBM285", ExtendedCharsets.aliasesFor("IBM285"));
|
||||
}
|
||||
|
||||
public String historicalName() {
|
||||
return "Cp285";
|
||||
}
|
||||
|
||||
public boolean contains(Charset cs) {
|
||||
return (cs instanceof IBM285);
|
||||
}
|
||||
|
||||
public CharsetDecoder newDecoder() {
|
||||
return new SingleByte.Decoder(this, b2c);
|
||||
}
|
||||
|
||||
public CharsetEncoder newEncoder() {
|
||||
return new SingleByte.Encoder(this, c2b, c2bIndex);
|
||||
}
|
||||
|
||||
private final static String b2cTable =
|
||||
"\u00D8\u0061\u0062\u0063\u0064\u0065\u0066\u0067" + // 0x80 - 0x87
|
||||
"\u0068\u0069\u00AB\u00BB\u00F0\u00FD\u00FE\u00B1" + // 0x88 - 0x8f
|
||||
"\u00B0\u006A\u006B\u006C\u006D\u006E\u006F\u0070" + // 0x90 - 0x97
|
||||
"\u0071\u0072\u00AA\u00BA\u00E6\u00B8\u00C6\u00A4" + // 0x98 - 0x9f
|
||||
"\u00B5\u00AF\u0073\u0074\u0075\u0076\u0077\u0078" + // 0xa0 - 0xa7
|
||||
"\u0079\u007A\u00A1\u00BF\u00D0\u00DD\u00DE\u00AE" + // 0xa8 - 0xaf
|
||||
"\u00A2\u005B\u00A5\u00B7\u00A9\u00A7\u00B6\u00BC" + // 0xb0 - 0xb7
|
||||
"\u00BD\u00BE\u005E\u005D\u007E\u00A8\u00B4\u00D7" + // 0xb8 - 0xbf
|
||||
"\u007B\u0041\u0042\u0043\u0044\u0045\u0046\u0047" + // 0xc0 - 0xc7
|
||||
"\u0048\u0049\u00AD\u00F4\u00F6\u00F2\u00F3\u00F5" + // 0xc8 - 0xcf
|
||||
"\u007D\u004A\u004B\u004C\u004D\u004E\u004F\u0050" + // 0xd0 - 0xd7
|
||||
"\u0051\u0052\u00B9\u00FB\u00FC\u00F9\u00FA\u00FF" + // 0xd8 - 0xdf
|
||||
"\\\u00F7\u0053\u0054\u0055\u0056\u0057\u0058" + // 0xe0 - 0xe7
|
||||
"\u0059\u005A\u00B2\u00D4\u00D6\u00D2\u00D3\u00D5" + // 0xe8 - 0xef
|
||||
"\u0030\u0031\u0032\u0033\u0034\u0035\u0036\u0037" + // 0xf0 - 0xf7
|
||||
"\u0038\u0039\u00B3\u00DB\u00DC\u00D9\u00DA\u009F" + // 0xf8 - 0xff
|
||||
"\u0000\u0001\u0002\u0003\u009C\t\u0086\u007F" + // 0x00 - 0x07
|
||||
"\u0097\u008D\u008E\u000B\f\r\u000E\u000F" + // 0x08 - 0x0f
|
||||
"\u0010\u0011\u0012\u0013\u009D\n\b\u0087" + // 0x10 - 0x17
|
||||
"\u0018\u0019\u0092\u008F\u001C\u001D\u001E\u001F" + // 0x18 - 0x1f
|
||||
"\u0080\u0081\u0082\u0083\u0084\n\u0017\u001B" + // 0x20 - 0x27
|
||||
"\u0088\u0089\u008A\u008B\u008C\u0005\u0006\u0007" + // 0x28 - 0x2f
|
||||
"\u0090\u0091\u0016\u0093\u0094\u0095\u0096\u0004" + // 0x30 - 0x37
|
||||
"\u0098\u0099\u009A\u009B\u0014\u0015\u009E\u001A" + // 0x38 - 0x3f
|
||||
"\u0020\u00A0\u00E2\u00E4\u00E0\u00E1\u00E3\u00E5" + // 0x40 - 0x47
|
||||
"\u00E7\u00F1\u0024\u002E\u003C\u0028\u002B\u007C" + // 0x48 - 0x4f
|
||||
"\u0026\u00E9\u00EA\u00EB\u00E8\u00ED\u00EE\u00EF" + // 0x50 - 0x57
|
||||
"\u00EC\u00DF\u0021\u00A3\u002A\u0029\u003B\u00AC" + // 0x58 - 0x5f
|
||||
"\u002D\u002F\u00C2\u00C4\u00C0\u00C1\u00C3\u00C5" + // 0x60 - 0x67
|
||||
"\u00C7\u00D1\u00A6\u002C\u0025\u005F\u003E\u003F" + // 0x68 - 0x6f
|
||||
"\u00F8\u00C9\u00CA\u00CB\u00C8\u00CD\u00CE\u00CF" + // 0x70 - 0x77
|
||||
"\u00CC\u0060\u003A\u0023\u0040\'\u003D\"" ; // 0x78 - 0x7f
|
||||
|
||||
|
||||
private final static char[] b2c = b2cTable.toCharArray();
|
||||
private final static char[] c2b = new char[0x100];
|
||||
private final static char[] c2bIndex = new char[0x100];
|
||||
|
||||
static {
|
||||
char[] b2cMap = b2c;
|
||||
char[] c2bNR = null;
|
||||
// remove non-roundtrip entries
|
||||
b2cMap = b2cTable.toCharArray();
|
||||
b2cMap[165] = UNMAPPABLE_DECODING;
|
||||
|
||||
// non-roundtrip c2b only entries
|
||||
c2bNR = new char[2];
|
||||
c2bNR[0] = 0x15; c2bNR[1] = 0x85;
|
||||
|
||||
SingleByte.initC2B(b2cMap, c2bNR, c2b, c2bIndex);
|
||||
}
|
||||
}
|
||||
199
jdkSrc/jdk8/sun/nio/cs/ext/IBM290.java
Normal file
199
jdkSrc/jdk8/sun/nio/cs/ext/IBM290.java
Normal file
@@ -0,0 +1,199 @@
|
||||
/*
|
||||
* Copyright (c) 2008, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package sun.nio.cs.ext;
|
||||
|
||||
import java.nio.charset.Charset;
|
||||
import java.nio.charset.CharsetDecoder;
|
||||
import java.nio.charset.CharsetEncoder;
|
||||
import sun.nio.cs.StandardCharsets;
|
||||
import sun.nio.cs.SingleByte;
|
||||
import sun.nio.cs.HistoricallyNamedCharset;
|
||||
import static sun.nio.cs.CharsetMapping.*;
|
||||
|
||||
public class IBM290 extends Charset implements HistoricallyNamedCharset
|
||||
{
|
||||
public IBM290() {
|
||||
super("IBM290", ExtendedCharsets.aliasesFor("IBM290"));
|
||||
}
|
||||
|
||||
public String historicalName() {
|
||||
return "Cp290";
|
||||
}
|
||||
|
||||
public boolean contains(Charset cs) {
|
||||
return (cs instanceof IBM290);
|
||||
}
|
||||
|
||||
public CharsetDecoder newDecoder() {
|
||||
return new SingleByte.Decoder(this, b2c);
|
||||
}
|
||||
|
||||
public CharsetEncoder newEncoder() {
|
||||
return new SingleByte.Encoder(this, c2b, c2bIndex);
|
||||
}
|
||||
|
||||
private final static String b2cTable =
|
||||
"\u005D\uFF71\uFF72\uFF73\uFF74\uFF75\uFF76\uFF77" + // 0x80 - 0x87
|
||||
"\uFF78\uFF79\uFF7A\u0071\uFF7B\uFF7C\uFF7D\uFF7E" + // 0x88 - 0x8f
|
||||
"\uFF7F\uFF80\uFF81\uFF82\uFF83\uFF84\uFF85\uFF86" + // 0x90 - 0x97
|
||||
"\uFF87\uFF88\uFF89\u0072\uFFFD\uFF8A\uFF8B\uFF8C" + // 0x98 - 0x9f
|
||||
"\u007E\u203E\uFF8D\uFF8E\uFF8F\uFF90\uFF91\uFF92" + // 0xa0 - 0xa7
|
||||
"\uFF93\uFF94\uFF95\u0073\uFF96\uFF97\uFF98\uFF99" + // 0xa8 - 0xaf
|
||||
"\u005E\u00A2\\\u0074\u0075\u0076\u0077\u0078" + // 0xb0 - 0xb7
|
||||
"\u0079\u007A\uFF9A\uFF9B\uFF9C\uFF9D\uFF9E\uFF9F" + // 0xb8 - 0xbf
|
||||
"\u007B\u0041\u0042\u0043\u0044\u0045\u0046\u0047" + // 0xc0 - 0xc7
|
||||
"\u0048\u0049\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD" + // 0xc8 - 0xcf
|
||||
"\u007D\u004A\u004B\u004C\u004D\u004E\u004F\u0050" + // 0xd0 - 0xd7
|
||||
"\u0051\u0052\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD" + // 0xd8 - 0xdf
|
||||
"\u0024\uFFFD\u0053\u0054\u0055\u0056\u0057\u0058" + // 0xe0 - 0xe7
|
||||
"\u0059\u005A\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD" + // 0xe8 - 0xef
|
||||
"\u0030\u0031\u0032\u0033\u0034\u0035\u0036\u0037" + // 0xf0 - 0xf7
|
||||
"\u0038\u0039\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\u009F" + // 0xf8 - 0xff
|
||||
"\u0000\u0001\u0002\u0003\u009C\t\u0086\u007F" + // 0x00 - 0x07
|
||||
"\u0097\u008D\u008E\u000B\f\r\u000E\u000F" + // 0x08 - 0x0f
|
||||
"\u0010\u0011\u0012\u0013\u009D\u0085\b\u0087" + // 0x10 - 0x17
|
||||
"\u0018\u0019\u0092\u008F\u001C\u001D\u001E\u001F" + // 0x18 - 0x1f
|
||||
"\u0080\u0081\u0082\u0083\u0084\n\u0017\u001B" + // 0x20 - 0x27
|
||||
"\u0088\u0089\u008A\u008B\u008C\u0005\u0006\u0007" + // 0x28 - 0x2f
|
||||
"\u0090\u0091\u0016\u0093\u0094\u0095\u0096\u0004" + // 0x30 - 0x37
|
||||
"\u0098\u0099\u009A\u009B\u0014\u0015\u009E\u001A" + // 0x38 - 0x3f
|
||||
"\u0020\uFF61\uFF62\uFF63\uFF64\uFF65\uFF66\uFF67" + // 0x40 - 0x47
|
||||
"\uFF68\uFF69\u00A3\u002E\u003C\u0028\u002B\u007C" + // 0x48 - 0x4f
|
||||
"\u0026\uFF6A\uFF6B\uFF6C\uFF6D\uFF6E\uFF6F\uFFFD" + // 0x50 - 0x57
|
||||
"\uFF70\uFFFD\u0021\u00A5\u002A\u0029\u003B\u00AC" + // 0x58 - 0x5f
|
||||
"\u002D\u002F\u0061\u0062\u0063\u0064\u0065\u0066" + // 0x60 - 0x67
|
||||
"\u0067\u0068\uFFFD\u002C\u0025\u005F\u003E\u003F" + // 0x68 - 0x6f
|
||||
"\u005B\u0069\u006A\u006B\u006C\u006D\u006E\u006F" + // 0x70 - 0x77
|
||||
"\u0070\u0060\u003A\u0023\u0040\'\u003D\"" ; // 0x78 - 0x7f
|
||||
|
||||
|
||||
private final static char[] b2c = b2cTable.toCharArray();
|
||||
private final static char[] c2b = new char[0x300];
|
||||
private final static char[] c2bIndex = new char[0x100];
|
||||
|
||||
static {
|
||||
char[] b2cMap = b2c;
|
||||
char[] c2bNR = null;
|
||||
// non-roundtrip c2b only entries
|
||||
c2bNR = new char[188];
|
||||
c2bNR[0] = 0x4b; c2bNR[1] = 0xff0e;
|
||||
c2bNR[2] = 0x4c; c2bNR[3] = 0xff1c;
|
||||
c2bNR[4] = 0x4d; c2bNR[5] = 0xff08;
|
||||
c2bNR[6] = 0x4e; c2bNR[7] = 0xff0b;
|
||||
c2bNR[8] = 0x4f; c2bNR[9] = 0xff5c;
|
||||
c2bNR[10] = 0x50; c2bNR[11] = 0xff06;
|
||||
c2bNR[12] = 0x5a; c2bNR[13] = 0xff01;
|
||||
c2bNR[14] = 0x5c; c2bNR[15] = 0xff0a;
|
||||
c2bNR[16] = 0x5d; c2bNR[17] = 0xff09;
|
||||
c2bNR[18] = 0x5e; c2bNR[19] = 0xff1b;
|
||||
c2bNR[20] = 0x60; c2bNR[21] = 0xff0d;
|
||||
c2bNR[22] = 0x61; c2bNR[23] = 0xff0f;
|
||||
c2bNR[24] = 0x62; c2bNR[25] = 0xff41;
|
||||
c2bNR[26] = 0x63; c2bNR[27] = 0xff42;
|
||||
c2bNR[28] = 0x64; c2bNR[29] = 0xff43;
|
||||
c2bNR[30] = 0x65; c2bNR[31] = 0xff44;
|
||||
c2bNR[32] = 0x66; c2bNR[33] = 0xff45;
|
||||
c2bNR[34] = 0x67; c2bNR[35] = 0xff46;
|
||||
c2bNR[36] = 0x68; c2bNR[37] = 0xff47;
|
||||
c2bNR[38] = 0x69; c2bNR[39] = 0xff48;
|
||||
c2bNR[40] = 0x6b; c2bNR[41] = 0xff0c;
|
||||
c2bNR[42] = 0x6c; c2bNR[43] = 0xff05;
|
||||
c2bNR[44] = 0x6d; c2bNR[45] = 0xff3f;
|
||||
c2bNR[46] = 0x6e; c2bNR[47] = 0xff1e;
|
||||
c2bNR[48] = 0x6f; c2bNR[49] = 0xff1f;
|
||||
c2bNR[50] = 0x70; c2bNR[51] = 0xff3b;
|
||||
c2bNR[52] = 0x71; c2bNR[53] = 0xff49;
|
||||
c2bNR[54] = 0x72; c2bNR[55] = 0xff4a;
|
||||
c2bNR[56] = 0x73; c2bNR[57] = 0xff4b;
|
||||
c2bNR[58] = 0x74; c2bNR[59] = 0xff4c;
|
||||
c2bNR[60] = 0x75; c2bNR[61] = 0xff4d;
|
||||
c2bNR[62] = 0x76; c2bNR[63] = 0xff4e;
|
||||
c2bNR[64] = 0x77; c2bNR[65] = 0xff4f;
|
||||
c2bNR[66] = 0x78; c2bNR[67] = 0xff50;
|
||||
c2bNR[68] = 0x79; c2bNR[69] = 0xff40;
|
||||
c2bNR[70] = 0x7a; c2bNR[71] = 0xff1a;
|
||||
c2bNR[72] = 0x7b; c2bNR[73] = 0xff03;
|
||||
c2bNR[74] = 0x7c; c2bNR[75] = 0xff20;
|
||||
c2bNR[76] = 0x7d; c2bNR[77] = 0xff07;
|
||||
c2bNR[78] = 0x7e; c2bNR[79] = 0xff1d;
|
||||
c2bNR[80] = 0x7f; c2bNR[81] = 0xff02;
|
||||
c2bNR[82] = 0x80; c2bNR[83] = 0xff3d;
|
||||
c2bNR[84] = 0x8b; c2bNR[85] = 0xff51;
|
||||
c2bNR[86] = 0x9b; c2bNR[87] = 0xff52;
|
||||
c2bNR[88] = 0xa0; c2bNR[89] = 0xff5e;
|
||||
c2bNR[90] = 0xab; c2bNR[91] = 0xff53;
|
||||
c2bNR[92] = 0xb0; c2bNR[93] = 0xff3e;
|
||||
c2bNR[94] = 0xb2; c2bNR[95] = 0xff3c;
|
||||
c2bNR[96] = 0xb3; c2bNR[97] = 0xff54;
|
||||
c2bNR[98] = 0xb4; c2bNR[99] = 0xff55;
|
||||
c2bNR[100] = 0xb5; c2bNR[101] = 0xff56;
|
||||
c2bNR[102] = 0xb6; c2bNR[103] = 0xff57;
|
||||
c2bNR[104] = 0xb7; c2bNR[105] = 0xff58;
|
||||
c2bNR[106] = 0xb8; c2bNR[107] = 0xff59;
|
||||
c2bNR[108] = 0xb9; c2bNR[109] = 0xff5a;
|
||||
c2bNR[110] = 0xc0; c2bNR[111] = 0xff5b;
|
||||
c2bNR[112] = 0xc1; c2bNR[113] = 0xff21;
|
||||
c2bNR[114] = 0xc2; c2bNR[115] = 0xff22;
|
||||
c2bNR[116] = 0xc3; c2bNR[117] = 0xff23;
|
||||
c2bNR[118] = 0xc4; c2bNR[119] = 0xff24;
|
||||
c2bNR[120] = 0xc5; c2bNR[121] = 0xff25;
|
||||
c2bNR[122] = 0xc6; c2bNR[123] = 0xff26;
|
||||
c2bNR[124] = 0xc7; c2bNR[125] = 0xff27;
|
||||
c2bNR[126] = 0xc8; c2bNR[127] = 0xff28;
|
||||
c2bNR[128] = 0xc9; c2bNR[129] = 0xff29;
|
||||
c2bNR[130] = 0xd0; c2bNR[131] = 0xff5d;
|
||||
c2bNR[132] = 0xd1; c2bNR[133] = 0xff2a;
|
||||
c2bNR[134] = 0xd2; c2bNR[135] = 0xff2b;
|
||||
c2bNR[136] = 0xd3; c2bNR[137] = 0xff2c;
|
||||
c2bNR[138] = 0xd4; c2bNR[139] = 0xff2d;
|
||||
c2bNR[140] = 0xd5; c2bNR[141] = 0xff2e;
|
||||
c2bNR[142] = 0xd6; c2bNR[143] = 0xff2f;
|
||||
c2bNR[144] = 0xd7; c2bNR[145] = 0xff30;
|
||||
c2bNR[146] = 0xd8; c2bNR[147] = 0xff31;
|
||||
c2bNR[148] = 0xd9; c2bNR[149] = 0xff32;
|
||||
c2bNR[150] = 0xe0; c2bNR[151] = 0xff04;
|
||||
c2bNR[152] = 0xe2; c2bNR[153] = 0xff33;
|
||||
c2bNR[154] = 0xe3; c2bNR[155] = 0xff34;
|
||||
c2bNR[156] = 0xe4; c2bNR[157] = 0xff35;
|
||||
c2bNR[158] = 0xe5; c2bNR[159] = 0xff36;
|
||||
c2bNR[160] = 0xe6; c2bNR[161] = 0xff37;
|
||||
c2bNR[162] = 0xe7; c2bNR[163] = 0xff38;
|
||||
c2bNR[164] = 0xe8; c2bNR[165] = 0xff39;
|
||||
c2bNR[166] = 0xe9; c2bNR[167] = 0xff3a;
|
||||
c2bNR[168] = 0xf0; c2bNR[169] = 0xff10;
|
||||
c2bNR[170] = 0xf1; c2bNR[171] = 0xff11;
|
||||
c2bNR[172] = 0xf2; c2bNR[173] = 0xff12;
|
||||
c2bNR[174] = 0xf3; c2bNR[175] = 0xff13;
|
||||
c2bNR[176] = 0xf4; c2bNR[177] = 0xff14;
|
||||
c2bNR[178] = 0xf5; c2bNR[179] = 0xff15;
|
||||
c2bNR[180] = 0xf6; c2bNR[181] = 0xff16;
|
||||
c2bNR[182] = 0xf7; c2bNR[183] = 0xff17;
|
||||
c2bNR[184] = 0xf8; c2bNR[185] = 0xff18;
|
||||
c2bNR[186] = 0xf9; c2bNR[187] = 0xff19;
|
||||
|
||||
SingleByte.initC2B(b2cMap, c2bNR, c2b, c2bIndex);
|
||||
}
|
||||
}
|
||||
110
jdkSrc/jdk8/sun/nio/cs/ext/IBM297.java
Normal file
110
jdkSrc/jdk8/sun/nio/cs/ext/IBM297.java
Normal file
@@ -0,0 +1,110 @@
|
||||
/*
|
||||
* Copyright (c) 2008, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package sun.nio.cs.ext;
|
||||
|
||||
import java.nio.charset.Charset;
|
||||
import java.nio.charset.CharsetDecoder;
|
||||
import java.nio.charset.CharsetEncoder;
|
||||
import sun.nio.cs.StandardCharsets;
|
||||
import sun.nio.cs.SingleByte;
|
||||
import sun.nio.cs.HistoricallyNamedCharset;
|
||||
import static sun.nio.cs.CharsetMapping.*;
|
||||
|
||||
public class IBM297 extends Charset implements HistoricallyNamedCharset
|
||||
{
|
||||
public IBM297() {
|
||||
super("IBM297", ExtendedCharsets.aliasesFor("IBM297"));
|
||||
}
|
||||
|
||||
public String historicalName() {
|
||||
return "Cp297";
|
||||
}
|
||||
|
||||
public boolean contains(Charset cs) {
|
||||
return (cs instanceof IBM297);
|
||||
}
|
||||
|
||||
public CharsetDecoder newDecoder() {
|
||||
return new SingleByte.Decoder(this, b2c);
|
||||
}
|
||||
|
||||
public CharsetEncoder newEncoder() {
|
||||
return new SingleByte.Encoder(this, c2b, c2bIndex);
|
||||
}
|
||||
|
||||
private final static String b2cTable =
|
||||
"\u00D8\u0061\u0062\u0063\u0064\u0065\u0066\u0067" + // 0x80 - 0x87
|
||||
"\u0068\u0069\u00AB\u00BB\u00F0\u00FD\u00FE\u00B1" + // 0x88 - 0x8f
|
||||
"\u005B\u006A\u006B\u006C\u006D\u006E\u006F\u0070" + // 0x90 - 0x97
|
||||
"\u0071\u0072\u00AA\u00BA\u00E6\u00B8\u00C6\u00A4" + // 0x98 - 0x9f
|
||||
"\u0060\u00A8\u0073\u0074\u0075\u0076\u0077\u0078" + // 0xa0 - 0xa7
|
||||
"\u0079\u007A\u00A1\u00BF\u00D0\u00DD\u00DE\u00AE" + // 0xa8 - 0xaf
|
||||
"\u00A2\u0023\u00A5\u00B7\u00A9\u005D\u00B6\u00BC" + // 0xb0 - 0xb7
|
||||
"\u00BD\u00BE\u00AC\u007C\u00AF\u007E\u00B4\u00D7" + // 0xb8 - 0xbf
|
||||
"\u00E9\u0041\u0042\u0043\u0044\u0045\u0046\u0047" + // 0xc0 - 0xc7
|
||||
"\u0048\u0049\u00AD\u00F4\u00F6\u00F2\u00F3\u00F5" + // 0xc8 - 0xcf
|
||||
"\u00E8\u004A\u004B\u004C\u004D\u004E\u004F\u0050" + // 0xd0 - 0xd7
|
||||
"\u0051\u0052\u00B9\u00FB\u00FC\u00A6\u00FA\u00FF" + // 0xd8 - 0xdf
|
||||
"\u00E7\u00F7\u0053\u0054\u0055\u0056\u0057\u0058" + // 0xe0 - 0xe7
|
||||
"\u0059\u005A\u00B2\u00D4\u00D6\u00D2\u00D3\u00D5" + // 0xe8 - 0xef
|
||||
"\u0030\u0031\u0032\u0033\u0034\u0035\u0036\u0037" + // 0xf0 - 0xf7
|
||||
"\u0038\u0039\u00B3\u00DB\u00DC\u00D9\u00DA\u009F" + // 0xf8 - 0xff
|
||||
"\u0000\u0001\u0002\u0003\u009C\t\u0086\u007F" + // 0x00 - 0x07
|
||||
"\u0097\u008D\u008E\u000B\f\r\u000E\u000F" + // 0x08 - 0x0f
|
||||
"\u0010\u0011\u0012\u0013\u009D\n\b\u0087" + // 0x10 - 0x17
|
||||
"\u0018\u0019\u0092\u008F\u001C\u001D\u001E\u001F" + // 0x18 - 0x1f
|
||||
"\u0080\u0081\u0082\u0083\u0084\n\u0017\u001B" + // 0x20 - 0x27
|
||||
"\u0088\u0089\u008A\u008B\u008C\u0005\u0006\u0007" + // 0x28 - 0x2f
|
||||
"\u0090\u0091\u0016\u0093\u0094\u0095\u0096\u0004" + // 0x30 - 0x37
|
||||
"\u0098\u0099\u009A\u009B\u0014\u0015\u009E\u001A" + // 0x38 - 0x3f
|
||||
"\u0020\u00A0\u00E2\u00E4\u0040\u00E1\u00E3\u00E5" + // 0x40 - 0x47
|
||||
"\\\u00F1\u00B0\u002E\u003C\u0028\u002B\u0021" + // 0x48 - 0x4f
|
||||
"\u0026\u007B\u00EA\u00EB\u007D\u00ED\u00EE\u00EF" + // 0x50 - 0x57
|
||||
"\u00EC\u00DF\u00A7\u0024\u002A\u0029\u003B\u005E" + // 0x58 - 0x5f
|
||||
"\u002D\u002F\u00C2\u00C4\u00C0\u00C1\u00C3\u00C5" + // 0x60 - 0x67
|
||||
"\u00C7\u00D1\u00F9\u002C\u0025\u005F\u003E\u003F" + // 0x68 - 0x6f
|
||||
"\u00F8\u00C9\u00CA\u00CB\u00C8\u00CD\u00CE\u00CF" + // 0x70 - 0x77
|
||||
"\u00CC\u00B5\u003A\u00A3\u00E0\'\u003D\"" ; // 0x78 - 0x7f
|
||||
|
||||
|
||||
private final static char[] b2c = b2cTable.toCharArray();
|
||||
private final static char[] c2b = new char[0x100];
|
||||
private final static char[] c2bIndex = new char[0x100];
|
||||
|
||||
static {
|
||||
char[] b2cMap = b2c;
|
||||
char[] c2bNR = null;
|
||||
// remove non-roundtrip entries
|
||||
b2cMap = b2cTable.toCharArray();
|
||||
b2cMap[165] = UNMAPPABLE_DECODING;
|
||||
|
||||
// non-roundtrip c2b only entries
|
||||
c2bNR = new char[2];
|
||||
c2bNR[0] = 0x15; c2bNR[1] = 0x85;
|
||||
|
||||
SingleByte.initC2B(b2cMap, c2bNR, c2b, c2bIndex);
|
||||
}
|
||||
}
|
||||
1878
jdkSrc/jdk8/sun/nio/cs/ext/IBM300.java
Normal file
1878
jdkSrc/jdk8/sun/nio/cs/ext/IBM300.java
Normal file
File diff suppressed because it is too large
Load Diff
7137
jdkSrc/jdk8/sun/nio/cs/ext/IBM33722.java
Normal file
7137
jdkSrc/jdk8/sun/nio/cs/ext/IBM33722.java
Normal file
File diff suppressed because it is too large
Load Diff
155
jdkSrc/jdk8/sun/nio/cs/ext/IBM420.java
Normal file
155
jdkSrc/jdk8/sun/nio/cs/ext/IBM420.java
Normal file
@@ -0,0 +1,155 @@
|
||||
/*
|
||||
* Copyright (c) 2008, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package sun.nio.cs.ext;
|
||||
|
||||
import java.nio.charset.Charset;
|
||||
import java.nio.charset.CharsetDecoder;
|
||||
import java.nio.charset.CharsetEncoder;
|
||||
import sun.nio.cs.StandardCharsets;
|
||||
import sun.nio.cs.SingleByte;
|
||||
import sun.nio.cs.HistoricallyNamedCharset;
|
||||
import static sun.nio.cs.CharsetMapping.*;
|
||||
|
||||
public class IBM420 extends Charset implements HistoricallyNamedCharset
|
||||
{
|
||||
public IBM420() {
|
||||
super("IBM420", ExtendedCharsets.aliasesFor("IBM420"));
|
||||
}
|
||||
|
||||
public String historicalName() {
|
||||
return "Cp420";
|
||||
}
|
||||
|
||||
public boolean contains(Charset cs) {
|
||||
return (cs instanceof IBM420);
|
||||
}
|
||||
|
||||
public CharsetDecoder newDecoder() {
|
||||
return new SingleByte.Decoder(this, b2c);
|
||||
}
|
||||
|
||||
public CharsetEncoder newEncoder() {
|
||||
return new SingleByte.Encoder(this, c2b, c2bIndex);
|
||||
}
|
||||
|
||||
private final static String b2cTable =
|
||||
"\u0634\u0061\u0062\u0063\u0064\u0065\u0066\u0067" + // 0x80 - 0x87
|
||||
"\u0068\u0069\uFEB7\u0635\uFEBB\u0636\uFEBF\u0637" + // 0x88 - 0x8f
|
||||
"\u0638\u006A\u006B\u006C\u006D\u006E\u006F\u0070" + // 0x90 - 0x97
|
||||
"\u0071\u0072\u0639\uFECA\uFECB\uFECC\u063A\uFECE" + // 0x98 - 0x9f
|
||||
"\uFECF\u00F7\u0073\u0074\u0075\u0076\u0077\u0078" + // 0xa0 - 0xa7
|
||||
"\u0079\u007A\uFED0\u0641\uFED3\u0642\uFED7\u0643" + // 0xa8 - 0xaf
|
||||
"\uFEDB\u0644\uFEF5\uFEF6\uFEF7\uFEF8\uFFFD\uFFFD" + // 0xb0 - 0xb7
|
||||
"\uFEFB\uFEFC\uFEDF\u0645\uFEE3\u0646\uFEE7\u0647" + // 0xb8 - 0xbf
|
||||
"\u061B\u0041\u0042\u0043\u0044\u0045\u0046\u0047" + // 0xc0 - 0xc7
|
||||
"\u0048\u0049\u00AD\uFEEB\uFFFD\uFEEC\uFFFD\u0648" + // 0xc8 - 0xcf
|
||||
"\u061F\u004A\u004B\u004C\u004D\u004E\u004F\u0050" + // 0xd0 - 0xd7
|
||||
"\u0051\u0052\u0649\uFEF0\u064A\uFEF2\uFEF3\u0660" + // 0xd8 - 0xdf
|
||||
"\u00D7\uFFFD\u0053\u0054\u0055\u0056\u0057\u0058" + // 0xe0 - 0xe7
|
||||
"\u0059\u005A\u0661\u0662\uFFFD\u0663\u0664\u0665" + // 0xe8 - 0xef
|
||||
"\u0030\u0031\u0032\u0033\u0034\u0035\u0036\u0037" + // 0xf0 - 0xf7
|
||||
"\u0038\u0039\uFFFD\u0666\u0667\u0668\u0669\u009F" + // 0xf8 - 0xff
|
||||
"\u0000\u0001\u0002\u0003\u009C\t\u0086\u007F" + // 0x00 - 0x07
|
||||
"\u0097\u008D\u008E\u000B\f\r\u000E\u000F" + // 0x08 - 0x0f
|
||||
"\u0010\u0011\u0012\u0013\u009D\n\b\u0087" + // 0x10 - 0x17
|
||||
"\u0018\u0019\u0092\u008F\u001C\u001D\u001E\u001F" + // 0x18 - 0x1f
|
||||
"\u0080\u0081\u0082\u0083\u0084\n\u0017\u001B" + // 0x20 - 0x27
|
||||
"\u0088\u0089\u008A\u008B\u008C\u0005\u0006\u0007" + // 0x28 - 0x2f
|
||||
"\u0090\u0091\u0016\u0093\u0094\u0095\u0096\u0004" + // 0x30 - 0x37
|
||||
"\u0098\u0099\u009A\u009B\u0014\u0015\u009E\u001A" + // 0x38 - 0x3f
|
||||
"\u0020\u00A0\u0651\uFE7D\u0640\u200B\u0621\u0622" + // 0x40 - 0x47
|
||||
"\uFE82\u0623\u00A2\u002E\u003C\u0028\u002B\u007C" + // 0x48 - 0x4f
|
||||
"\u0026\uFE84\u0624\uFFFD\uFFFD\u0626\u0627\uFE8E" + // 0x50 - 0x57
|
||||
"\u0628\uFE91\u0021\u0024\u002A\u0029\u003B\u00AC" + // 0x58 - 0x5f
|
||||
"\u002D\u002F\u0629\u062A\uFE97\u062B\uFE9B\u062C" + // 0x60 - 0x67
|
||||
"\uFE9F\u062D\u00A6\u002C\u0025\u005F\u003E\u003F" + // 0x68 - 0x6f
|
||||
"\uFEA3\u062E\uFEA7\u062F\u0630\u0631\u0632\u0633" + // 0x70 - 0x77
|
||||
"\uFEB3\u060C\u003A\u0023\u0040\'\u003D\"" ; // 0x78 - 0x7f
|
||||
|
||||
|
||||
private final static char[] b2c = b2cTable.toCharArray();
|
||||
private final static char[] c2b = new char[0x500];
|
||||
private final static char[] c2bIndex = new char[0x100];
|
||||
|
||||
static {
|
||||
char[] b2cMap = b2c;
|
||||
char[] c2bNR = null;
|
||||
// remove non-roundtrip entries
|
||||
b2cMap = b2cTable.toCharArray();
|
||||
b2cMap[165] = UNMAPPABLE_DECODING;
|
||||
|
||||
// non-roundtrip c2b only entries
|
||||
c2bNR = (
|
||||
"\u0015\u0085\u0042\uFE7C\u0046\uFE80\u0047\uFE81" +
|
||||
"\u0049\uFE83\u004B\u066C\u004B\uFF0E\u004C\uFF1C" +
|
||||
"\u004D\uFF08\u004E\uFF0B\u004F\uFF5C\u0050\uFF06" +
|
||||
"\u0052\uFE85\u0052\uFE86\u0055\uFE89\u0055\uFE8A" +
|
||||
"\u0055\uFE8B\u0055\uFE8C\u0056\u0625\u0056\uFE87" +
|
||||
"\u0056\uFE8D\u0057\uFE88\u0058\uFE8F\u0058\uFE90" +
|
||||
"\u0059\uFE92\u005A\uFF01\u005B\uFF04\\\u066D" +
|
||||
"\\\uFF0A\u005D\uFF09\u005E\uFF1B\u0060\uFF0D" +
|
||||
"\u0061\uFF0F\u0062\uFE93\u0062\uFE94\u0063\uFE95" +
|
||||
"\u0063\uFE96\u0064\uFE98\u0065\uFE99\u0065\uFE9A" +
|
||||
"\u0066\uFE9C\u0067\uFE9D\u0067\uFE9E\u0068\uFEA0" +
|
||||
"\u0069\uFEA1\u0069\uFEA2\u006B\u066B\u006B\uFF0C" +
|
||||
"\u006C\u066A\u006C\uFF05\u006D\uFF3F\u006E\uFF1E" +
|
||||
"\u006F\uFF1F\u0070\uFEA4\u0071\uFEA5\u0071\uFEA6" +
|
||||
"\u0072\uFEA8\u0073\uFEA9\u0073\uFEAA\u0074\uFEAB" +
|
||||
"\u0074\uFEAC\u0075\uFEAD\u0075\uFEAE\u0076\uFEAF" +
|
||||
"\u0076\uFEB0\u0077\uFEB1\u0077\uFEB2\u0078\uFEB4" +
|
||||
"\u007A\uFF1A\u007B\uFF03\u007C\uFF20\u007D\uFF07" +
|
||||
"\u007E\uFF1D\u007F\uFF02\u0080\uFEB5\u0080\uFEB6" +
|
||||
"\u0081\uFF41\u0082\uFF42\u0083\uFF43\u0084\uFF44" +
|
||||
"\u0085\uFF45\u0086\uFF46\u0087\uFF47\u0088\uFF48" +
|
||||
"\u0089\uFF49\u008A\uFEB8\u008B\uFEB9\u008B\uFEBA" +
|
||||
"\u008C\uFEBC\u008D\uFEBD\u008D\uFEBE\u008E\uFEC0" +
|
||||
"\u008F\uFEC1\u008F\uFEC2\u008F\uFEC3\u008F\uFEC4" +
|
||||
"\u0090\uFEC5\u0090\uFEC6\u0090\uFEC7\u0090\uFEC8" +
|
||||
"\u0091\uFF4A\u0092\uFF4B\u0093\uFF4C\u0094\uFF4D" +
|
||||
"\u0095\uFF4E\u0096\uFF4F\u0097\uFF50\u0098\uFF51" +
|
||||
"\u0099\uFF52\u009A\uFEC9\u009E\uFECD\u00A2\uFF53" +
|
||||
"\u00A3\uFF54\u00A4\uFF55\u00A5\uFF56\u00A6\uFF57" +
|
||||
"\u00A7\uFF58\u00A8\uFF59\u00A9\uFF5A\u00AB\uFED1" +
|
||||
"\u00AB\uFED2\u00AC\uFED4\u00AD\uFED5\u00AD\uFED6" +
|
||||
"\u00AE\uFED8\u00AF\uFED9\u00AF\uFEDA\u00B0\uFEDC" +
|
||||
"\u00B1\uFEDD\u00B1\uFEDE\u00B8\uFEF9\u00B9\uFEFA" +
|
||||
"\u00BA\uFEE0\u00BB\uFEE1\u00BB\uFEE2\u00BC\uFEE4" +
|
||||
"\u00BD\uFEE5\u00BD\uFEE6\u00BE\uFEE8\u00BF\uFEE9" +
|
||||
"\u00BF\uFEEA\u00C1\uFF21\u00C2\uFF22\u00C3\uFF23" +
|
||||
"\u00C4\uFF24\u00C5\uFF25\u00C6\uFF26\u00C7\uFF27" +
|
||||
"\u00C8\uFF28\u00C9\uFF29\u00CF\uFEED\u00CF\uFEEE" +
|
||||
"\u00D1\uFF2A\u00D2\uFF2B\u00D3\uFF2C\u00D4\uFF2D" +
|
||||
"\u00D5\uFF2E\u00D6\uFF2F\u00D7\uFF30\u00D8\uFF31" +
|
||||
"\u00D9\uFF32\u00DA\uFEEF\u00DC\uFEF1\u00DE\uFEF4" +
|
||||
"\u00E2\uFF33\u00E3\uFF34\u00E4\uFF35\u00E5\uFF36" +
|
||||
"\u00E6\uFF37\u00E7\uFF38\u00E8\uFF39\u00E9\uFF3A" +
|
||||
"\u00F0\uFF10\u00F1\uFF11\u00F2\uFF12\u00F3\uFF13" +
|
||||
"\u00F4\uFF14\u00F5\uFF15\u00F6\uFF16\u00F7\uFF17" +
|
||||
"\u00F8\uFF18\u00F9\uFF19").toCharArray();
|
||||
|
||||
SingleByte.initC2B(b2cMap, c2bNR, c2b, c2bIndex);
|
||||
}
|
||||
}
|
||||
110
jdkSrc/jdk8/sun/nio/cs/ext/IBM424.java
Normal file
110
jdkSrc/jdk8/sun/nio/cs/ext/IBM424.java
Normal file
@@ -0,0 +1,110 @@
|
||||
/*
|
||||
* Copyright (c) 2008, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package sun.nio.cs.ext;
|
||||
|
||||
import java.nio.charset.Charset;
|
||||
import java.nio.charset.CharsetDecoder;
|
||||
import java.nio.charset.CharsetEncoder;
|
||||
import sun.nio.cs.StandardCharsets;
|
||||
import sun.nio.cs.SingleByte;
|
||||
import sun.nio.cs.HistoricallyNamedCharset;
|
||||
import static sun.nio.cs.CharsetMapping.*;
|
||||
|
||||
public class IBM424 extends Charset implements HistoricallyNamedCharset
|
||||
{
|
||||
public IBM424() {
|
||||
super("IBM424", ExtendedCharsets.aliasesFor("IBM424"));
|
||||
}
|
||||
|
||||
public String historicalName() {
|
||||
return "Cp424";
|
||||
}
|
||||
|
||||
public boolean contains(Charset cs) {
|
||||
return (cs instanceof IBM424);
|
||||
}
|
||||
|
||||
public CharsetDecoder newDecoder() {
|
||||
return new SingleByte.Decoder(this, b2c);
|
||||
}
|
||||
|
||||
public CharsetEncoder newEncoder() {
|
||||
return new SingleByte.Encoder(this, c2b, c2bIndex);
|
||||
}
|
||||
|
||||
private final static String b2cTable =
|
||||
"\uFFFD\u0061\u0062\u0063\u0064\u0065\u0066\u0067" + // 0x80 - 0x87
|
||||
"\u0068\u0069\u00AB\u00BB\uFFFD\uFFFD\uFFFD\u00B1" + // 0x88 - 0x8f
|
||||
"\u00B0\u006A\u006B\u006C\u006D\u006E\u006F\u0070" + // 0x90 - 0x97
|
||||
"\u0071\u0072\uFFFD\uFFFD\uFFFD\u00B8\uFFFD\u00A4" + // 0x98 - 0x9f
|
||||
"\u00B5\u007E\u0073\u0074\u0075\u0076\u0077\u0078" + // 0xa0 - 0xa7
|
||||
"\u0079\u007A\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\u00AE" + // 0xa8 - 0xaf
|
||||
"\u005E\u00A3\u00A5\u2022\u00A9\u00A7\u00B6\u00BC" + // 0xb0 - 0xb7
|
||||
"\u00BD\u00BE\u005B\u005D\u203E\u00A8\u00B4\u00D7" + // 0xb8 - 0xbf
|
||||
"\u007B\u0041\u0042\u0043\u0044\u0045\u0046\u0047" + // 0xc0 - 0xc7
|
||||
"\u0048\u0049\u00AD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD" + // 0xc8 - 0xcf
|
||||
"\u007D\u004A\u004B\u004C\u004D\u004E\u004F\u0050" + // 0xd0 - 0xd7
|
||||
"\u0051\u0052\u00B9\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD" + // 0xd8 - 0xdf
|
||||
"\\\u00F7\u0053\u0054\u0055\u0056\u0057\u0058" + // 0xe0 - 0xe7
|
||||
"\u0059\u005A\u00B2\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD" + // 0xe8 - 0xef
|
||||
"\u0030\u0031\u0032\u0033\u0034\u0035\u0036\u0037" + // 0xf0 - 0xf7
|
||||
"\u0038\u0039\u00B3\uFFFD\uFFFD\uFFFD\uFFFD\u009F" + // 0xf8 - 0xff
|
||||
"\u0000\u0001\u0002\u0003\u009C\t\u0086\u007F" + // 0x00 - 0x07
|
||||
"\u0097\u008D\u008E\u000B\f\r\u000E\u000F" + // 0x08 - 0x0f
|
||||
"\u0010\u0011\u0012\u0013\u009D\n\b\u0087" + // 0x10 - 0x17
|
||||
"\u0018\u0019\u0092\u008F\u001C\u001D\u001E\u001F" + // 0x18 - 0x1f
|
||||
"\u0080\u0081\u0082\u0083\u0084\n\u0017\u001B" + // 0x20 - 0x27
|
||||
"\u0088\u0089\u008A\u008B\u008C\u0005\u0006\u0007" + // 0x28 - 0x2f
|
||||
"\u0090\u0091\u0016\u0093\u0094\u0095\u0096\u0004" + // 0x30 - 0x37
|
||||
"\u0098\u0099\u009A\u009B\u0014\u0015\u009E\u001A" + // 0x38 - 0x3f
|
||||
"\u0020\u05D0\u05D1\u05D2\u05D3\u05D4\u05D5\u05D6" + // 0x40 - 0x47
|
||||
"\u05D7\u05D8\u00A2\u002E\u003C\u0028\u002B\u007C" + // 0x48 - 0x4f
|
||||
"\u0026\u05D9\u05DA\u05DB\u05DC\u05DD\u05DE\u05DF" + // 0x50 - 0x57
|
||||
"\u05E0\u05E1\u0021\u0024\u002A\u0029\u003B\u00AC" + // 0x58 - 0x5f
|
||||
"\u002D\u002F\u05E2\u05E3\u05E4\u05E5\u05E6\u05E7" + // 0x60 - 0x67
|
||||
"\u05E8\u05E9\u00A6\u002C\u0025\u005F\u003E\u003F" + // 0x68 - 0x6f
|
||||
"\uFFFD\u05EA\uFFFD\uFFFD\u00A0\uFFFD\uFFFD\uFFFD" + // 0x70 - 0x77
|
||||
"\u2017\u0060\u003A\u0023\u0040\'\u003D\"" ; // 0x78 - 0x7f
|
||||
|
||||
|
||||
private final static char[] b2c = b2cTable.toCharArray();
|
||||
private final static char[] c2b = new char[0x400];
|
||||
private final static char[] c2bIndex = new char[0x100];
|
||||
|
||||
static {
|
||||
char[] b2cMap = b2c;
|
||||
char[] c2bNR = null;
|
||||
// remove non-roundtrip entries
|
||||
b2cMap = b2cTable.toCharArray();
|
||||
b2cMap[165] = UNMAPPABLE_DECODING;
|
||||
|
||||
// non-roundtrip c2b only entries
|
||||
c2bNR = new char[2];
|
||||
c2bNR[0] = 0x15; c2bNR[1] = 0x85;
|
||||
|
||||
SingleByte.initC2B(b2cMap, c2bNR, c2b, c2bIndex);
|
||||
}
|
||||
}
|
||||
110
jdkSrc/jdk8/sun/nio/cs/ext/IBM500.java
Normal file
110
jdkSrc/jdk8/sun/nio/cs/ext/IBM500.java
Normal file
@@ -0,0 +1,110 @@
|
||||
/*
|
||||
* Copyright (c) 2008, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package sun.nio.cs.ext;
|
||||
|
||||
import java.nio.charset.Charset;
|
||||
import java.nio.charset.CharsetDecoder;
|
||||
import java.nio.charset.CharsetEncoder;
|
||||
import sun.nio.cs.StandardCharsets;
|
||||
import sun.nio.cs.SingleByte;
|
||||
import sun.nio.cs.HistoricallyNamedCharset;
|
||||
import static sun.nio.cs.CharsetMapping.*;
|
||||
|
||||
public class IBM500 extends Charset implements HistoricallyNamedCharset
|
||||
{
|
||||
public IBM500() {
|
||||
super("IBM500", ExtendedCharsets.aliasesFor("IBM500"));
|
||||
}
|
||||
|
||||
public String historicalName() {
|
||||
return "Cp500";
|
||||
}
|
||||
|
||||
public boolean contains(Charset cs) {
|
||||
return (cs instanceof IBM500);
|
||||
}
|
||||
|
||||
public CharsetDecoder newDecoder() {
|
||||
return new SingleByte.Decoder(this, b2c);
|
||||
}
|
||||
|
||||
public CharsetEncoder newEncoder() {
|
||||
return new SingleByte.Encoder(this, c2b, c2bIndex);
|
||||
}
|
||||
|
||||
private final static String b2cTable =
|
||||
"\u00D8\u0061\u0062\u0063\u0064\u0065\u0066\u0067" + // 0x80 - 0x87
|
||||
"\u0068\u0069\u00AB\u00BB\u00F0\u00FD\u00FE\u00B1" + // 0x88 - 0x8f
|
||||
"\u00B0\u006A\u006B\u006C\u006D\u006E\u006F\u0070" + // 0x90 - 0x97
|
||||
"\u0071\u0072\u00AA\u00BA\u00E6\u00B8\u00C6\u00A4" + // 0x98 - 0x9f
|
||||
"\u00B5\u007E\u0073\u0074\u0075\u0076\u0077\u0078" + // 0xa0 - 0xa7
|
||||
"\u0079\u007A\u00A1\u00BF\u00D0\u00DD\u00DE\u00AE" + // 0xa8 - 0xaf
|
||||
"\u00A2\u00A3\u00A5\u00B7\u00A9\u00A7\u00B6\u00BC" + // 0xb0 - 0xb7
|
||||
"\u00BD\u00BE\u00AC\u007C\u00AF\u00A8\u00B4\u00D7" + // 0xb8 - 0xbf
|
||||
"\u007B\u0041\u0042\u0043\u0044\u0045\u0046\u0047" + // 0xc0 - 0xc7
|
||||
"\u0048\u0049\u00AD\u00F4\u00F6\u00F2\u00F3\u00F5" + // 0xc8 - 0xcf
|
||||
"\u007D\u004A\u004B\u004C\u004D\u004E\u004F\u0050" + // 0xd0 - 0xd7
|
||||
"\u0051\u0052\u00B9\u00FB\u00FC\u00F9\u00FA\u00FF" + // 0xd8 - 0xdf
|
||||
"\\\u00F7\u0053\u0054\u0055\u0056\u0057\u0058" + // 0xe0 - 0xe7
|
||||
"\u0059\u005A\u00B2\u00D4\u00D6\u00D2\u00D3\u00D5" + // 0xe8 - 0xef
|
||||
"\u0030\u0031\u0032\u0033\u0034\u0035\u0036\u0037" + // 0xf0 - 0xf7
|
||||
"\u0038\u0039\u00B3\u00DB\u00DC\u00D9\u00DA\u009F" + // 0xf8 - 0xff
|
||||
"\u0000\u0001\u0002\u0003\u009C\t\u0086\u007F" + // 0x00 - 0x07
|
||||
"\u0097\u008D\u008E\u000B\f\r\u000E\u000F" + // 0x08 - 0x0f
|
||||
"\u0010\u0011\u0012\u0013\u009D\n\b\u0087" + // 0x10 - 0x17
|
||||
"\u0018\u0019\u0092\u008F\u001C\u001D\u001E\u001F" + // 0x18 - 0x1f
|
||||
"\u0080\u0081\u0082\u0083\u0084\n\u0017\u001B" + // 0x20 - 0x27
|
||||
"\u0088\u0089\u008A\u008B\u008C\u0005\u0006\u0007" + // 0x28 - 0x2f
|
||||
"\u0090\u0091\u0016\u0093\u0094\u0095\u0096\u0004" + // 0x30 - 0x37
|
||||
"\u0098\u0099\u009A\u009B\u0014\u0015\u009E\u001A" + // 0x38 - 0x3f
|
||||
"\u0020\u00A0\u00E2\u00E4\u00E0\u00E1\u00E3\u00E5" + // 0x40 - 0x47
|
||||
"\u00E7\u00F1\u005B\u002E\u003C\u0028\u002B\u0021" + // 0x48 - 0x4f
|
||||
"\u0026\u00E9\u00EA\u00EB\u00E8\u00ED\u00EE\u00EF" + // 0x50 - 0x57
|
||||
"\u00EC\u00DF\u005D\u0024\u002A\u0029\u003B\u005E" + // 0x58 - 0x5f
|
||||
"\u002D\u002F\u00C2\u00C4\u00C0\u00C1\u00C3\u00C5" + // 0x60 - 0x67
|
||||
"\u00C7\u00D1\u00A6\u002C\u0025\u005F\u003E\u003F" + // 0x68 - 0x6f
|
||||
"\u00F8\u00C9\u00CA\u00CB\u00C8\u00CD\u00CE\u00CF" + // 0x70 - 0x77
|
||||
"\u00CC\u0060\u003A\u0023\u0040\'\u003D\"" ; // 0x78 - 0x7f
|
||||
|
||||
|
||||
private final static char[] b2c = b2cTable.toCharArray();
|
||||
private final static char[] c2b = new char[0x100];
|
||||
private final static char[] c2bIndex = new char[0x100];
|
||||
|
||||
static {
|
||||
char[] b2cMap = b2c;
|
||||
char[] c2bNR = null;
|
||||
// remove non-roundtrip entries
|
||||
b2cMap = b2cTable.toCharArray();
|
||||
b2cMap[165] = UNMAPPABLE_DECODING;
|
||||
|
||||
// non-roundtrip c2b only entries
|
||||
c2bNR = new char[2];
|
||||
c2bNR[0] = 0x15; c2bNR[1] = 0x85;
|
||||
|
||||
SingleByte.initC2B(b2cMap, c2bNR, c2b, c2bIndex);
|
||||
}
|
||||
}
|
||||
199
jdkSrc/jdk8/sun/nio/cs/ext/IBM833.java
Normal file
199
jdkSrc/jdk8/sun/nio/cs/ext/IBM833.java
Normal file
@@ -0,0 +1,199 @@
|
||||
/*
|
||||
* Copyright (c) 2008, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package sun.nio.cs.ext;
|
||||
|
||||
import java.nio.charset.Charset;
|
||||
import java.nio.charset.CharsetDecoder;
|
||||
import java.nio.charset.CharsetEncoder;
|
||||
import sun.nio.cs.StandardCharsets;
|
||||
import sun.nio.cs.SingleByte;
|
||||
import sun.nio.cs.HistoricallyNamedCharset;
|
||||
import static sun.nio.cs.CharsetMapping.*;
|
||||
|
||||
public class IBM833 extends Charset implements HistoricallyNamedCharset
|
||||
{
|
||||
public IBM833() {
|
||||
super("x-IBM833", ExtendedCharsets.aliasesFor("x-IBM833"));
|
||||
}
|
||||
|
||||
public String historicalName() {
|
||||
return "Cp833";
|
||||
}
|
||||
|
||||
public boolean contains(Charset cs) {
|
||||
return (cs instanceof IBM833);
|
||||
}
|
||||
|
||||
public CharsetDecoder newDecoder() {
|
||||
return new SingleByte.Decoder(this, b2c);
|
||||
}
|
||||
|
||||
public CharsetEncoder newEncoder() {
|
||||
return new SingleByte.Encoder(this, c2b, c2bIndex);
|
||||
}
|
||||
|
||||
private final static String b2cTable =
|
||||
"\u005D\u0061\u0062\u0063\u0064\u0065\u0066\u0067" + // 0x80 - 0x87
|
||||
"\u0068\u0069\uFFC2\uFFC3\uFFC4\uFFC5\uFFC6\uFFC7" + // 0x88 - 0x8f
|
||||
"\uFFFD\u006A\u006B\u006C\u006D\u006E\u006F\u0070" + // 0x90 - 0x97
|
||||
"\u0071\u0072\uFFCA\uFFCB\uFFCC\uFFCD\uFFCE\uFFCF" + // 0x98 - 0x9f
|
||||
"\u203E\u007E\u0073\u0074\u0075\u0076\u0077\u0078" + // 0xa0 - 0xa7
|
||||
"\u0079\u007A\uFFD2\uFFD3\uFFD4\uFFD5\uFFD6\uFFD7" + // 0xa8 - 0xaf
|
||||
"\u005E\uFFFD\\\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD" + // 0xb0 - 0xb7
|
||||
"\uFFFD\uFFFD\uFFDA\uFFDB\uFFDC\uFFFD\uFFFD\uFFFD" + // 0xb8 - 0xbf
|
||||
"\u007B\u0041\u0042\u0043\u0044\u0045\u0046\u0047" + // 0xc0 - 0xc7
|
||||
"\u0048\u0049\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD" + // 0xc8 - 0xcf
|
||||
"\u007D\u004A\u004B\u004C\u004D\u004E\u004F\u0050" + // 0xd0 - 0xd7
|
||||
"\u0051\u0052\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD" + // 0xd8 - 0xdf
|
||||
"\u20A9\uFFFD\u0053\u0054\u0055\u0056\u0057\u0058" + // 0xe0 - 0xe7
|
||||
"\u0059\u005A\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD" + // 0xe8 - 0xef
|
||||
"\u0030\u0031\u0032\u0033\u0034\u0035\u0036\u0037" + // 0xf0 - 0xf7
|
||||
"\u0038\u0039\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\u009F" + // 0xf8 - 0xff
|
||||
"\u0000\u0001\u0002\u0003\u009C\t\u0086\u007F" + // 0x00 - 0x07
|
||||
"\u0097\u008D\u008E\u000B\f\r\u000E\u000F" + // 0x08 - 0x0f
|
||||
"\u0010\u0011\u0012\u0013\u009D\u0085\b\u0087" + // 0x10 - 0x17
|
||||
"\u0018\u0019\u0092\u008F\u001C\u001D\u001E\u001F" + // 0x18 - 0x1f
|
||||
"\u0080\u0081\u0082\u0083\u0084\n\u0017\u001B" + // 0x20 - 0x27
|
||||
"\u0088\u0089\u008A\u008B\u008C\u0005\u0006\u0007" + // 0x28 - 0x2f
|
||||
"\u0090\u0091\u0016\u0093\u0094\u0095\u0096\u0004" + // 0x30 - 0x37
|
||||
"\u0098\u0099\u009A\u009B\u0014\u0015\u009E\u001A" + // 0x38 - 0x3f
|
||||
"\u0020\uFFFD\uFFA0\uFFA1\uFFA2\uFFA3\uFFA4\uFFA5" + // 0x40 - 0x47
|
||||
"\uFFA6\uFFA7\u00A2\u002E\u003C\u0028\u002B\u007C" + // 0x48 - 0x4f
|
||||
"\u0026\uFFFD\uFFA8\uFFA9\uFFAA\uFFAB\uFFAC\uFFAD" + // 0x50 - 0x57
|
||||
"\uFFAE\uFFAF\u0021\u0024\u002A\u0029\u003B\u00AC" + // 0x58 - 0x5f
|
||||
"\u002D\u002F\uFFB0\uFFB1\uFFB2\uFFB3\uFFB4\uFFB5" + // 0x60 - 0x67
|
||||
"\uFFB6\uFFB7\u00A6\u002C\u0025\u005F\u003E\u003F" + // 0x68 - 0x6f
|
||||
"\u005B\uFFFD\uFFB8\uFFB9\uFFBA\uFFBB\uFFBC\uFFBD" + // 0x70 - 0x77
|
||||
"\uFFBE\u0060\u003A\u0023\u0040\'\u003D\"" ; // 0x78 - 0x7f
|
||||
|
||||
|
||||
private final static char[] b2c = b2cTable.toCharArray();
|
||||
private final static char[] c2b = new char[0x300];
|
||||
private final static char[] c2bIndex = new char[0x100];
|
||||
|
||||
static {
|
||||
char[] b2cMap = b2c;
|
||||
char[] c2bNR = null;
|
||||
// non-roundtrip c2b only entries
|
||||
c2bNR = new char[188];
|
||||
c2bNR[0] = 0x5a; c2bNR[1] = 0xff01;
|
||||
c2bNR[2] = 0x7f; c2bNR[3] = 0xff02;
|
||||
c2bNR[4] = 0x7b; c2bNR[5] = 0xff03;
|
||||
c2bNR[6] = 0x5b; c2bNR[7] = 0xff04;
|
||||
c2bNR[8] = 0x6c; c2bNR[9] = 0xff05;
|
||||
c2bNR[10] = 0x50; c2bNR[11] = 0xff06;
|
||||
c2bNR[12] = 0x7d; c2bNR[13] = 0xff07;
|
||||
c2bNR[14] = 0x4d; c2bNR[15] = 0xff08;
|
||||
c2bNR[16] = 0x5d; c2bNR[17] = 0xff09;
|
||||
c2bNR[18] = 0x5c; c2bNR[19] = 0xff0a;
|
||||
c2bNR[20] = 0x4e; c2bNR[21] = 0xff0b;
|
||||
c2bNR[22] = 0x6b; c2bNR[23] = 0xff0c;
|
||||
c2bNR[24] = 0x60; c2bNR[25] = 0xff0d;
|
||||
c2bNR[26] = 0x4b; c2bNR[27] = 0xff0e;
|
||||
c2bNR[28] = 0x61; c2bNR[29] = 0xff0f;
|
||||
c2bNR[30] = 0xf0; c2bNR[31] = 0xff10;
|
||||
c2bNR[32] = 0xf1; c2bNR[33] = 0xff11;
|
||||
c2bNR[34] = 0xf2; c2bNR[35] = 0xff12;
|
||||
c2bNR[36] = 0xf3; c2bNR[37] = 0xff13;
|
||||
c2bNR[38] = 0xf4; c2bNR[39] = 0xff14;
|
||||
c2bNR[40] = 0xf5; c2bNR[41] = 0xff15;
|
||||
c2bNR[42] = 0xf6; c2bNR[43] = 0xff16;
|
||||
c2bNR[44] = 0xf7; c2bNR[45] = 0xff17;
|
||||
c2bNR[46] = 0xf8; c2bNR[47] = 0xff18;
|
||||
c2bNR[48] = 0xf9; c2bNR[49] = 0xff19;
|
||||
c2bNR[50] = 0x7a; c2bNR[51] = 0xff1a;
|
||||
c2bNR[52] = 0x5e; c2bNR[53] = 0xff1b;
|
||||
c2bNR[54] = 0x4c; c2bNR[55] = 0xff1c;
|
||||
c2bNR[56] = 0x7e; c2bNR[57] = 0xff1d;
|
||||
c2bNR[58] = 0x6e; c2bNR[59] = 0xff1e;
|
||||
c2bNR[60] = 0x6f; c2bNR[61] = 0xff1f;
|
||||
c2bNR[62] = 0x7c; c2bNR[63] = 0xff20;
|
||||
c2bNR[64] = 0xc1; c2bNR[65] = 0xff21;
|
||||
c2bNR[66] = 0xc2; c2bNR[67] = 0xff22;
|
||||
c2bNR[68] = 0xc3; c2bNR[69] = 0xff23;
|
||||
c2bNR[70] = 0xc4; c2bNR[71] = 0xff24;
|
||||
c2bNR[72] = 0xc5; c2bNR[73] = 0xff25;
|
||||
c2bNR[74] = 0xc6; c2bNR[75] = 0xff26;
|
||||
c2bNR[76] = 0xc7; c2bNR[77] = 0xff27;
|
||||
c2bNR[78] = 0xc8; c2bNR[79] = 0xff28;
|
||||
c2bNR[80] = 0xc9; c2bNR[81] = 0xff29;
|
||||
c2bNR[82] = 0xd1; c2bNR[83] = 0xff2a;
|
||||
c2bNR[84] = 0xd2; c2bNR[85] = 0xff2b;
|
||||
c2bNR[86] = 0xd3; c2bNR[87] = 0xff2c;
|
||||
c2bNR[88] = 0xd4; c2bNR[89] = 0xff2d;
|
||||
c2bNR[90] = 0xd5; c2bNR[91] = 0xff2e;
|
||||
c2bNR[92] = 0xd6; c2bNR[93] = 0xff2f;
|
||||
c2bNR[94] = 0xd7; c2bNR[95] = 0xff30;
|
||||
c2bNR[96] = 0xd8; c2bNR[97] = 0xff31;
|
||||
c2bNR[98] = 0xd9; c2bNR[99] = 0xff32;
|
||||
c2bNR[100] = 0xe2; c2bNR[101] = 0xff33;
|
||||
c2bNR[102] = 0xe3; c2bNR[103] = 0xff34;
|
||||
c2bNR[104] = 0xe4; c2bNR[105] = 0xff35;
|
||||
c2bNR[106] = 0xe5; c2bNR[107] = 0xff36;
|
||||
c2bNR[108] = 0xe6; c2bNR[109] = 0xff37;
|
||||
c2bNR[110] = 0xe7; c2bNR[111] = 0xff38;
|
||||
c2bNR[112] = 0xe8; c2bNR[113] = 0xff39;
|
||||
c2bNR[114] = 0xe9; c2bNR[115] = 0xff3a;
|
||||
c2bNR[116] = 0x70; c2bNR[117] = 0xff3b;
|
||||
c2bNR[118] = 0xb2; c2bNR[119] = 0xff3c;
|
||||
c2bNR[120] = 0x80; c2bNR[121] = 0xff3d;
|
||||
c2bNR[122] = 0xb0; c2bNR[123] = 0xff3e;
|
||||
c2bNR[124] = 0x6d; c2bNR[125] = 0xff3f;
|
||||
c2bNR[126] = 0x79; c2bNR[127] = 0xff40;
|
||||
c2bNR[128] = 0x81; c2bNR[129] = 0xff41;
|
||||
c2bNR[130] = 0x82; c2bNR[131] = 0xff42;
|
||||
c2bNR[132] = 0x83; c2bNR[133] = 0xff43;
|
||||
c2bNR[134] = 0x84; c2bNR[135] = 0xff44;
|
||||
c2bNR[136] = 0x85; c2bNR[137] = 0xff45;
|
||||
c2bNR[138] = 0x86; c2bNR[139] = 0xff46;
|
||||
c2bNR[140] = 0x87; c2bNR[141] = 0xff47;
|
||||
c2bNR[142] = 0x88; c2bNR[143] = 0xff48;
|
||||
c2bNR[144] = 0x89; c2bNR[145] = 0xff49;
|
||||
c2bNR[146] = 0x91; c2bNR[147] = 0xff4a;
|
||||
c2bNR[148] = 0x92; c2bNR[149] = 0xff4b;
|
||||
c2bNR[150] = 0x93; c2bNR[151] = 0xff4c;
|
||||
c2bNR[152] = 0x94; c2bNR[153] = 0xff4d;
|
||||
c2bNR[154] = 0x95; c2bNR[155] = 0xff4e;
|
||||
c2bNR[156] = 0x96; c2bNR[157] = 0xff4f;
|
||||
c2bNR[158] = 0x97; c2bNR[159] = 0xff50;
|
||||
c2bNR[160] = 0x98; c2bNR[161] = 0xff51;
|
||||
c2bNR[162] = 0x99; c2bNR[163] = 0xff52;
|
||||
c2bNR[164] = 0xa2; c2bNR[165] = 0xff53;
|
||||
c2bNR[166] = 0xa3; c2bNR[167] = 0xff54;
|
||||
c2bNR[168] = 0xa4; c2bNR[169] = 0xff55;
|
||||
c2bNR[170] = 0xa5; c2bNR[171] = 0xff56;
|
||||
c2bNR[172] = 0xa6; c2bNR[173] = 0xff57;
|
||||
c2bNR[174] = 0xa7; c2bNR[175] = 0xff58;
|
||||
c2bNR[176] = 0xa8; c2bNR[177] = 0xff59;
|
||||
c2bNR[178] = 0xa9; c2bNR[179] = 0xff5a;
|
||||
c2bNR[180] = 0xc0; c2bNR[181] = 0xff5b;
|
||||
c2bNR[182] = 0x4f; c2bNR[183] = 0xff5c;
|
||||
c2bNR[184] = 0xd0; c2bNR[185] = 0xff5d;
|
||||
c2bNR[186] = 0xa1; c2bNR[187] = 0xff5e;
|
||||
|
||||
SingleByte.initC2B(b2cMap, c2bNR, c2b, c2bIndex);
|
||||
}
|
||||
}
|
||||
97
jdkSrc/jdk8/sun/nio/cs/ext/IBM834.java
Normal file
97
jdkSrc/jdk8/sun/nio/cs/ext/IBM834.java
Normal file
@@ -0,0 +1,97 @@
|
||||
|
||||
/*
|
||||
* Copyright (c) 2006, 2012, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
/*
|
||||
*/
|
||||
|
||||
package sun.nio.cs.ext;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
import java.nio.charset.Charset;
|
||||
import java.nio.charset.CharsetDecoder;
|
||||
import java.nio.charset.CharsetEncoder;
|
||||
import java.nio.charset.CoderResult;
|
||||
import static sun.nio.cs.CharsetMapping.*;
|
||||
|
||||
// EBCDIC DBCS-only Korean
|
||||
public class IBM834 extends Charset
|
||||
{
|
||||
public IBM834() {
|
||||
super("x-IBM834", ExtendedCharsets.aliasesFor("x-IBM834"));
|
||||
}
|
||||
|
||||
public boolean contains(Charset cs) {
|
||||
return (cs instanceof IBM834);
|
||||
}
|
||||
|
||||
public CharsetDecoder newDecoder() {
|
||||
IBM933.initb2c();
|
||||
return new DoubleByte.Decoder_DBCSONLY(
|
||||
this, IBM933.b2c, null, 0x40, 0xfe); // hardcode the b2min/max
|
||||
}
|
||||
|
||||
public CharsetEncoder newEncoder() {
|
||||
IBM933.initc2b();
|
||||
return new Encoder(this);
|
||||
}
|
||||
|
||||
protected static class Encoder extends DoubleByte.Encoder_DBCSONLY {
|
||||
public Encoder(Charset cs) {
|
||||
super(cs, new byte[] {(byte)0xfe, (byte)0xfe},
|
||||
IBM933.c2b, IBM933.c2bIndex);
|
||||
}
|
||||
|
||||
public int encodeChar(char ch) {
|
||||
int bb = super.encodeChar(ch);
|
||||
if (bb == UNMAPPABLE_ENCODING) {
|
||||
// Cp834 has 6 additional non-roundtrip char->bytes
|
||||
// mappings, see#6379808
|
||||
if (ch == '\u00b7') {
|
||||
return 0x4143;
|
||||
} else if (ch == '\u00ad') {
|
||||
return 0x4148;
|
||||
} else if (ch == '\u2015') {
|
||||
return 0x4149;
|
||||
} else if (ch == '\u223c') {
|
||||
return 0x42a1;
|
||||
} else if (ch == '\uff5e') {
|
||||
return 0x4954;
|
||||
} else if (ch == '\u2299') {
|
||||
return 0x496f;
|
||||
}
|
||||
}
|
||||
return bb;
|
||||
}
|
||||
|
||||
public boolean isLegalReplacement(byte[] repl) {
|
||||
if (repl.length == 2 &&
|
||||
repl[0] == (byte)0xfe && repl[1] == (byte)0xfe)
|
||||
return true;
|
||||
return super.isLegalReplacement(repl);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
115
jdkSrc/jdk8/sun/nio/cs/ext/IBM838.java
Normal file
115
jdkSrc/jdk8/sun/nio/cs/ext/IBM838.java
Normal file
@@ -0,0 +1,115 @@
|
||||
/*
|
||||
* Copyright (c) 2008, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package sun.nio.cs.ext;
|
||||
|
||||
import java.nio.charset.Charset;
|
||||
import java.nio.charset.CharsetDecoder;
|
||||
import java.nio.charset.CharsetEncoder;
|
||||
import sun.nio.cs.StandardCharsets;
|
||||
import sun.nio.cs.SingleByte;
|
||||
import sun.nio.cs.HistoricallyNamedCharset;
|
||||
import static sun.nio.cs.CharsetMapping.*;
|
||||
|
||||
public class IBM838 extends Charset implements HistoricallyNamedCharset
|
||||
{
|
||||
public IBM838() {
|
||||
super("IBM-Thai", ExtendedCharsets.aliasesFor("IBM-Thai"));
|
||||
}
|
||||
|
||||
public String historicalName() {
|
||||
return "Cp838";
|
||||
}
|
||||
|
||||
public boolean contains(Charset cs) {
|
||||
return (cs instanceof IBM838);
|
||||
}
|
||||
|
||||
public CharsetDecoder newDecoder() {
|
||||
return new SingleByte.Decoder(this, b2c);
|
||||
}
|
||||
|
||||
public CharsetEncoder newEncoder() {
|
||||
return new SingleByte.Encoder(this, c2b, c2bIndex);
|
||||
}
|
||||
|
||||
private final static String b2cTable =
|
||||
"\u0E4F\u0061\u0062\u0063\u0064\u0065\u0066\u0067" + // 0x80 - 0x87
|
||||
"\u0068\u0069\u0E1D\u0E1E\u0E1F\u0E20\u0E21\u0E22" + // 0x88 - 0x8f
|
||||
"\u0E5A\u006A\u006B\u006C\u006D\u006E\u006F\u0070" + // 0x90 - 0x97
|
||||
"\u0071\u0072\u0E23\u0E24\u0E25\u0E26\u0E27\u0E28" + // 0x98 - 0x9f
|
||||
"\u0E5B\u007E\u0073\u0074\u0075\u0076\u0077\u0078" + // 0xa0 - 0xa7
|
||||
"\u0079\u007A\u0E29\u0E2A\u0E2B\u0E2C\u0E2D\u0E2E" + // 0xa8 - 0xaf
|
||||
"\u0E50\u0E51\u0E52\u0E53\u0E54\u0E55\u0E56\u0E57" + // 0xb0 - 0xb7
|
||||
"\u0E58\u0E59\u0E2F\u0E30\u0E31\u0E32\u0E33\u0E34" + // 0xb8 - 0xbf
|
||||
"\u007B\u0041\u0042\u0043\u0044\u0045\u0046\u0047" + // 0xc0 - 0xc7
|
||||
"\u0048\u0049\u0E49\u0E35\u0E36\u0E37\u0E38\u0E39" + // 0xc8 - 0xcf
|
||||
"\u007D\u004A\u004B\u004C\u004D\u004E\u004F\u0050" + // 0xd0 - 0xd7
|
||||
"\u0051\u0052\u0E3A\u0E40\u0E41\u0E42\u0E43\u0E44" + // 0xd8 - 0xdf
|
||||
"\\\u0E4A\u0053\u0054\u0055\u0056\u0057\u0058" + // 0xe0 - 0xe7
|
||||
"\u0059\u005A\u0E45\u0E46\u0E47\u0E48\u0E49\u0E4A" + // 0xe8 - 0xef
|
||||
"\u0030\u0031\u0032\u0033\u0034\u0035\u0036\u0037" + // 0xf0 - 0xf7
|
||||
"\u0038\u0039\u0E4B\u0E4C\u0E4D\u0E4B\u0E4C\u009F" + // 0xf8 - 0xff
|
||||
"\u0000\u0001\u0002\u0003\u009C\t\u0086\u007F" + // 0x00 - 0x07
|
||||
"\u0097\u008D\u008E\u000B\f\r\u000E\u000F" + // 0x08 - 0x0f
|
||||
"\u0010\u0011\u0012\u0013\u009D\n\b\u0087" + // 0x10 - 0x17
|
||||
"\u0018\u0019\u0092\u008F\u001C\u001D\u001E\u001F" + // 0x18 - 0x1f
|
||||
"\u0080\u0081\u0082\u0083\u0084\n\u0017\u001B" + // 0x20 - 0x27
|
||||
"\u0088\u0089\u008A\u008B\u008C\u0005\u0006\u0007" + // 0x28 - 0x2f
|
||||
"\u0090\u0091\u0016\u0093\u0094\u0095\u0096\u0004" + // 0x30 - 0x37
|
||||
"\u0098\u0099\u009A\u009B\u0014\u0015\u009E\u001A" + // 0x38 - 0x3f
|
||||
"\u0020\u00A0\u0E01\u0E02\u0E03\u0E04\u0E05\u0E06" + // 0x40 - 0x47
|
||||
"\u0E07\u005B\u00A2\u002E\u003C\u0028\u002B\u007C" + // 0x48 - 0x4f
|
||||
"\u0026\u0E48\u0E08\u0E09\u0E0A\u0E0B\u0E0C\u0E0D" + // 0x50 - 0x57
|
||||
"\u0E0E\u005D\u0021\u0024\u002A\u0029\u003B\u00AC" + // 0x58 - 0x5f
|
||||
"\u002D\u002F\u0E0F\u0E10\u0E11\u0E12\u0E13\u0E14" + // 0x60 - 0x67
|
||||
"\u0E15\u005E\u00A6\u002C\u0025\u005F\u003E\u003F" + // 0x68 - 0x6f
|
||||
"\u0E3F\u0E4E\u0E16\u0E17\u0E18\u0E19\u0E1A\u0E1B" + // 0x70 - 0x77
|
||||
"\u0E1C\u0060\u003A\u0023\u0040\'\u003D\"" ; // 0x78 - 0x7f
|
||||
|
||||
|
||||
private final static char[] b2c = b2cTable.toCharArray();
|
||||
private final static char[] c2b = new char[0x200];
|
||||
private final static char[] c2bIndex = new char[0x100];
|
||||
|
||||
static {
|
||||
char[] b2cMap = b2c;
|
||||
char[] c2bNR = null;
|
||||
// remove non-roundtrip entries
|
||||
b2cMap = b2cTable.toCharArray();
|
||||
b2cMap[165] = UNMAPPABLE_DECODING;
|
||||
b2cMap[209] = UNMAPPABLE_DECODING;
|
||||
b2cMap[74] = UNMAPPABLE_DECODING;
|
||||
b2cMap[97] = UNMAPPABLE_DECODING;
|
||||
b2cMap[125] = UNMAPPABLE_DECODING;
|
||||
b2cMap[126] = UNMAPPABLE_DECODING;
|
||||
|
||||
// non-roundtrip c2b only entries
|
||||
c2bNR = new char[2];
|
||||
c2bNR[0] = 0x15; c2bNR[1] = 0x85;
|
||||
|
||||
SingleByte.initC2B(b2cMap, c2bNR, c2b, c2bIndex);
|
||||
}
|
||||
}
|
||||
102
jdkSrc/jdk8/sun/nio/cs/ext/IBM856.java
Normal file
102
jdkSrc/jdk8/sun/nio/cs/ext/IBM856.java
Normal file
@@ -0,0 +1,102 @@
|
||||
/*
|
||||
* Copyright (c) 2008, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package sun.nio.cs.ext;
|
||||
|
||||
import java.nio.charset.Charset;
|
||||
import java.nio.charset.CharsetDecoder;
|
||||
import java.nio.charset.CharsetEncoder;
|
||||
import sun.nio.cs.StandardCharsets;
|
||||
import sun.nio.cs.SingleByte;
|
||||
import sun.nio.cs.HistoricallyNamedCharset;
|
||||
import static sun.nio.cs.CharsetMapping.*;
|
||||
|
||||
public class IBM856 extends Charset implements HistoricallyNamedCharset
|
||||
{
|
||||
public IBM856() {
|
||||
super("x-IBM856", ExtendedCharsets.aliasesFor("x-IBM856"));
|
||||
}
|
||||
|
||||
public String historicalName() {
|
||||
return "Cp856";
|
||||
}
|
||||
|
||||
public boolean contains(Charset cs) {
|
||||
return (cs instanceof IBM856);
|
||||
}
|
||||
|
||||
public CharsetDecoder newDecoder() {
|
||||
return new SingleByte.Decoder(this, b2c);
|
||||
}
|
||||
|
||||
public CharsetEncoder newEncoder() {
|
||||
return new SingleByte.Encoder(this, c2b, c2bIndex);
|
||||
}
|
||||
|
||||
private final static String b2cTable =
|
||||
"\u05D0\u05D1\u05D2\u05D3\u05D4\u05D5\u05D6\u05D7" + // 0x80 - 0x87
|
||||
"\u05D8\u05D9\u05DA\u05DB\u05DC\u05DD\u05DE\u05DF" + // 0x88 - 0x8f
|
||||
"\u05E0\u05E1\u05E2\u05E3\u05E4\u05E5\u05E6\u05E7" + // 0x90 - 0x97
|
||||
"\u05E8\u05E9\u05EA\uFFFD\u00A3\uFFFD\u00D7\uFFFD" + // 0x98 - 0x9f
|
||||
"\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD" + // 0xa0 - 0xa7
|
||||
"\uFFFD\u00AE\u00AC\u00BD\u00BC\uFFFD\u00AB\u00BB" + // 0xa8 - 0xaf
|
||||
"\u2591\u2592\u2593\u2502\u2524\uFFFD\uFFFD\uFFFD" + // 0xb0 - 0xb7
|
||||
"\u00A9\u2563\u2551\u2557\u255D\u00A2\u00A5\u2510" + // 0xb8 - 0xbf
|
||||
"\u2514\u2534\u252C\u251C\u2500\u253C\uFFFD\uFFFD" + // 0xc0 - 0xc7
|
||||
"\u255A\u2554\u2569\u2566\u2560\u2550\u256C\u00A4" + // 0xc8 - 0xcf
|
||||
"\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD" + // 0xd0 - 0xd7
|
||||
"\uFFFD\u2518\u250C\u2588\u2584\u00A6\uFFFD\u2580" + // 0xd8 - 0xdf
|
||||
"\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\u00B5\uFFFD" + // 0xe0 - 0xe7
|
||||
"\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\u203E\u00B4" + // 0xe8 - 0xef
|
||||
"\u00AD\u00B1\u2017\u00BE\u00B6\u00A7\u00F7\u00B8" + // 0xf0 - 0xf7
|
||||
"\u00B0\u00A8\u2022\u00B9\u00B3\u00B2\u25A0\u00A0" + // 0xf8 - 0xff
|
||||
"\u0000\u0001\u0002\u0003\u0004\u0005\u0006\u0007" + // 0x00 - 0x07
|
||||
"\b\t\n\u000B\f\r\u000E\u000F" + // 0x08 - 0x0f
|
||||
"\u0010\u0011\u0012\u0013\u0014\u0015\u0016\u0017" + // 0x10 - 0x17
|
||||
"\u0018\u0019\u001A\u001B\u001C\u001D\u001E\u001F" + // 0x18 - 0x1f
|
||||
"\u0020\u0021\"\u0023\u0024\u0025\u0026\'" + // 0x20 - 0x27
|
||||
"\u0028\u0029\u002A\u002B\u002C\u002D\u002E\u002F" + // 0x28 - 0x2f
|
||||
"\u0030\u0031\u0032\u0033\u0034\u0035\u0036\u0037" + // 0x30 - 0x37
|
||||
"\u0038\u0039\u003A\u003B\u003C\u003D\u003E\u003F" + // 0x38 - 0x3f
|
||||
"\u0040\u0041\u0042\u0043\u0044\u0045\u0046\u0047" + // 0x40 - 0x47
|
||||
"\u0048\u0049\u004A\u004B\u004C\u004D\u004E\u004F" + // 0x48 - 0x4f
|
||||
"\u0050\u0051\u0052\u0053\u0054\u0055\u0056\u0057" + // 0x50 - 0x57
|
||||
"\u0058\u0059\u005A\u005B\\\u005D\u005E\u005F" + // 0x58 - 0x5f
|
||||
"\u0060\u0061\u0062\u0063\u0064\u0065\u0066\u0067" + // 0x60 - 0x67
|
||||
"\u0068\u0069\u006A\u006B\u006C\u006D\u006E\u006F" + // 0x68 - 0x6f
|
||||
"\u0070\u0071\u0072\u0073\u0074\u0075\u0076\u0077" + // 0x70 - 0x77
|
||||
"\u0078\u0079\u007A\u007B\u007C\u007D\u007E\u007F" ; // 0x78 - 0x7f
|
||||
|
||||
|
||||
private final static char[] b2c = b2cTable.toCharArray();
|
||||
private final static char[] c2b = new char[0x500];
|
||||
private final static char[] c2bIndex = new char[0x100];
|
||||
|
||||
static {
|
||||
char[] b2cMap = b2c;
|
||||
char[] c2bNR = null;
|
||||
SingleByte.initC2B(b2cMap, c2bNR, c2b, c2bIndex);
|
||||
}
|
||||
}
|
||||
102
jdkSrc/jdk8/sun/nio/cs/ext/IBM860.java
Normal file
102
jdkSrc/jdk8/sun/nio/cs/ext/IBM860.java
Normal file
@@ -0,0 +1,102 @@
|
||||
/*
|
||||
* Copyright (c) 2008, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package sun.nio.cs.ext;
|
||||
|
||||
import java.nio.charset.Charset;
|
||||
import java.nio.charset.CharsetDecoder;
|
||||
import java.nio.charset.CharsetEncoder;
|
||||
import sun.nio.cs.StandardCharsets;
|
||||
import sun.nio.cs.SingleByte;
|
||||
import sun.nio.cs.HistoricallyNamedCharset;
|
||||
import static sun.nio.cs.CharsetMapping.*;
|
||||
|
||||
public class IBM860 extends Charset implements HistoricallyNamedCharset
|
||||
{
|
||||
public IBM860() {
|
||||
super("IBM860", ExtendedCharsets.aliasesFor("IBM860"));
|
||||
}
|
||||
|
||||
public String historicalName() {
|
||||
return "Cp860";
|
||||
}
|
||||
|
||||
public boolean contains(Charset cs) {
|
||||
return (cs instanceof IBM860);
|
||||
}
|
||||
|
||||
public CharsetDecoder newDecoder() {
|
||||
return new SingleByte.Decoder(this, b2c);
|
||||
}
|
||||
|
||||
public CharsetEncoder newEncoder() {
|
||||
return new SingleByte.Encoder(this, c2b, c2bIndex);
|
||||
}
|
||||
|
||||
private final static String b2cTable =
|
||||
"\u00C7\u00FC\u00E9\u00E2\u00E3\u00E0\u00C1\u00E7" + // 0x80 - 0x87
|
||||
"\u00EA\u00CA\u00E8\u00CD\u00D4\u00EC\u00C3\u00C2" + // 0x88 - 0x8f
|
||||
"\u00C9\u00C0\u00C8\u00F4\u00F5\u00F2\u00DA\u00F9" + // 0x90 - 0x97
|
||||
"\u00CC\u00D5\u00DC\u00A2\u00A3\u00D9\u20A7\u00D3" + // 0x98 - 0x9f
|
||||
"\u00E1\u00ED\u00F3\u00FA\u00F1\u00D1\u00AA\u00BA" + // 0xa0 - 0xa7
|
||||
"\u00BF\u00D2\u00AC\u00BD\u00BC\u00A1\u00AB\u00BB" + // 0xa8 - 0xaf
|
||||
"\u2591\u2592\u2593\u2502\u2524\u2561\u2562\u2556" + // 0xb0 - 0xb7
|
||||
"\u2555\u2563\u2551\u2557\u255D\u255C\u255B\u2510" + // 0xb8 - 0xbf
|
||||
"\u2514\u2534\u252C\u251C\u2500\u253C\u255E\u255F" + // 0xc0 - 0xc7
|
||||
"\u255A\u2554\u2569\u2566\u2560\u2550\u256C\u2567" + // 0xc8 - 0xcf
|
||||
"\u2568\u2564\u2565\u2559\u2558\u2552\u2553\u256B" + // 0xd0 - 0xd7
|
||||
"\u256A\u2518\u250C\u2588\u2584\u258C\u2590\u2580" + // 0xd8 - 0xdf
|
||||
"\u03B1\u00DF\u0393\u03C0\u03A3\u03C3\u00B5\u03C4" + // 0xe0 - 0xe7
|
||||
"\u03A6\u0398\u03A9\u03B4\u221E\u03C6\u03B5\u2229" + // 0xe8 - 0xef
|
||||
"\u2261\u00B1\u2265\u2264\u2320\u2321\u00F7\u2248" + // 0xf0 - 0xf7
|
||||
"\u00B0\u2219\u00B7\u221A\u207F\u00B2\u25A0\u00A0" + // 0xf8 - 0xff
|
||||
"\u0000\u0001\u0002\u0003\u0004\u0005\u0006\u0007" + // 0x00 - 0x07
|
||||
"\b\t\n\u000B\f\r\u000E\u000F" + // 0x08 - 0x0f
|
||||
"\u0010\u0011\u0012\u0013\u0014\u0015\u0016\u0017" + // 0x10 - 0x17
|
||||
"\u0018\u0019\u001A\u001B\u001C\u001D\u001E\u001F" + // 0x18 - 0x1f
|
||||
"\u0020\u0021\"\u0023\u0024\u0025\u0026\'" + // 0x20 - 0x27
|
||||
"\u0028\u0029\u002A\u002B\u002C\u002D\u002E\u002F" + // 0x28 - 0x2f
|
||||
"\u0030\u0031\u0032\u0033\u0034\u0035\u0036\u0037" + // 0x30 - 0x37
|
||||
"\u0038\u0039\u003A\u003B\u003C\u003D\u003E\u003F" + // 0x38 - 0x3f
|
||||
"\u0040\u0041\u0042\u0043\u0044\u0045\u0046\u0047" + // 0x40 - 0x47
|
||||
"\u0048\u0049\u004A\u004B\u004C\u004D\u004E\u004F" + // 0x48 - 0x4f
|
||||
"\u0050\u0051\u0052\u0053\u0054\u0055\u0056\u0057" + // 0x50 - 0x57
|
||||
"\u0058\u0059\u005A\u005B\\\u005D\u005E\u005F" + // 0x58 - 0x5f
|
||||
"\u0060\u0061\u0062\u0063\u0064\u0065\u0066\u0067" + // 0x60 - 0x67
|
||||
"\u0068\u0069\u006A\u006B\u006C\u006D\u006E\u006F" + // 0x68 - 0x6f
|
||||
"\u0070\u0071\u0072\u0073\u0074\u0075\u0076\u0077" + // 0x70 - 0x77
|
||||
"\u0078\u0079\u007A\u007B\u007C\u007D\u007E\u007F" ; // 0x78 - 0x7f
|
||||
|
||||
|
||||
private final static char[] b2c = b2cTable.toCharArray();
|
||||
private final static char[] c2b = new char[0x600];
|
||||
private final static char[] c2bIndex = new char[0x100];
|
||||
|
||||
static {
|
||||
char[] b2cMap = b2c;
|
||||
char[] c2bNR = null;
|
||||
SingleByte.initC2B(b2cMap, c2bNR, c2b, c2bIndex);
|
||||
}
|
||||
}
|
||||
102
jdkSrc/jdk8/sun/nio/cs/ext/IBM861.java
Normal file
102
jdkSrc/jdk8/sun/nio/cs/ext/IBM861.java
Normal file
@@ -0,0 +1,102 @@
|
||||
/*
|
||||
* Copyright (c) 2008, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package sun.nio.cs.ext;
|
||||
|
||||
import java.nio.charset.Charset;
|
||||
import java.nio.charset.CharsetDecoder;
|
||||
import java.nio.charset.CharsetEncoder;
|
||||
import sun.nio.cs.StandardCharsets;
|
||||
import sun.nio.cs.SingleByte;
|
||||
import sun.nio.cs.HistoricallyNamedCharset;
|
||||
import static sun.nio.cs.CharsetMapping.*;
|
||||
|
||||
public class IBM861 extends Charset implements HistoricallyNamedCharset
|
||||
{
|
||||
public IBM861() {
|
||||
super("IBM861", ExtendedCharsets.aliasesFor("IBM861"));
|
||||
}
|
||||
|
||||
public String historicalName() {
|
||||
return "Cp861";
|
||||
}
|
||||
|
||||
public boolean contains(Charset cs) {
|
||||
return (cs instanceof IBM861);
|
||||
}
|
||||
|
||||
public CharsetDecoder newDecoder() {
|
||||
return new SingleByte.Decoder(this, b2c);
|
||||
}
|
||||
|
||||
public CharsetEncoder newEncoder() {
|
||||
return new SingleByte.Encoder(this, c2b, c2bIndex);
|
||||
}
|
||||
|
||||
private final static String b2cTable =
|
||||
"\u00C7\u00FC\u00E9\u00E2\u00E4\u00E0\u00E5\u00E7" + // 0x80 - 0x87
|
||||
"\u00EA\u00EB\u00E8\u00D0\u00F0\u00DE\u00C4\u00C5" + // 0x88 - 0x8f
|
||||
"\u00C9\u00E6\u00C6\u00F4\u00F6\u00FE\u00FB\u00DD" + // 0x90 - 0x97
|
||||
"\u00FD\u00D6\u00DC\u00F8\u00A3\u00D8\u20A7\u0192" + // 0x98 - 0x9f
|
||||
"\u00E1\u00ED\u00F3\u00FA\u00C1\u00CD\u00D3\u00DA" + // 0xa0 - 0xa7
|
||||
"\u00BF\u2310\u00AC\u00BD\u00BC\u00A1\u00AB\u00BB" + // 0xa8 - 0xaf
|
||||
"\u2591\u2592\u2593\u2502\u2524\u2561\u2562\u2556" + // 0xb0 - 0xb7
|
||||
"\u2555\u2563\u2551\u2557\u255D\u255C\u255B\u2510" + // 0xb8 - 0xbf
|
||||
"\u2514\u2534\u252C\u251C\u2500\u253C\u255E\u255F" + // 0xc0 - 0xc7
|
||||
"\u255A\u2554\u2569\u2566\u2560\u2550\u256C\u2567" + // 0xc8 - 0xcf
|
||||
"\u2568\u2564\u2565\u2559\u2558\u2552\u2553\u256B" + // 0xd0 - 0xd7
|
||||
"\u256A\u2518\u250C\u2588\u2584\u258C\u2590\u2580" + // 0xd8 - 0xdf
|
||||
"\u03B1\u00DF\u0393\u03C0\u03A3\u03C3\u00B5\u03C4" + // 0xe0 - 0xe7
|
||||
"\u03A6\u0398\u03A9\u03B4\u221E\u03C6\u03B5\u2229" + // 0xe8 - 0xef
|
||||
"\u2261\u00B1\u2265\u2264\u2320\u2321\u00F7\u2248" + // 0xf0 - 0xf7
|
||||
"\u00B0\u2219\u00B7\u221A\u207F\u00B2\u25A0\u00A0" + // 0xf8 - 0xff
|
||||
"\u0000\u0001\u0002\u0003\u0004\u0005\u0006\u0007" + // 0x00 - 0x07
|
||||
"\b\t\n\u000B\f\r\u000E\u000F" + // 0x08 - 0x0f
|
||||
"\u0010\u0011\u0012\u0013\u0014\u0015\u0016\u0017" + // 0x10 - 0x17
|
||||
"\u0018\u0019\u001A\u001B\u001C\u001D\u001E\u001F" + // 0x18 - 0x1f
|
||||
"\u0020\u0021\"\u0023\u0024\u0025\u0026\'" + // 0x20 - 0x27
|
||||
"\u0028\u0029\u002A\u002B\u002C\u002D\u002E\u002F" + // 0x28 - 0x2f
|
||||
"\u0030\u0031\u0032\u0033\u0034\u0035\u0036\u0037" + // 0x30 - 0x37
|
||||
"\u0038\u0039\u003A\u003B\u003C\u003D\u003E\u003F" + // 0x38 - 0x3f
|
||||
"\u0040\u0041\u0042\u0043\u0044\u0045\u0046\u0047" + // 0x40 - 0x47
|
||||
"\u0048\u0049\u004A\u004B\u004C\u004D\u004E\u004F" + // 0x48 - 0x4f
|
||||
"\u0050\u0051\u0052\u0053\u0054\u0055\u0056\u0057" + // 0x50 - 0x57
|
||||
"\u0058\u0059\u005A\u005B\\\u005D\u005E\u005F" + // 0x58 - 0x5f
|
||||
"\u0060\u0061\u0062\u0063\u0064\u0065\u0066\u0067" + // 0x60 - 0x67
|
||||
"\u0068\u0069\u006A\u006B\u006C\u006D\u006E\u006F" + // 0x68 - 0x6f
|
||||
"\u0070\u0071\u0072\u0073\u0074\u0075\u0076\u0077" + // 0x70 - 0x77
|
||||
"\u0078\u0079\u007A\u007B\u007C\u007D\u007E\u007F" ; // 0x78 - 0x7f
|
||||
|
||||
|
||||
private final static char[] b2c = b2cTable.toCharArray();
|
||||
private final static char[] c2b = new char[0x700];
|
||||
private final static char[] c2bIndex = new char[0x100];
|
||||
|
||||
static {
|
||||
char[] b2cMap = b2c;
|
||||
char[] c2bNR = null;
|
||||
SingleByte.initC2B(b2cMap, c2bNR, c2b, c2bIndex);
|
||||
}
|
||||
}
|
||||
102
jdkSrc/jdk8/sun/nio/cs/ext/IBM863.java
Normal file
102
jdkSrc/jdk8/sun/nio/cs/ext/IBM863.java
Normal file
@@ -0,0 +1,102 @@
|
||||
/*
|
||||
* Copyright (c) 2008, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package sun.nio.cs.ext;
|
||||
|
||||
import java.nio.charset.Charset;
|
||||
import java.nio.charset.CharsetDecoder;
|
||||
import java.nio.charset.CharsetEncoder;
|
||||
import sun.nio.cs.StandardCharsets;
|
||||
import sun.nio.cs.SingleByte;
|
||||
import sun.nio.cs.HistoricallyNamedCharset;
|
||||
import static sun.nio.cs.CharsetMapping.*;
|
||||
|
||||
public class IBM863 extends Charset implements HistoricallyNamedCharset
|
||||
{
|
||||
public IBM863() {
|
||||
super("IBM863", ExtendedCharsets.aliasesFor("IBM863"));
|
||||
}
|
||||
|
||||
public String historicalName() {
|
||||
return "Cp863";
|
||||
}
|
||||
|
||||
public boolean contains(Charset cs) {
|
||||
return (cs instanceof IBM863);
|
||||
}
|
||||
|
||||
public CharsetDecoder newDecoder() {
|
||||
return new SingleByte.Decoder(this, b2c);
|
||||
}
|
||||
|
||||
public CharsetEncoder newEncoder() {
|
||||
return new SingleByte.Encoder(this, c2b, c2bIndex);
|
||||
}
|
||||
|
||||
private final static String b2cTable =
|
||||
"\u00C7\u00FC\u00E9\u00E2\u00C2\u00E0\u00B6\u00E7" + // 0x80 - 0x87
|
||||
"\u00EA\u00EB\u00E8\u00EF\u00EE\u2017\u00C0\u00A7" + // 0x88 - 0x8f
|
||||
"\u00C9\u00C8\u00CA\u00F4\u00CB\u00CF\u00FB\u00F9" + // 0x90 - 0x97
|
||||
"\u00A4\u00D4\u00DC\u00A2\u00A3\u00D9\u00DB\u0192" + // 0x98 - 0x9f
|
||||
"\u00A6\u00B4\u00F3\u00FA\u00A8\u00B8\u00B3\u00AF" + // 0xa0 - 0xa7
|
||||
"\u00CE\u2310\u00AC\u00BD\u00BC\u00BE\u00AB\u00BB" + // 0xa8 - 0xaf
|
||||
"\u2591\u2592\u2593\u2502\u2524\u2561\u2562\u2556" + // 0xb0 - 0xb7
|
||||
"\u2555\u2563\u2551\u2557\u255D\u255C\u255B\u2510" + // 0xb8 - 0xbf
|
||||
"\u2514\u2534\u252C\u251C\u2500\u253C\u255E\u255F" + // 0xc0 - 0xc7
|
||||
"\u255A\u2554\u2569\u2566\u2560\u2550\u256C\u2567" + // 0xc8 - 0xcf
|
||||
"\u2568\u2564\u2565\u2559\u2558\u2552\u2553\u256B" + // 0xd0 - 0xd7
|
||||
"\u256A\u2518\u250C\u2588\u2584\u258C\u2590\u2580" + // 0xd8 - 0xdf
|
||||
"\u03B1\u00DF\u0393\u03C0\u03A3\u03C3\u00B5\u03C4" + // 0xe0 - 0xe7
|
||||
"\u03A6\u0398\u03A9\u03B4\u221E\u03C6\u03B5\u2229" + // 0xe8 - 0xef
|
||||
"\u2261\u00B1\u2265\u2264\u2320\u2321\u00F7\u2248" + // 0xf0 - 0xf7
|
||||
"\u00B0\u2219\u00B7\u221A\u207F\u00B2\u25A0\u00A0" + // 0xf8 - 0xff
|
||||
"\u0000\u0001\u0002\u0003\u0004\u0005\u0006\u0007" + // 0x00 - 0x07
|
||||
"\b\t\n\u000B\f\r\u000E\u000F" + // 0x08 - 0x0f
|
||||
"\u0010\u0011\u0012\u0013\u0014\u0015\u0016\u0017" + // 0x10 - 0x17
|
||||
"\u0018\u0019\u001A\u001B\u001C\u001D\u001E\u001F" + // 0x18 - 0x1f
|
||||
"\u0020\u0021\"\u0023\u0024\u0025\u0026\'" + // 0x20 - 0x27
|
||||
"\u0028\u0029\u002A\u002B\u002C\u002D\u002E\u002F" + // 0x28 - 0x2f
|
||||
"\u0030\u0031\u0032\u0033\u0034\u0035\u0036\u0037" + // 0x30 - 0x37
|
||||
"\u0038\u0039\u003A\u003B\u003C\u003D\u003E\u003F" + // 0x38 - 0x3f
|
||||
"\u0040\u0041\u0042\u0043\u0044\u0045\u0046\u0047" + // 0x40 - 0x47
|
||||
"\u0048\u0049\u004A\u004B\u004C\u004D\u004E\u004F" + // 0x48 - 0x4f
|
||||
"\u0050\u0051\u0052\u0053\u0054\u0055\u0056\u0057" + // 0x50 - 0x57
|
||||
"\u0058\u0059\u005A\u005B\\\u005D\u005E\u005F" + // 0x58 - 0x5f
|
||||
"\u0060\u0061\u0062\u0063\u0064\u0065\u0066\u0067" + // 0x60 - 0x67
|
||||
"\u0068\u0069\u006A\u006B\u006C\u006D\u006E\u006F" + // 0x68 - 0x6f
|
||||
"\u0070\u0071\u0072\u0073\u0074\u0075\u0076\u0077" + // 0x70 - 0x77
|
||||
"\u0078\u0079\u007A\u007B\u007C\u007D\u007E\u007F" ; // 0x78 - 0x7f
|
||||
|
||||
|
||||
private final static char[] b2c = b2cTable.toCharArray();
|
||||
private final static char[] c2b = new char[0x700];
|
||||
private final static char[] c2bIndex = new char[0x100];
|
||||
|
||||
static {
|
||||
char[] b2cMap = b2c;
|
||||
char[] c2bNR = null;
|
||||
SingleByte.initC2B(b2cMap, c2bNR, c2b, c2bIndex);
|
||||
}
|
||||
}
|
||||
102
jdkSrc/jdk8/sun/nio/cs/ext/IBM864.java
Normal file
102
jdkSrc/jdk8/sun/nio/cs/ext/IBM864.java
Normal file
@@ -0,0 +1,102 @@
|
||||
/*
|
||||
* Copyright (c) 2008, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package sun.nio.cs.ext;
|
||||
|
||||
import java.nio.charset.Charset;
|
||||
import java.nio.charset.CharsetDecoder;
|
||||
import java.nio.charset.CharsetEncoder;
|
||||
import sun.nio.cs.StandardCharsets;
|
||||
import sun.nio.cs.SingleByte;
|
||||
import sun.nio.cs.HistoricallyNamedCharset;
|
||||
import static sun.nio.cs.CharsetMapping.*;
|
||||
|
||||
public class IBM864 extends Charset implements HistoricallyNamedCharset
|
||||
{
|
||||
public IBM864() {
|
||||
super("IBM864", ExtendedCharsets.aliasesFor("IBM864"));
|
||||
}
|
||||
|
||||
public String historicalName() {
|
||||
return "Cp864";
|
||||
}
|
||||
|
||||
public boolean contains(Charset cs) {
|
||||
return (cs instanceof IBM864);
|
||||
}
|
||||
|
||||
public CharsetDecoder newDecoder() {
|
||||
return new SingleByte.Decoder(this, b2c);
|
||||
}
|
||||
|
||||
public CharsetEncoder newEncoder() {
|
||||
return new SingleByte.Encoder(this, c2b, c2bIndex);
|
||||
}
|
||||
|
||||
private final static String b2cTable =
|
||||
"\u00B0\u00B7\u2219\u221A\u2592\u2500\u2502\u253C" + // 0x80 - 0x87
|
||||
"\u2524\u252C\u251C\u2534\u2510\u250C\u2514\u2518" + // 0x88 - 0x8f
|
||||
"\u03B2\u221E\u03C6\u00B1\u00BD\u00BC\u2248\u00AB" + // 0x90 - 0x97
|
||||
"\u00BB\uFEF7\uFEF8\uFFFD\uFFFD\uFEFB\uFEFC\uFFFD" + // 0x98 - 0x9f
|
||||
"\u00A0\u00AD\uFE82\u00A3\u00A4\uFE84\uFFFD\uFFFD" + // 0xa0 - 0xa7
|
||||
"\uFE8E\uFE8F\uFE95\uFE99\u060C\uFE9D\uFEA1\uFEA5" + // 0xa8 - 0xaf
|
||||
"\u0660\u0661\u0662\u0663\u0664\u0665\u0666\u0667" + // 0xb0 - 0xb7
|
||||
"\u0668\u0669\uFED1\u061B\uFEB1\uFEB5\uFEB9\u061F" + // 0xb8 - 0xbf
|
||||
"\u00A2\uFE80\uFE81\uFE83\uFE85\uFECA\uFE8B\uFE8D" + // 0xc0 - 0xc7
|
||||
"\uFE91\uFE93\uFE97\uFE9B\uFE9F\uFEA3\uFEA7\uFEA9" + // 0xc8 - 0xcf
|
||||
"\uFEAB\uFEAD\uFEAF\uFEB3\uFEB7\uFEBB\uFEBF\uFEC1" + // 0xd0 - 0xd7
|
||||
"\uFEC5\uFECB\uFECF\u00A6\u00AC\u00F7\u00D7\uFEC9" + // 0xd8 - 0xdf
|
||||
"\u0640\uFED3\uFED7\uFEDB\uFEDF\uFEE3\uFEE7\uFEEB" + // 0xe0 - 0xe7
|
||||
"\uFEED\uFEEF\uFEF3\uFEBD\uFECC\uFECE\uFECD\uFEE1" + // 0xe8 - 0xef
|
||||
"\uFE7D\u0651\uFEE5\uFEE9\uFEEC\uFEF0\uFEF2\uFED0" + // 0xf0 - 0xf7
|
||||
"\uFED5\uFEF5\uFEF6\uFEDD\uFED9\uFEF1\u25A0\uFFFD" + // 0xf8 - 0xff
|
||||
"\u0000\u0001\u0002\u0003\u0004\u0005\u0006\u0007" + // 0x00 - 0x07
|
||||
"\b\t\n\u000B\f\r\u000E\u000F" + // 0x08 - 0x0f
|
||||
"\u0010\u0011\u0012\u0013\u0014\u0015\u0016\u0017" + // 0x10 - 0x17
|
||||
"\u0018\u0019\u001A\u001B\u001C\u001D\u001E\u001F" + // 0x18 - 0x1f
|
||||
"\u0020\u0021\"\u0023\u0024\u066A\u0026\'" + // 0x20 - 0x27
|
||||
"\u0028\u0029\u002A\u002B\u002C\u002D\u002E\u002F" + // 0x28 - 0x2f
|
||||
"\u0030\u0031\u0032\u0033\u0034\u0035\u0036\u0037" + // 0x30 - 0x37
|
||||
"\u0038\u0039\u003A\u003B\u003C\u003D\u003E\u003F" + // 0x38 - 0x3f
|
||||
"\u0040\u0041\u0042\u0043\u0044\u0045\u0046\u0047" + // 0x40 - 0x47
|
||||
"\u0048\u0049\u004A\u004B\u004C\u004D\u004E\u004F" + // 0x48 - 0x4f
|
||||
"\u0050\u0051\u0052\u0053\u0054\u0055\u0056\u0057" + // 0x50 - 0x57
|
||||
"\u0058\u0059\u005A\u005B\\\u005D\u005E\u005F" + // 0x58 - 0x5f
|
||||
"\u0060\u0061\u0062\u0063\u0064\u0065\u0066\u0067" + // 0x60 - 0x67
|
||||
"\u0068\u0069\u006A\u006B\u006C\u006D\u006E\u006F" + // 0x68 - 0x6f
|
||||
"\u0070\u0071\u0072\u0073\u0074\u0075\u0076\u0077" + // 0x70 - 0x77
|
||||
"\u0078\u0079\u007A\u007B\u007C\u007D\u007E\u007F" ; // 0x78 - 0x7f
|
||||
|
||||
|
||||
private final static char[] b2c = b2cTable.toCharArray();
|
||||
private final static char[] c2b = new char[0x700];
|
||||
private final static char[] c2bIndex = new char[0x100];
|
||||
|
||||
static {
|
||||
char[] b2cMap = b2c;
|
||||
char[] c2bNR = null;
|
||||
SingleByte.initC2B(b2cMap, c2bNR, c2b, c2bIndex);
|
||||
}
|
||||
}
|
||||
102
jdkSrc/jdk8/sun/nio/cs/ext/IBM865.java
Normal file
102
jdkSrc/jdk8/sun/nio/cs/ext/IBM865.java
Normal file
@@ -0,0 +1,102 @@
|
||||
/*
|
||||
* Copyright (c) 2008, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package sun.nio.cs.ext;
|
||||
|
||||
import java.nio.charset.Charset;
|
||||
import java.nio.charset.CharsetDecoder;
|
||||
import java.nio.charset.CharsetEncoder;
|
||||
import sun.nio.cs.StandardCharsets;
|
||||
import sun.nio.cs.SingleByte;
|
||||
import sun.nio.cs.HistoricallyNamedCharset;
|
||||
import static sun.nio.cs.CharsetMapping.*;
|
||||
|
||||
public class IBM865 extends Charset implements HistoricallyNamedCharset
|
||||
{
|
||||
public IBM865() {
|
||||
super("IBM865", ExtendedCharsets.aliasesFor("IBM865"));
|
||||
}
|
||||
|
||||
public String historicalName() {
|
||||
return "Cp865";
|
||||
}
|
||||
|
||||
public boolean contains(Charset cs) {
|
||||
return (cs instanceof IBM865);
|
||||
}
|
||||
|
||||
public CharsetDecoder newDecoder() {
|
||||
return new SingleByte.Decoder(this, b2c);
|
||||
}
|
||||
|
||||
public CharsetEncoder newEncoder() {
|
||||
return new SingleByte.Encoder(this, c2b, c2bIndex);
|
||||
}
|
||||
|
||||
private final static String b2cTable =
|
||||
"\u00C7\u00FC\u00E9\u00E2\u00E4\u00E0\u00E5\u00E7" + // 0x80 - 0x87
|
||||
"\u00EA\u00EB\u00E8\u00EF\u00EE\u00EC\u00C4\u00C5" + // 0x88 - 0x8f
|
||||
"\u00C9\u00E6\u00C6\u00F4\u00F6\u00F2\u00FB\u00F9" + // 0x90 - 0x97
|
||||
"\u00FF\u00D6\u00DC\u00F8\u00A3\u00D8\u20A7\u0192" + // 0x98 - 0x9f
|
||||
"\u00E1\u00ED\u00F3\u00FA\u00F1\u00D1\u00AA\u00BA" + // 0xa0 - 0xa7
|
||||
"\u00BF\u2310\u00AC\u00BD\u00BC\u00A1\u00AB\u00A4" + // 0xa8 - 0xaf
|
||||
"\u2591\u2592\u2593\u2502\u2524\u2561\u2562\u2556" + // 0xb0 - 0xb7
|
||||
"\u2555\u2563\u2551\u2557\u255D\u255C\u255B\u2510" + // 0xb8 - 0xbf
|
||||
"\u2514\u2534\u252C\u251C\u2500\u253C\u255E\u255F" + // 0xc0 - 0xc7
|
||||
"\u255A\u2554\u2569\u2566\u2560\u2550\u256C\u2567" + // 0xc8 - 0xcf
|
||||
"\u2568\u2564\u2565\u2559\u2558\u2552\u2553\u256B" + // 0xd0 - 0xd7
|
||||
"\u256A\u2518\u250C\u2588\u2584\u258C\u2590\u2580" + // 0xd8 - 0xdf
|
||||
"\u03B1\u00DF\u0393\u03C0\u03A3\u03C3\u00B5\u03C4" + // 0xe0 - 0xe7
|
||||
"\u03A6\u0398\u03A9\u03B4\u221E\u03C6\u03B5\u2229" + // 0xe8 - 0xef
|
||||
"\u2261\u00B1\u2265\u2264\u2320\u2321\u00F7\u2248" + // 0xf0 - 0xf7
|
||||
"\u00B0\u2219\u00B7\u221A\u207F\u00B2\u25A0\u00A0" + // 0xf8 - 0xff
|
||||
"\u0000\u0001\u0002\u0003\u0004\u0005\u0006\u0007" + // 0x00 - 0x07
|
||||
"\b\t\n\u000B\f\r\u000E\u000F" + // 0x08 - 0x0f
|
||||
"\u0010\u0011\u0012\u0013\u0014\u0015\u0016\u0017" + // 0x10 - 0x17
|
||||
"\u0018\u0019\u001A\u001B\u001C\u001D\u001E\u001F" + // 0x18 - 0x1f
|
||||
"\u0020\u0021\"\u0023\u0024\u0025\u0026\'" + // 0x20 - 0x27
|
||||
"\u0028\u0029\u002A\u002B\u002C\u002D\u002E\u002F" + // 0x28 - 0x2f
|
||||
"\u0030\u0031\u0032\u0033\u0034\u0035\u0036\u0037" + // 0x30 - 0x37
|
||||
"\u0038\u0039\u003A\u003B\u003C\u003D\u003E\u003F" + // 0x38 - 0x3f
|
||||
"\u0040\u0041\u0042\u0043\u0044\u0045\u0046\u0047" + // 0x40 - 0x47
|
||||
"\u0048\u0049\u004A\u004B\u004C\u004D\u004E\u004F" + // 0x48 - 0x4f
|
||||
"\u0050\u0051\u0052\u0053\u0054\u0055\u0056\u0057" + // 0x50 - 0x57
|
||||
"\u0058\u0059\u005A\u005B\\\u005D\u005E\u005F" + // 0x58 - 0x5f
|
||||
"\u0060\u0061\u0062\u0063\u0064\u0065\u0066\u0067" + // 0x60 - 0x67
|
||||
"\u0068\u0069\u006A\u006B\u006C\u006D\u006E\u006F" + // 0x68 - 0x6f
|
||||
"\u0070\u0071\u0072\u0073\u0074\u0075\u0076\u0077" + // 0x70 - 0x77
|
||||
"\u0078\u0079\u007A\u007B\u007C\u007D\u007E\u007F" ; // 0x78 - 0x7f
|
||||
|
||||
|
||||
private final static char[] b2c = b2cTable.toCharArray();
|
||||
private final static char[] c2b = new char[0x700];
|
||||
private final static char[] c2bIndex = new char[0x100];
|
||||
|
||||
static {
|
||||
char[] b2cMap = b2c;
|
||||
char[] c2bNR = null;
|
||||
SingleByte.initC2B(b2cMap, c2bNR, c2b, c2bIndex);
|
||||
}
|
||||
}
|
||||
102
jdkSrc/jdk8/sun/nio/cs/ext/IBM868.java
Normal file
102
jdkSrc/jdk8/sun/nio/cs/ext/IBM868.java
Normal file
@@ -0,0 +1,102 @@
|
||||
/*
|
||||
* Copyright (c) 2008, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package sun.nio.cs.ext;
|
||||
|
||||
import java.nio.charset.Charset;
|
||||
import java.nio.charset.CharsetDecoder;
|
||||
import java.nio.charset.CharsetEncoder;
|
||||
import sun.nio.cs.StandardCharsets;
|
||||
import sun.nio.cs.SingleByte;
|
||||
import sun.nio.cs.HistoricallyNamedCharset;
|
||||
import static sun.nio.cs.CharsetMapping.*;
|
||||
|
||||
public class IBM868 extends Charset implements HistoricallyNamedCharset
|
||||
{
|
||||
public IBM868() {
|
||||
super("IBM868", ExtendedCharsets.aliasesFor("IBM868"));
|
||||
}
|
||||
|
||||
public String historicalName() {
|
||||
return "Cp868";
|
||||
}
|
||||
|
||||
public boolean contains(Charset cs) {
|
||||
return (cs instanceof IBM868);
|
||||
}
|
||||
|
||||
public CharsetDecoder newDecoder() {
|
||||
return new SingleByte.Decoder(this, b2c);
|
||||
}
|
||||
|
||||
public CharsetEncoder newEncoder() {
|
||||
return new SingleByte.Encoder(this, c2b, c2bIndex);
|
||||
}
|
||||
|
||||
private final static String b2cTable =
|
||||
"\u06F0\u06F1\u06F2\u06F3\u06F4\u06F5\u06F6\u06F7" + // 0x80 - 0x87
|
||||
"\u06F8\u06F9\u060C\u061B\u061F\uFE81\uFE8D\uFE8E" + // 0x88 - 0x8f
|
||||
"\uF8FB\uFE8F\uFE91\uFB56\uFB58\uFE93\uFE95\uFE97" + // 0x90 - 0x97
|
||||
"\uFB66\uFB68\uFE99\uFE9B\uFE9D\uFE9F\uFB7A\uFB7C" + // 0x98 - 0x9f
|
||||
"\uFEA1\uFEA3\uFEA5\uFEA7\uFEA9\uFB88\uFEAB\uFEAD" + // 0xa0 - 0xa7
|
||||
"\uFB8C\uFEAF\uFB8A\uFEB1\uFEB3\uFEB5\u00AB\u00BB" + // 0xa8 - 0xaf
|
||||
"\u2591\u2592\u2593\u2502\u2524\uFEB7\uFEB9\uFEBB" + // 0xb0 - 0xb7
|
||||
"\uFEBD\u2563\u2551\u2557\u255D\uFEBF\uFEC3\u2510" + // 0xb8 - 0xbf
|
||||
"\u2514\u2534\u252C\u251C\u2500\u253C\uFEC7\uFEC9" + // 0xc0 - 0xc7
|
||||
"\u255A\u2554\u2569\u2566\u2560\u2550\u256C\uFECA" + // 0xc8 - 0xcf
|
||||
"\uFECB\uFECC\uFECD\uFECE\uFECF\uFED0\uFED1\uFED3" + // 0xd0 - 0xd7
|
||||
"\uFED5\u2518\u250C\u2588\u2584\uFED7\uFB8E\u2580" + // 0xd8 - 0xdf
|
||||
"\uFEDB\uFB92\uFB94\uFEDD\uFEDF\uFEE0\uFEE1\uFEE3" + // 0xe0 - 0xe7
|
||||
"\uFB9E\uFEE5\uFEE7\uFE85\uFEED\uFBA6\uFBA8\uFBA9" + // 0xe8 - 0xef
|
||||
"\u00AD\uFBAA\uFE80\uFE89\uFE8A\uFE8B\uFBFC\uFBFD" + // 0xf0 - 0xf7
|
||||
"\uFBFE\uFBB0\uFBAE\uFE7C\uFE7D\uFFFD\u25A0\u00A0" + // 0xf8 - 0xff
|
||||
"\u0000\u0001\u0002\u0003\u0004\u0005\u0006\u0007" + // 0x00 - 0x07
|
||||
"\b\t\n\u000B\f\r\u000E\u000F" + // 0x08 - 0x0f
|
||||
"\u0010\u0011\u0012\u0013\u0014\u0015\u0016\u0017" + // 0x10 - 0x17
|
||||
"\u0018\u0019\u001A\u001B\u001C\u001D\u001E\u001F" + // 0x18 - 0x1f
|
||||
"\u0020\u0021\"\u0023\u0024\u0025\u0026\'" + // 0x20 - 0x27
|
||||
"\u0028\u0029\u002A\u002B\u002C\u002D\u002E\u002F" + // 0x28 - 0x2f
|
||||
"\u0030\u0031\u0032\u0033\u0034\u0035\u0036\u0037" + // 0x30 - 0x37
|
||||
"\u0038\u0039\u003A\u003B\u003C\u003D\u003E\u003F" + // 0x38 - 0x3f
|
||||
"\u0040\u0041\u0042\u0043\u0044\u0045\u0046\u0047" + // 0x40 - 0x47
|
||||
"\u0048\u0049\u004A\u004B\u004C\u004D\u004E\u004F" + // 0x48 - 0x4f
|
||||
"\u0050\u0051\u0052\u0053\u0054\u0055\u0056\u0057" + // 0x50 - 0x57
|
||||
"\u0058\u0059\u005A\u005B\\\u005D\u005E\u005F" + // 0x58 - 0x5f
|
||||
"\u0060\u0061\u0062\u0063\u0064\u0065\u0066\u0067" + // 0x60 - 0x67
|
||||
"\u0068\u0069\u006A\u006B\u006C\u006D\u006E\u006F" + // 0x68 - 0x6f
|
||||
"\u0070\u0071\u0072\u0073\u0074\u0075\u0076\u0077" + // 0x70 - 0x77
|
||||
"\u0078\u0079\u007A\u007B\u007C\u007D\u007E\u007F" ; // 0x78 - 0x7f
|
||||
|
||||
|
||||
private final static char[] b2c = b2cTable.toCharArray();
|
||||
private final static char[] c2b = new char[0x700];
|
||||
private final static char[] c2bIndex = new char[0x100];
|
||||
|
||||
static {
|
||||
char[] b2cMap = b2c;
|
||||
char[] c2bNR = null;
|
||||
SingleByte.initC2B(b2cMap, c2bNR, c2b, c2bIndex);
|
||||
}
|
||||
}
|
||||
102
jdkSrc/jdk8/sun/nio/cs/ext/IBM869.java
Normal file
102
jdkSrc/jdk8/sun/nio/cs/ext/IBM869.java
Normal file
@@ -0,0 +1,102 @@
|
||||
/*
|
||||
* Copyright (c) 2008, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package sun.nio.cs.ext;
|
||||
|
||||
import java.nio.charset.Charset;
|
||||
import java.nio.charset.CharsetDecoder;
|
||||
import java.nio.charset.CharsetEncoder;
|
||||
import sun.nio.cs.StandardCharsets;
|
||||
import sun.nio.cs.SingleByte;
|
||||
import sun.nio.cs.HistoricallyNamedCharset;
|
||||
import static sun.nio.cs.CharsetMapping.*;
|
||||
|
||||
public class IBM869 extends Charset implements HistoricallyNamedCharset
|
||||
{
|
||||
public IBM869() {
|
||||
super("IBM869", ExtendedCharsets.aliasesFor("IBM869"));
|
||||
}
|
||||
|
||||
public String historicalName() {
|
||||
return "Cp869";
|
||||
}
|
||||
|
||||
public boolean contains(Charset cs) {
|
||||
return (cs instanceof IBM869);
|
||||
}
|
||||
|
||||
public CharsetDecoder newDecoder() {
|
||||
return new SingleByte.Decoder(this, b2c);
|
||||
}
|
||||
|
||||
public CharsetEncoder newEncoder() {
|
||||
return new SingleByte.Encoder(this, c2b, c2bIndex);
|
||||
}
|
||||
|
||||
private final static String b2cTable =
|
||||
"\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\u0386\uFFFD" + // 0x80 - 0x87
|
||||
"\u00B7\u00AC\u00A6\u2018\u2019\u0388\u2015\u0389" + // 0x88 - 0x8f
|
||||
"\u038A\u03AA\u038C\uFFFD\uFFFD\u038E\u03AB\u00A9" + // 0x90 - 0x97
|
||||
"\u038F\u00B2\u00B3\u03AC\u00A3\u03AD\u03AE\u03AF" + // 0x98 - 0x9f
|
||||
"\u03CA\u0390\u03CC\u03CD\u0391\u0392\u0393\u0394" + // 0xa0 - 0xa7
|
||||
"\u0395\u0396\u0397\u00BD\u0398\u0399\u00AB\u00BB" + // 0xa8 - 0xaf
|
||||
"\u2591\u2592\u2593\u2502\u2524\u039A\u039B\u039C" + // 0xb0 - 0xb7
|
||||
"\u039D\u2563\u2551\u2557\u255D\u039E\u039F\u2510" + // 0xb8 - 0xbf
|
||||
"\u2514\u2534\u252C\u251C\u2500\u253C\u03A0\u03A1" + // 0xc0 - 0xc7
|
||||
"\u255A\u2554\u2569\u2566\u2560\u2550\u256C\u03A3" + // 0xc8 - 0xcf
|
||||
"\u03A4\u03A5\u03A6\u03A7\u03A8\u03A9\u03B1\u03B2" + // 0xd0 - 0xd7
|
||||
"\u03B3\u2518\u250C\u2588\u2584\u03B4\u03B5\u2580" + // 0xd8 - 0xdf
|
||||
"\u03B6\u03B7\u03B8\u03B9\u03BA\u03BB\u03BC\u03BD" + // 0xe0 - 0xe7
|
||||
"\u03BE\u03BF\u03C0\u03C1\u03C3\u03C2\u03C4\u0384" + // 0xe8 - 0xef
|
||||
"\u00AD\u00B1\u03C5\u03C6\u03C7\u00A7\u03C8\u0385" + // 0xf0 - 0xf7
|
||||
"\u00B0\u00A8\u03C9\u03CB\u03B0\u03CE\u25A0\u00A0" + // 0xf8 - 0xff
|
||||
"\u0000\u0001\u0002\u0003\u0004\u0005\u0006\u0007" + // 0x00 - 0x07
|
||||
"\b\t\n\u000B\f\r\u000E\u000F" + // 0x08 - 0x0f
|
||||
"\u0010\u0011\u0012\u0013\u0014\u0015\u0016\u0017" + // 0x10 - 0x17
|
||||
"\u0018\u0019\u001A\u001B\u001C\u001D\u001E\u001F" + // 0x18 - 0x1f
|
||||
"\u0020\u0021\"\u0023\u0024\u0025\u0026\'" + // 0x20 - 0x27
|
||||
"\u0028\u0029\u002A\u002B\u002C\u002D\u002E\u002F" + // 0x28 - 0x2f
|
||||
"\u0030\u0031\u0032\u0033\u0034\u0035\u0036\u0037" + // 0x30 - 0x37
|
||||
"\u0038\u0039\u003A\u003B\u003C\u003D\u003E\u003F" + // 0x38 - 0x3f
|
||||
"\u0040\u0041\u0042\u0043\u0044\u0045\u0046\u0047" + // 0x40 - 0x47
|
||||
"\u0048\u0049\u004A\u004B\u004C\u004D\u004E\u004F" + // 0x48 - 0x4f
|
||||
"\u0050\u0051\u0052\u0053\u0054\u0055\u0056\u0057" + // 0x50 - 0x57
|
||||
"\u0058\u0059\u005A\u005B\\\u005D\u005E\u005F" + // 0x58 - 0x5f
|
||||
"\u0060\u0061\u0062\u0063\u0064\u0065\u0066\u0067" + // 0x60 - 0x67
|
||||
"\u0068\u0069\u006A\u006B\u006C\u006D\u006E\u006F" + // 0x68 - 0x6f
|
||||
"\u0070\u0071\u0072\u0073\u0074\u0075\u0076\u0077" + // 0x70 - 0x77
|
||||
"\u0078\u0079\u007A\u007B\u007C\u007D\u007E\u007F" ; // 0x78 - 0x7f
|
||||
|
||||
|
||||
private final static char[] b2c = b2cTable.toCharArray();
|
||||
private final static char[] c2b = new char[0x500];
|
||||
private final static char[] c2bIndex = new char[0x100];
|
||||
|
||||
static {
|
||||
char[] b2cMap = b2c;
|
||||
char[] c2bNR = null;
|
||||
SingleByte.initC2B(b2cMap, c2bNR, c2b, c2bIndex);
|
||||
}
|
||||
}
|
||||
110
jdkSrc/jdk8/sun/nio/cs/ext/IBM870.java
Normal file
110
jdkSrc/jdk8/sun/nio/cs/ext/IBM870.java
Normal file
@@ -0,0 +1,110 @@
|
||||
/*
|
||||
* Copyright (c) 2008, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package sun.nio.cs.ext;
|
||||
|
||||
import java.nio.charset.Charset;
|
||||
import java.nio.charset.CharsetDecoder;
|
||||
import java.nio.charset.CharsetEncoder;
|
||||
import sun.nio.cs.StandardCharsets;
|
||||
import sun.nio.cs.SingleByte;
|
||||
import sun.nio.cs.HistoricallyNamedCharset;
|
||||
import static sun.nio.cs.CharsetMapping.*;
|
||||
|
||||
public class IBM870 extends Charset implements HistoricallyNamedCharset
|
||||
{
|
||||
public IBM870() {
|
||||
super("IBM870", ExtendedCharsets.aliasesFor("IBM870"));
|
||||
}
|
||||
|
||||
public String historicalName() {
|
||||
return "Cp870";
|
||||
}
|
||||
|
||||
public boolean contains(Charset cs) {
|
||||
return (cs instanceof IBM870);
|
||||
}
|
||||
|
||||
public CharsetDecoder newDecoder() {
|
||||
return new SingleByte.Decoder(this, b2c);
|
||||
}
|
||||
|
||||
public CharsetEncoder newEncoder() {
|
||||
return new SingleByte.Encoder(this, c2b, c2bIndex);
|
||||
}
|
||||
|
||||
private final static String b2cTable =
|
||||
"\u02D8\u0061\u0062\u0063\u0064\u0065\u0066\u0067" + // 0x80 - 0x87
|
||||
"\u0068\u0069\u015B\u0148\u0111\u00FD\u0159\u015F" + // 0x88 - 0x8f
|
||||
"\u00B0\u006A\u006B\u006C\u006D\u006E\u006F\u0070" + // 0x90 - 0x97
|
||||
"\u0071\u0072\u0142\u0144\u0161\u00B8\u02DB\u00A4" + // 0x98 - 0x9f
|
||||
"\u0105\u007E\u0073\u0074\u0075\u0076\u0077\u0078" + // 0xa0 - 0xa7
|
||||
"\u0079\u007A\u015A\u0147\u0110\u00DD\u0158\u015E" + // 0xa8 - 0xaf
|
||||
"\u02D9\u0104\u017C\u0162\u017B\u00A7\u017E\u017A" + // 0xb0 - 0xb7
|
||||
"\u017D\u0179\u0141\u0143\u0160\u00A8\u00B4\u00D7" + // 0xb8 - 0xbf
|
||||
"\u007B\u0041\u0042\u0043\u0044\u0045\u0046\u0047" + // 0xc0 - 0xc7
|
||||
"\u0048\u0049\u00AD\u00F4\u00F6\u0155\u00F3\u0151" + // 0xc8 - 0xcf
|
||||
"\u007D\u004A\u004B\u004C\u004D\u004E\u004F\u0050" + // 0xd0 - 0xd7
|
||||
"\u0051\u0052\u011A\u0171\u00FC\u0165\u00FA\u011B" + // 0xd8 - 0xdf
|
||||
"\\\u00F7\u0053\u0054\u0055\u0056\u0057\u0058" + // 0xe0 - 0xe7
|
||||
"\u0059\u005A\u010F\u00D4\u00D6\u0154\u00D3\u0150" + // 0xe8 - 0xef
|
||||
"\u0030\u0031\u0032\u0033\u0034\u0035\u0036\u0037" + // 0xf0 - 0xf7
|
||||
"\u0038\u0039\u010E\u0170\u00DC\u0164\u00DA\u009F" + // 0xf8 - 0xff
|
||||
"\u0000\u0001\u0002\u0003\u009C\t\u0086\u007F" + // 0x00 - 0x07
|
||||
"\u0097\u008D\u008E\u000B\f\r\u000E\u000F" + // 0x08 - 0x0f
|
||||
"\u0010\u0011\u0012\u0013\u009D\n\b\u0087" + // 0x10 - 0x17
|
||||
"\u0018\u0019\u0092\u008F\u001C\u001D\u001E\u001F" + // 0x18 - 0x1f
|
||||
"\u0080\u0081\u0082\u0083\u0084\n\u0017\u001B" + // 0x20 - 0x27
|
||||
"\u0088\u0089\u008A\u008B\u008C\u0005\u0006\u0007" + // 0x28 - 0x2f
|
||||
"\u0090\u0091\u0016\u0093\u0094\u0095\u0096\u0004" + // 0x30 - 0x37
|
||||
"\u0098\u0099\u009A\u009B\u0014\u0015\u009E\u001A" + // 0x38 - 0x3f
|
||||
"\u0020\u00A0\u00E2\u00E4\u0163\u00E1\u0103\u010D" + // 0x40 - 0x47
|
||||
"\u00E7\u0107\u005B\u002E\u003C\u0028\u002B\u0021" + // 0x48 - 0x4f
|
||||
"\u0026\u00E9\u0119\u00EB\u016F\u00ED\u00EE\u013E" + // 0x50 - 0x57
|
||||
"\u013A\u00DF\u005D\u0024\u002A\u0029\u003B\u005E" + // 0x58 - 0x5f
|
||||
"\u002D\u002F\u00C2\u00C4\u02DD\u00C1\u0102\u010C" + // 0x60 - 0x67
|
||||
"\u00C7\u0106\u007C\u002C\u0025\u005F\u003E\u003F" + // 0x68 - 0x6f
|
||||
"\u02C7\u00C9\u0118\u00CB\u016E\u00CD\u00CE\u013D" + // 0x70 - 0x77
|
||||
"\u0139\u0060\u003A\u0023\u0040\'\u003D\"" ; // 0x78 - 0x7f
|
||||
|
||||
|
||||
private final static char[] b2c = b2cTable.toCharArray();
|
||||
private final static char[] c2b = new char[0x300];
|
||||
private final static char[] c2bIndex = new char[0x100];
|
||||
|
||||
static {
|
||||
char[] b2cMap = b2c;
|
||||
char[] c2bNR = null;
|
||||
// remove non-roundtrip entries
|
||||
b2cMap = b2cTable.toCharArray();
|
||||
b2cMap[165] = UNMAPPABLE_DECODING;
|
||||
|
||||
// non-roundtrip c2b only entries
|
||||
c2bNR = new char[2];
|
||||
c2bNR[0] = 0x15; c2bNR[1] = 0x85;
|
||||
|
||||
SingleByte.initC2B(b2cMap, c2bNR, c2b, c2bIndex);
|
||||
}
|
||||
}
|
||||
110
jdkSrc/jdk8/sun/nio/cs/ext/IBM871.java
Normal file
110
jdkSrc/jdk8/sun/nio/cs/ext/IBM871.java
Normal file
@@ -0,0 +1,110 @@
|
||||
/*
|
||||
* Copyright (c) 2008, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package sun.nio.cs.ext;
|
||||
|
||||
import java.nio.charset.Charset;
|
||||
import java.nio.charset.CharsetDecoder;
|
||||
import java.nio.charset.CharsetEncoder;
|
||||
import sun.nio.cs.StandardCharsets;
|
||||
import sun.nio.cs.SingleByte;
|
||||
import sun.nio.cs.HistoricallyNamedCharset;
|
||||
import static sun.nio.cs.CharsetMapping.*;
|
||||
|
||||
public class IBM871 extends Charset implements HistoricallyNamedCharset
|
||||
{
|
||||
public IBM871() {
|
||||
super("IBM871", ExtendedCharsets.aliasesFor("IBM871"));
|
||||
}
|
||||
|
||||
public String historicalName() {
|
||||
return "Cp871";
|
||||
}
|
||||
|
||||
public boolean contains(Charset cs) {
|
||||
return (cs instanceof IBM871);
|
||||
}
|
||||
|
||||
public CharsetDecoder newDecoder() {
|
||||
return new SingleByte.Decoder(this, b2c);
|
||||
}
|
||||
|
||||
public CharsetEncoder newEncoder() {
|
||||
return new SingleByte.Encoder(this, c2b, c2bIndex);
|
||||
}
|
||||
|
||||
private final static String b2cTable =
|
||||
"\u00D8\u0061\u0062\u0063\u0064\u0065\u0066\u0067" + // 0x80 - 0x87
|
||||
"\u0068\u0069\u00AB\u00BB\u0060\u00FD\u007B\u00B1" + // 0x88 - 0x8f
|
||||
"\u00B0\u006A\u006B\u006C\u006D\u006E\u006F\u0070" + // 0x90 - 0x97
|
||||
"\u0071\u0072\u00AA\u00BA\u007D\u00B8\u005D\u00A4" + // 0x98 - 0x9f
|
||||
"\u00B5\u00F6\u0073\u0074\u0075\u0076\u0077\u0078" + // 0xa0 - 0xa7
|
||||
"\u0079\u007A\u00A1\u00BF\u0040\u00DD\u005B\u00AE" + // 0xa8 - 0xaf
|
||||
"\u00A2\u00A3\u00A5\u00B7\u00A9\u00A7\u00B6\u00BC" + // 0xb0 - 0xb7
|
||||
"\u00BD\u00BE\u00AC\u007C\u00AF\u00A8\\\u00D7" + // 0xb8 - 0xbf
|
||||
"\u00FE\u0041\u0042\u0043\u0044\u0045\u0046\u0047" + // 0xc0 - 0xc7
|
||||
"\u0048\u0049\u00AD\u00F4\u007E\u00F2\u00F3\u00F5" + // 0xc8 - 0xcf
|
||||
"\u00E6\u004A\u004B\u004C\u004D\u004E\u004F\u0050" + // 0xd0 - 0xd7
|
||||
"\u0051\u0052\u00B9\u00FB\u00FC\u00F9\u00FA\u00FF" + // 0xd8 - 0xdf
|
||||
"\u00B4\u00F7\u0053\u0054\u0055\u0056\u0057\u0058" + // 0xe0 - 0xe7
|
||||
"\u0059\u005A\u00B2\u00D4\u005E\u00D2\u00D3\u00D5" + // 0xe8 - 0xef
|
||||
"\u0030\u0031\u0032\u0033\u0034\u0035\u0036\u0037" + // 0xf0 - 0xf7
|
||||
"\u0038\u0039\u00B3\u00DB\u00DC\u00D9\u00DA\u009F" + // 0xf8 - 0xff
|
||||
"\u0000\u0001\u0002\u0003\u009C\t\u0086\u007F" + // 0x00 - 0x07
|
||||
"\u0097\u008D\u008E\u000B\f\r\u000E\u000F" + // 0x08 - 0x0f
|
||||
"\u0010\u0011\u0012\u0013\u009D\n\b\u0087" + // 0x10 - 0x17
|
||||
"\u0018\u0019\u0092\u008F\u001C\u001D\u001E\u001F" + // 0x18 - 0x1f
|
||||
"\u0080\u0081\u0082\u0083\u0084\n\u0017\u001B" + // 0x20 - 0x27
|
||||
"\u0088\u0089\u008A\u008B\u008C\u0005\u0006\u0007" + // 0x28 - 0x2f
|
||||
"\u0090\u0091\u0016\u0093\u0094\u0095\u0096\u0004" + // 0x30 - 0x37
|
||||
"\u0098\u0099\u009A\u009B\u0014\u0015\u009E\u001A" + // 0x38 - 0x3f
|
||||
"\u0020\u00A0\u00E2\u00E4\u00E0\u00E1\u00E3\u00E5" + // 0x40 - 0x47
|
||||
"\u00E7\u00F1\u00DE\u002E\u003C\u0028\u002B\u0021" + // 0x48 - 0x4f
|
||||
"\u0026\u00E9\u00EA\u00EB\u00E8\u00ED\u00EE\u00EF" + // 0x50 - 0x57
|
||||
"\u00EC\u00DF\u00C6\u0024\u002A\u0029\u003B\u00D6" + // 0x58 - 0x5f
|
||||
"\u002D\u002F\u00C2\u00C4\u00C0\u00C1\u00C3\u00C5" + // 0x60 - 0x67
|
||||
"\u00C7\u00D1\u00A6\u002C\u0025\u005F\u003E\u003F" + // 0x68 - 0x6f
|
||||
"\u00F8\u00C9\u00CA\u00CB\u00C8\u00CD\u00CE\u00CF" + // 0x70 - 0x77
|
||||
"\u00CC\u00F0\u003A\u0023\u00D0\'\u003D\"" ; // 0x78 - 0x7f
|
||||
|
||||
|
||||
private final static char[] b2c = b2cTable.toCharArray();
|
||||
private final static char[] c2b = new char[0x100];
|
||||
private final static char[] c2bIndex = new char[0x100];
|
||||
|
||||
static {
|
||||
char[] b2cMap = b2c;
|
||||
char[] c2bNR = null;
|
||||
// remove non-roundtrip entries
|
||||
b2cMap = b2cTable.toCharArray();
|
||||
b2cMap[165] = UNMAPPABLE_DECODING;
|
||||
|
||||
// non-roundtrip c2b only entries
|
||||
c2bNR = new char[2];
|
||||
c2bNR[0] = 0x15; c2bNR[1] = 0x85;
|
||||
|
||||
SingleByte.initC2B(b2cMap, c2bNR, c2b, c2bIndex);
|
||||
}
|
||||
}
|
||||
110
jdkSrc/jdk8/sun/nio/cs/ext/IBM875.java
Normal file
110
jdkSrc/jdk8/sun/nio/cs/ext/IBM875.java
Normal file
@@ -0,0 +1,110 @@
|
||||
/*
|
||||
* Copyright (c) 2008, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package sun.nio.cs.ext;
|
||||
|
||||
import java.nio.charset.Charset;
|
||||
import java.nio.charset.CharsetDecoder;
|
||||
import java.nio.charset.CharsetEncoder;
|
||||
import sun.nio.cs.StandardCharsets;
|
||||
import sun.nio.cs.SingleByte;
|
||||
import sun.nio.cs.HistoricallyNamedCharset;
|
||||
import static sun.nio.cs.CharsetMapping.*;
|
||||
|
||||
public class IBM875 extends Charset implements HistoricallyNamedCharset
|
||||
{
|
||||
public IBM875() {
|
||||
super("x-IBM875", ExtendedCharsets.aliasesFor("x-IBM875"));
|
||||
}
|
||||
|
||||
public String historicalName() {
|
||||
return "Cp875";
|
||||
}
|
||||
|
||||
public boolean contains(Charset cs) {
|
||||
return (cs instanceof IBM875);
|
||||
}
|
||||
|
||||
public CharsetDecoder newDecoder() {
|
||||
return new SingleByte.Decoder(this, b2c);
|
||||
}
|
||||
|
||||
public CharsetEncoder newEncoder() {
|
||||
return new SingleByte.Encoder(this, c2b, c2bIndex);
|
||||
}
|
||||
|
||||
private final static String b2cTable =
|
||||
"\u0385\u0061\u0062\u0063\u0064\u0065\u0066\u0067" + // 0x80 - 0x87
|
||||
"\u0068\u0069\u03B1\u03B2\u03B3\u03B4\u03B5\u03B6" + // 0x88 - 0x8f
|
||||
"\u00B0\u006A\u006B\u006C\u006D\u006E\u006F\u0070" + // 0x90 - 0x97
|
||||
"\u0071\u0072\u03B7\u03B8\u03B9\u03BA\u03BB\u03BC" + // 0x98 - 0x9f
|
||||
"\u00B4\u007E\u0073\u0074\u0075\u0076\u0077\u0078" + // 0xa0 - 0xa7
|
||||
"\u0079\u007A\u03BD\u03BE\u03BF\u03C0\u03C1\u03C3" + // 0xa8 - 0xaf
|
||||
"\u00A3\u03AC\u03AD\u03AE\u03CA\u03AF\u03CC\u03CD" + // 0xb0 - 0xb7
|
||||
"\u03CB\u03CE\u03C2\u03C4\u03C5\u03C6\u03C7\u03C8" + // 0xb8 - 0xbf
|
||||
"\u007B\u0041\u0042\u0043\u0044\u0045\u0046\u0047" + // 0xc0 - 0xc7
|
||||
"\u0048\u0049\u00AD\u03C9\u0390\u03B0\u2018\u2015" + // 0xc8 - 0xcf
|
||||
"\u007D\u004A\u004B\u004C\u004D\u004E\u004F\u0050" + // 0xd0 - 0xd7
|
||||
"\u0051\u0052\u00B1\u00BD\uFFFD\u0387\u2019\u00A6" + // 0xd8 - 0xdf
|
||||
"\\\uFFFD\u0053\u0054\u0055\u0056\u0057\u0058" + // 0xe0 - 0xe7
|
||||
"\u0059\u005A\u00B2\u00A7\uFFFD\uFFFD\u00AB\u00AC" + // 0xe8 - 0xef
|
||||
"\u0030\u0031\u0032\u0033\u0034\u0035\u0036\u0037" + // 0xf0 - 0xf7
|
||||
"\u0038\u0039\u00B3\u00A9\uFFFD\uFFFD\u00BB\u009F" + // 0xf8 - 0xff
|
||||
"\u0000\u0001\u0002\u0003\u009C\t\u0086\u007F" + // 0x00 - 0x07
|
||||
"\u0097\u008D\u008E\u000B\f\r\u000E\u000F" + // 0x08 - 0x0f
|
||||
"\u0010\u0011\u0012\u0013\u009D\n\b\u0087" + // 0x10 - 0x17
|
||||
"\u0018\u0019\u0092\u008F\u001C\u001D\u001E\u001F" + // 0x18 - 0x1f
|
||||
"\u0080\u0081\u0082\u0083\u0084\n\u0017\u001B" + // 0x20 - 0x27
|
||||
"\u0088\u0089\u008A\u008B\u008C\u0005\u0006\u0007" + // 0x28 - 0x2f
|
||||
"\u0090\u0091\u0016\u0093\u0094\u0095\u0096\u0004" + // 0x30 - 0x37
|
||||
"\u0098\u0099\u009A\u009B\u0014\u0015\u009E\u001A" + // 0x38 - 0x3f
|
||||
"\u0020\u0391\u0392\u0393\u0394\u0395\u0396\u0397" + // 0x40 - 0x47
|
||||
"\u0398\u0399\u005B\u002E\u003C\u0028\u002B\u0021" + // 0x48 - 0x4f
|
||||
"\u0026\u039A\u039B\u039C\u039D\u039E\u039F\u03A0" + // 0x50 - 0x57
|
||||
"\u03A1\u03A3\u005D\u0024\u002A\u0029\u003B\u005E" + // 0x58 - 0x5f
|
||||
"\u002D\u002F\u03A4\u03A5\u03A6\u03A7\u03A8\u03A9" + // 0x60 - 0x67
|
||||
"\u03AA\u03AB\u007C\u002C\u0025\u005F\u003E\u003F" + // 0x68 - 0x6f
|
||||
"\u00A8\u0386\u0388\u0389\u00A0\u038A\u038C\u038E" + // 0x70 - 0x77
|
||||
"\u038F\u0060\u003A\u0023\u0040\'\u003D\"" ; // 0x78 - 0x7f
|
||||
|
||||
|
||||
private final static char[] b2c = b2cTable.toCharArray();
|
||||
private final static char[] c2b = new char[0x400];
|
||||
private final static char[] c2bIndex = new char[0x100];
|
||||
|
||||
static {
|
||||
char[] b2cMap = b2c;
|
||||
char[] c2bNR = null;
|
||||
// remove non-roundtrip entries
|
||||
b2cMap = b2cTable.toCharArray();
|
||||
b2cMap[165] = UNMAPPABLE_DECODING;
|
||||
|
||||
// non-roundtrip c2b only entries
|
||||
c2bNR = new char[2];
|
||||
c2bNR[0] = 0x15; c2bNR[1] = 0x85;
|
||||
|
||||
SingleByte.initC2B(b2cMap, c2bNR, c2b, c2bIndex);
|
||||
}
|
||||
}
|
||||
110
jdkSrc/jdk8/sun/nio/cs/ext/IBM918.java
Normal file
110
jdkSrc/jdk8/sun/nio/cs/ext/IBM918.java
Normal file
@@ -0,0 +1,110 @@
|
||||
/*
|
||||
* Copyright (c) 2008, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package sun.nio.cs.ext;
|
||||
|
||||
import java.nio.charset.Charset;
|
||||
import java.nio.charset.CharsetDecoder;
|
||||
import java.nio.charset.CharsetEncoder;
|
||||
import sun.nio.cs.StandardCharsets;
|
||||
import sun.nio.cs.SingleByte;
|
||||
import sun.nio.cs.HistoricallyNamedCharset;
|
||||
import static sun.nio.cs.CharsetMapping.*;
|
||||
|
||||
public class IBM918 extends Charset implements HistoricallyNamedCharset
|
||||
{
|
||||
public IBM918() {
|
||||
super("IBM918", ExtendedCharsets.aliasesFor("IBM918"));
|
||||
}
|
||||
|
||||
public String historicalName() {
|
||||
return "Cp918";
|
||||
}
|
||||
|
||||
public boolean contains(Charset cs) {
|
||||
return (cs instanceof IBM918);
|
||||
}
|
||||
|
||||
public CharsetDecoder newDecoder() {
|
||||
return new SingleByte.Decoder(this, b2c);
|
||||
}
|
||||
|
||||
public CharsetEncoder newEncoder() {
|
||||
return new SingleByte.Encoder(this, c2b, c2bIndex);
|
||||
}
|
||||
|
||||
private final static String b2cTable =
|
||||
"\uFEA7\u0061\u0062\u0063\u0064\u0065\u0066\u0067" + // 0x80 - 0x87
|
||||
"\u0068\u0069\uFEA9\uFB88\uFEAB\uFEAD\uFB8C\uFEAF" + // 0x88 - 0x8f
|
||||
"\uFB8A\u006A\u006B\u006C\u006D\u006E\u006F\u0070" + // 0x90 - 0x97
|
||||
"\u0071\u0072\uFEB1\uFEB3\uFEB5\uFEB7\uFEB9\uFEBB" + // 0x98 - 0x9f
|
||||
"\uFEBD\u007E\u0073\u0074\u0075\u0076\u0077\u0078" + // 0xa0 - 0xa7
|
||||
"\u0079\u007A\uFEBF\uFEC3\uFEC7\uFEC9\uFECA\uFECB" + // 0xa8 - 0xaf
|
||||
"\uFECC\uFECD\uFECE\uFECF\uFED0\uFED1\uFED3\uFED5" + // 0xb0 - 0xb7
|
||||
"\uFED7\uFB8E\uFEDB\u007C\uFB92\uFB94\uFEDD\uFEDF" + // 0xb8 - 0xbf
|
||||
"\u007B\u0041\u0042\u0043\u0044\u0045\u0046\u0047" + // 0xc0 - 0xc7
|
||||
"\u0048\u0049\u00AD\uFEE0\uFEE1\uFEE3\uFB9E\uFEE5" + // 0xc8 - 0xcf
|
||||
"\u007D\u004A\u004B\u004C\u004D\u004E\u004F\u0050" + // 0xd0 - 0xd7
|
||||
"\u0051\u0052\uFEE7\uFE85\uFEED\uFBA6\uFBA8\uFBA9" + // 0xd8 - 0xdf
|
||||
"\\\uFBAA\u0053\u0054\u0055\u0056\u0057\u0058" + // 0xe0 - 0xe7
|
||||
"\u0059\u005A\uFE80\uFE89\uFE8A\uFE8B\uFBFC\uFBFD" + // 0xe8 - 0xef
|
||||
"\u0030\u0031\u0032\u0033\u0034\u0035\u0036\u0037" + // 0xf0 - 0xf7
|
||||
"\u0038\u0039\uFBFE\uFBB0\uFBAE\uFE7C\uFE7D\u009F" + // 0xf8 - 0xff
|
||||
"\u0000\u0001\u0002\u0003\u009C\t\u0086\u007F" + // 0x00 - 0x07
|
||||
"\u0097\u008D\u008E\u000B\f\r\u000E\u000F" + // 0x08 - 0x0f
|
||||
"\u0010\u0011\u0012\u0013\u009D\n\b\u0087" + // 0x10 - 0x17
|
||||
"\u0018\u0019\u0092\u008F\u001C\u001D\u001E\u001F" + // 0x18 - 0x1f
|
||||
"\u0080\u0081\u0082\u0083\u0084\n\u0017\u001B" + // 0x20 - 0x27
|
||||
"\u0088\u0089\u008A\u008B\u008C\u0005\u0006\u0007" + // 0x28 - 0x2f
|
||||
"\u0090\u0091\u0016\u0093\u0094\u0095\u0096\u0004" + // 0x30 - 0x37
|
||||
"\u0098\u0099\u009A\u009B\u0014\u0015\u009E\u001A" + // 0x38 - 0x3f
|
||||
"\u0020\u00A0\u060C\u061B\u061F\uFE81\uFE8D\uFE8E" + // 0x40 - 0x47
|
||||
"\uF8FB\uFE8F\u005B\u002E\u003C\u0028\u002B\u0021" + // 0x48 - 0x4f
|
||||
"\u0026\uFE91\uFB56\uFB58\uFE93\uFE95\uFE97\uFB66" + // 0x50 - 0x57
|
||||
"\uFB68\uFE99\u005D\u0024\u002A\u0029\u003B\u005E" + // 0x58 - 0x5f
|
||||
"\u002D\u002F\uFE9B\uFE9D\uFE9F\uFB7A\uFB7C\uFEA1" + // 0x60 - 0x67
|
||||
"\uFEA3\uFEA5\u0060\u002C\u0025\u005F\u003E\u003F" + // 0x68 - 0x6f
|
||||
"\u06F0\u06F1\u06F2\u06F3\u06F4\u06F5\u06F6\u06F7" + // 0x70 - 0x77
|
||||
"\u06F8\u06F9\u003A\u0023\u0040\'\u003D\"" ; // 0x78 - 0x7f
|
||||
|
||||
|
||||
private final static char[] b2c = b2cTable.toCharArray();
|
||||
private final static char[] c2b = new char[0x500];
|
||||
private final static char[] c2bIndex = new char[0x100];
|
||||
|
||||
static {
|
||||
char[] b2cMap = b2c;
|
||||
char[] c2bNR = null;
|
||||
// remove non-roundtrip entries
|
||||
b2cMap = b2cTable.toCharArray();
|
||||
b2cMap[165] = UNMAPPABLE_DECODING;
|
||||
|
||||
// non-roundtrip c2b only entries
|
||||
c2bNR = new char[2];
|
||||
c2bNR[0] = 0x15; c2bNR[1] = 0x85;
|
||||
|
||||
SingleByte.initC2B(b2cMap, c2bNR, c2b, c2bIndex);
|
||||
}
|
||||
}
|
||||
102
jdkSrc/jdk8/sun/nio/cs/ext/IBM921.java
Normal file
102
jdkSrc/jdk8/sun/nio/cs/ext/IBM921.java
Normal file
@@ -0,0 +1,102 @@
|
||||
/*
|
||||
* Copyright (c) 2008, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package sun.nio.cs.ext;
|
||||
|
||||
import java.nio.charset.Charset;
|
||||
import java.nio.charset.CharsetDecoder;
|
||||
import java.nio.charset.CharsetEncoder;
|
||||
import sun.nio.cs.StandardCharsets;
|
||||
import sun.nio.cs.SingleByte;
|
||||
import sun.nio.cs.HistoricallyNamedCharset;
|
||||
import static sun.nio.cs.CharsetMapping.*;
|
||||
|
||||
public class IBM921 extends Charset implements HistoricallyNamedCharset
|
||||
{
|
||||
public IBM921() {
|
||||
super("x-IBM921", ExtendedCharsets.aliasesFor("x-IBM921"));
|
||||
}
|
||||
|
||||
public String historicalName() {
|
||||
return "Cp921";
|
||||
}
|
||||
|
||||
public boolean contains(Charset cs) {
|
||||
return (cs instanceof IBM921);
|
||||
}
|
||||
|
||||
public CharsetDecoder newDecoder() {
|
||||
return new SingleByte.Decoder(this, b2c);
|
||||
}
|
||||
|
||||
public CharsetEncoder newEncoder() {
|
||||
return new SingleByte.Encoder(this, c2b, c2bIndex);
|
||||
}
|
||||
|
||||
private final static String b2cTable =
|
||||
"\u0080\u0081\u0082\u0083\u0084\u0085\u0086\u0087" + // 0x80 - 0x87
|
||||
"\u0088\u0089\u008A\u008B\u008C\u008D\u008E\u008F" + // 0x88 - 0x8f
|
||||
"\u0090\u0091\u0092\u0093\u0094\u0095\u0096\u0097" + // 0x90 - 0x97
|
||||
"\u0098\u0099\u009A\u009B\u009C\u009D\u009E\u009F" + // 0x98 - 0x9f
|
||||
"\u00A0\u201D\u00A2\u00A3\u00A4\u201E\u00A6\u00A7" + // 0xa0 - 0xa7
|
||||
"\u00D8\u00A9\u0156\u00AB\u00AC\u00AD\u00AE\u00C6" + // 0xa8 - 0xaf
|
||||
"\u00B0\u00B1\u00B2\u00B3\u201C\u00B5\u00B6\u00B7" + // 0xb0 - 0xb7
|
||||
"\u00F8\u00B9\u0157\u00BB\u00BC\u00BD\u00BE\u00E6" + // 0xb8 - 0xbf
|
||||
"\u0104\u012E\u0100\u0106\u00C4\u00C5\u0118\u0112" + // 0xc0 - 0xc7
|
||||
"\u010C\u00C9\u0179\u0116\u0122\u0136\u012A\u013B" + // 0xc8 - 0xcf
|
||||
"\u0160\u0143\u0145\u00D3\u014C\u00D5\u00D6\u00D7" + // 0xd0 - 0xd7
|
||||
"\u0172\u0141\u015A\u016A\u00DC\u017B\u017D\u00DF" + // 0xd8 - 0xdf
|
||||
"\u0105\u012F\u0101\u0107\u00E4\u00E5\u0119\u0113" + // 0xe0 - 0xe7
|
||||
"\u010D\u00E9\u017A\u0117\u0123\u0137\u012B\u013C" + // 0xe8 - 0xef
|
||||
"\u0161\u0144\u0146\u00F3\u014D\u00F5\u00F6\u00F7" + // 0xf0 - 0xf7
|
||||
"\u0173\u0142\u015B\u016B\u00FC\u017C\u017E\u2019" + // 0xf8 - 0xff
|
||||
"\u0000\u0001\u0002\u0003\u0004\u0005\u0006\u0007" + // 0x00 - 0x07
|
||||
"\b\t\n\u000B\f\r\u000E\u000F" + // 0x08 - 0x0f
|
||||
"\u0010\u0011\u0012\u0013\u0014\u0015\u0016\u0017" + // 0x10 - 0x17
|
||||
"\u0018\u0019\u001A\u001B\u001C\u001D\u001E\u001F" + // 0x18 - 0x1f
|
||||
"\u0020\u0021\"\u0023\u0024\u0025\u0026\'" + // 0x20 - 0x27
|
||||
"\u0028\u0029\u002A\u002B\u002C\u002D\u002E\u002F" + // 0x28 - 0x2f
|
||||
"\u0030\u0031\u0032\u0033\u0034\u0035\u0036\u0037" + // 0x30 - 0x37
|
||||
"\u0038\u0039\u003A\u003B\u003C\u003D\u003E\u003F" + // 0x38 - 0x3f
|
||||
"\u0040\u0041\u0042\u0043\u0044\u0045\u0046\u0047" + // 0x40 - 0x47
|
||||
"\u0048\u0049\u004A\u004B\u004C\u004D\u004E\u004F" + // 0x48 - 0x4f
|
||||
"\u0050\u0051\u0052\u0053\u0054\u0055\u0056\u0057" + // 0x50 - 0x57
|
||||
"\u0058\u0059\u005A\u005B\\\u005D\u005E\u005F" + // 0x58 - 0x5f
|
||||
"\u0060\u0061\u0062\u0063\u0064\u0065\u0066\u0067" + // 0x60 - 0x67
|
||||
"\u0068\u0069\u006A\u006B\u006C\u006D\u006E\u006F" + // 0x68 - 0x6f
|
||||
"\u0070\u0071\u0072\u0073\u0074\u0075\u0076\u0077" + // 0x70 - 0x77
|
||||
"\u0078\u0079\u007A\u007B\u007C\u007D\u007E\u007F" ; // 0x78 - 0x7f
|
||||
|
||||
|
||||
private final static char[] b2c = b2cTable.toCharArray();
|
||||
private final static char[] c2b = new char[0x300];
|
||||
private final static char[] c2bIndex = new char[0x100];
|
||||
|
||||
static {
|
||||
char[] b2cMap = b2c;
|
||||
char[] c2bNR = null;
|
||||
SingleByte.initC2B(b2cMap, c2bNR, c2b, c2bIndex);
|
||||
}
|
||||
}
|
||||
102
jdkSrc/jdk8/sun/nio/cs/ext/IBM922.java
Normal file
102
jdkSrc/jdk8/sun/nio/cs/ext/IBM922.java
Normal file
@@ -0,0 +1,102 @@
|
||||
/*
|
||||
* Copyright (c) 2008, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package sun.nio.cs.ext;
|
||||
|
||||
import java.nio.charset.Charset;
|
||||
import java.nio.charset.CharsetDecoder;
|
||||
import java.nio.charset.CharsetEncoder;
|
||||
import sun.nio.cs.StandardCharsets;
|
||||
import sun.nio.cs.SingleByte;
|
||||
import sun.nio.cs.HistoricallyNamedCharset;
|
||||
import static sun.nio.cs.CharsetMapping.*;
|
||||
|
||||
public class IBM922 extends Charset implements HistoricallyNamedCharset
|
||||
{
|
||||
public IBM922() {
|
||||
super("x-IBM922", ExtendedCharsets.aliasesFor("x-IBM922"));
|
||||
}
|
||||
|
||||
public String historicalName() {
|
||||
return "Cp922";
|
||||
}
|
||||
|
||||
public boolean contains(Charset cs) {
|
||||
return (cs instanceof IBM922);
|
||||
}
|
||||
|
||||
public CharsetDecoder newDecoder() {
|
||||
return new SingleByte.Decoder(this, b2c);
|
||||
}
|
||||
|
||||
public CharsetEncoder newEncoder() {
|
||||
return new SingleByte.Encoder(this, c2b, c2bIndex);
|
||||
}
|
||||
|
||||
private final static String b2cTable =
|
||||
"\u0080\u0081\u0082\u0083\u0084\u0085\u0086\u0087" + // 0x80 - 0x87
|
||||
"\u0088\u0089\u008A\u008B\u008C\u008D\u008E\u008F" + // 0x88 - 0x8f
|
||||
"\u0090\u0091\u0092\u0093\u0094\u0095\u0096\u0097" + // 0x90 - 0x97
|
||||
"\u0098\u0099\u009A\u009B\u009C\u009D\u009E\u009F" + // 0x98 - 0x9f
|
||||
"\u00A0\u00A1\u00A2\u00A3\u00A4\u00A5\u00A6\u00A7" + // 0xa0 - 0xa7
|
||||
"\u00A8\u00A9\u00AA\u00AB\u00AC\u00AD\u00AE\u203E" + // 0xa8 - 0xaf
|
||||
"\u00B0\u00B1\u00B2\u00B3\u00B4\u00B5\u00B6\u00B7" + // 0xb0 - 0xb7
|
||||
"\u00B8\u00B9\u00BA\u00BB\u00BC\u00BD\u00BE\u00BF" + // 0xb8 - 0xbf
|
||||
"\u00C0\u00C1\u00C2\u00C3\u00C4\u00C5\u00C6\u00C7" + // 0xc0 - 0xc7
|
||||
"\u00C8\u00C9\u00CA\u00CB\u00CC\u00CD\u00CE\u00CF" + // 0xc8 - 0xcf
|
||||
"\u0160\u00D1\u00D2\u00D3\u00D4\u00D5\u00D6\u00D7" + // 0xd0 - 0xd7
|
||||
"\u00D8\u00D9\u00DA\u00DB\u00DC\u00DD\u017D\u00DF" + // 0xd8 - 0xdf
|
||||
"\u00E0\u00E1\u00E2\u00E3\u00E4\u00E5\u00E6\u00E7" + // 0xe0 - 0xe7
|
||||
"\u00E8\u00E9\u00EA\u00EB\u00EC\u00ED\u00EE\u00EF" + // 0xe8 - 0xef
|
||||
"\u0161\u00F1\u00F2\u00F3\u00F4\u00F5\u00F6\u00F7" + // 0xf0 - 0xf7
|
||||
"\u00F8\u00F9\u00FA\u00FB\u00FC\u00FD\u017E\u00FF" + // 0xf8 - 0xff
|
||||
"\u0000\u0001\u0002\u0003\u0004\u0005\u0006\u0007" + // 0x00 - 0x07
|
||||
"\b\t\n\u000B\f\r\u000E\u000F" + // 0x08 - 0x0f
|
||||
"\u0010\u0011\u0012\u0013\u0014\u0015\u0016\u0017" + // 0x10 - 0x17
|
||||
"\u0018\u0019\u001A\u001B\u001C\u001D\u001E\u001F" + // 0x18 - 0x1f
|
||||
"\u0020\u0021\"\u0023\u0024\u0025\u0026\'" + // 0x20 - 0x27
|
||||
"\u0028\u0029\u002A\u002B\u002C\u002D\u002E\u002F" + // 0x28 - 0x2f
|
||||
"\u0030\u0031\u0032\u0033\u0034\u0035\u0036\u0037" + // 0x30 - 0x37
|
||||
"\u0038\u0039\u003A\u003B\u003C\u003D\u003E\u003F" + // 0x38 - 0x3f
|
||||
"\u0040\u0041\u0042\u0043\u0044\u0045\u0046\u0047" + // 0x40 - 0x47
|
||||
"\u0048\u0049\u004A\u004B\u004C\u004D\u004E\u004F" + // 0x48 - 0x4f
|
||||
"\u0050\u0051\u0052\u0053\u0054\u0055\u0056\u0057" + // 0x50 - 0x57
|
||||
"\u0058\u0059\u005A\u005B\\\u005D\u005E\u005F" + // 0x58 - 0x5f
|
||||
"\u0060\u0061\u0062\u0063\u0064\u0065\u0066\u0067" + // 0x60 - 0x67
|
||||
"\u0068\u0069\u006A\u006B\u006C\u006D\u006E\u006F" + // 0x68 - 0x6f
|
||||
"\u0070\u0071\u0072\u0073\u0074\u0075\u0076\u0077" + // 0x70 - 0x77
|
||||
"\u0078\u0079\u007A\u007B\u007C\u007D\u007E\u007F" ; // 0x78 - 0x7f
|
||||
|
||||
|
||||
private final static char[] b2c = b2cTable.toCharArray();
|
||||
private final static char[] c2b = new char[0x300];
|
||||
private final static char[] c2bIndex = new char[0x100];
|
||||
|
||||
static {
|
||||
char[] b2cMap = b2c;
|
||||
char[] c2bNR = null;
|
||||
SingleByte.initC2B(b2cMap, c2bNR, c2b, c2bIndex);
|
||||
}
|
||||
}
|
||||
1882
jdkSrc/jdk8/sun/nio/cs/ext/IBM930.java
Normal file
1882
jdkSrc/jdk8/sun/nio/cs/ext/IBM930.java
Normal file
File diff suppressed because it is too large
Load Diff
3408
jdkSrc/jdk8/sun/nio/cs/ext/IBM933.java
Normal file
3408
jdkSrc/jdk8/sun/nio/cs/ext/IBM933.java
Normal file
File diff suppressed because it is too large
Load Diff
1639
jdkSrc/jdk8/sun/nio/cs/ext/IBM935.java
Normal file
1639
jdkSrc/jdk8/sun/nio/cs/ext/IBM935.java
Normal file
File diff suppressed because it is too large
Load Diff
3043
jdkSrc/jdk8/sun/nio/cs/ext/IBM937.java
Normal file
3043
jdkSrc/jdk8/sun/nio/cs/ext/IBM937.java
Normal file
File diff suppressed because it is too large
Load Diff
1882
jdkSrc/jdk8/sun/nio/cs/ext/IBM939.java
Normal file
1882
jdkSrc/jdk8/sun/nio/cs/ext/IBM939.java
Normal file
File diff suppressed because it is too large
Load Diff
1603
jdkSrc/jdk8/sun/nio/cs/ext/IBM942.java
Normal file
1603
jdkSrc/jdk8/sun/nio/cs/ext/IBM942.java
Normal file
File diff suppressed because it is too large
Load Diff
92
jdkSrc/jdk8/sun/nio/cs/ext/IBM942C.java
Normal file
92
jdkSrc/jdk8/sun/nio/cs/ext/IBM942C.java
Normal file
@@ -0,0 +1,92 @@
|
||||
/*
|
||||
* Copyright (c) 2003, 2004, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package sun.nio.cs.ext;
|
||||
|
||||
import java.nio.charset.Charset;
|
||||
import java.nio.charset.CharsetDecoder;
|
||||
import java.nio.charset.CharsetEncoder;
|
||||
import java.util.Arrays;
|
||||
import sun.nio.cs.HistoricallyNamedCharset;
|
||||
import static sun.nio.cs.CharsetMapping.*;
|
||||
|
||||
public class IBM942C extends Charset implements HistoricallyNamedCharset
|
||||
{
|
||||
public IBM942C() {
|
||||
super("x-IBM942C", ExtendedCharsets.aliasesFor("x-IBM942C"));
|
||||
}
|
||||
|
||||
public String historicalName() {
|
||||
return "Cp942C";
|
||||
}
|
||||
|
||||
public boolean contains(Charset cs) {
|
||||
return ((cs.name().equals("US-ASCII"))
|
||||
|| (cs instanceof IBM942C));
|
||||
}
|
||||
|
||||
public CharsetDecoder newDecoder() {
|
||||
return new DoubleByte.Decoder(this,
|
||||
IBM942.b2c,
|
||||
b2cSB,
|
||||
0x40,
|
||||
0xfc);
|
||||
}
|
||||
|
||||
public CharsetEncoder newEncoder() {
|
||||
return new DoubleByte.Encoder(this, c2b, c2bIndex);
|
||||
}
|
||||
|
||||
final static char[] b2cSB;
|
||||
final static char[] c2b;
|
||||
final static char[] c2bIndex;
|
||||
|
||||
static {
|
||||
IBM942.initb2c();
|
||||
|
||||
// the mappings need udpate are
|
||||
// u+001a <-> 0x1a
|
||||
// u+001c <-> 0x1c
|
||||
// u+005c <-> 0x5c
|
||||
// u+007e <-> 0x7e
|
||||
// u+007f <-> 0x7f
|
||||
|
||||
b2cSB = Arrays.copyOf(IBM942.b2cSB, IBM942.b2cSB.length);
|
||||
b2cSB[0x1a] = 0x1a;
|
||||
b2cSB[0x1c] = 0x1c;
|
||||
b2cSB[0x5c] = 0x5c;
|
||||
b2cSB[0x7e] = 0x7e;
|
||||
b2cSB[0x7f] = 0x7f;
|
||||
|
||||
IBM942.initc2b();
|
||||
c2b = Arrays.copyOf(IBM942.c2b, IBM942.c2b.length);
|
||||
c2bIndex = Arrays.copyOf(IBM942.c2bIndex, IBM942.c2bIndex.length);
|
||||
c2b[c2bIndex[0] + 0x1a] = 0x1a;
|
||||
c2b[c2bIndex[0] + 0x1c] = 0x1c;
|
||||
c2b[c2bIndex[0] + 0x5c] = 0x5c;
|
||||
c2b[c2bIndex[0] + 0x7e] = 0x7e;
|
||||
c2b[c2bIndex[0] + 0x7f] = 0x7f;
|
||||
}
|
||||
}
|
||||
1772
jdkSrc/jdk8/sun/nio/cs/ext/IBM943.java
Normal file
1772
jdkSrc/jdk8/sun/nio/cs/ext/IBM943.java
Normal file
File diff suppressed because it is too large
Load Diff
84
jdkSrc/jdk8/sun/nio/cs/ext/IBM943C.java
Normal file
84
jdkSrc/jdk8/sun/nio/cs/ext/IBM943C.java
Normal file
@@ -0,0 +1,84 @@
|
||||
/*
|
||||
* Copyright (c) 2003, 2004, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package sun.nio.cs.ext;
|
||||
|
||||
import java.nio.charset.Charset;
|
||||
import java.nio.charset.CharsetDecoder;
|
||||
import java.nio.charset.CharsetEncoder;
|
||||
import java.util.Arrays;
|
||||
import sun.nio.cs.HistoricallyNamedCharset;
|
||||
|
||||
public class IBM943C extends Charset implements HistoricallyNamedCharset
|
||||
{
|
||||
|
||||
public IBM943C() {
|
||||
super("x-IBM943C", ExtendedCharsets.aliasesFor("x-IBM943C"));
|
||||
}
|
||||
|
||||
public String historicalName() {
|
||||
return "Cp943C";
|
||||
}
|
||||
|
||||
public boolean contains(Charset cs) {
|
||||
return ((cs.name().equals("US-ASCII"))
|
||||
|| (cs instanceof IBM943C));
|
||||
}
|
||||
|
||||
public CharsetDecoder newDecoder() {
|
||||
return new DoubleByte.Decoder(this,
|
||||
IBM943.b2c,
|
||||
b2cSB,
|
||||
0x40,
|
||||
0xfc);
|
||||
}
|
||||
|
||||
public CharsetEncoder newEncoder() {
|
||||
return new DoubleByte.Encoder(this, c2b, c2bIndex);
|
||||
}
|
||||
|
||||
final static char[] b2cSB;
|
||||
final static char[] c2b;
|
||||
final static char[] c2bIndex;
|
||||
|
||||
static {
|
||||
IBM943.initb2c();
|
||||
b2cSB = new char[0x100];
|
||||
for (int i = 0; i < 0x80; i++) {
|
||||
b2cSB[i] = (char)i;
|
||||
}
|
||||
for (int i = 0x80; i < 0x100; i++) {
|
||||
b2cSB[i] = IBM943.b2cSB[i];
|
||||
}
|
||||
|
||||
IBM943.initc2b();
|
||||
c2b = Arrays.copyOf(IBM943.c2b, IBM943.c2b.length);
|
||||
c2bIndex = Arrays.copyOf(IBM943.c2bIndex, IBM943.c2bIndex.length);
|
||||
for (char c = '\0'; c < '\u0080'; ++c) {
|
||||
int index = c2bIndex[c >> 8];
|
||||
c2b[index + (c & 0xff)] = c;
|
||||
}
|
||||
}
|
||||
}
|
||||
3040
jdkSrc/jdk8/sun/nio/cs/ext/IBM948.java
Normal file
3040
jdkSrc/jdk8/sun/nio/cs/ext/IBM948.java
Normal file
File diff suppressed because it is too large
Load Diff
1592
jdkSrc/jdk8/sun/nio/cs/ext/IBM949.java
Normal file
1592
jdkSrc/jdk8/sun/nio/cs/ext/IBM949.java
Normal file
File diff suppressed because it is too large
Load Diff
83
jdkSrc/jdk8/sun/nio/cs/ext/IBM949C.java
Normal file
83
jdkSrc/jdk8/sun/nio/cs/ext/IBM949C.java
Normal file
@@ -0,0 +1,83 @@
|
||||
/*
|
||||
* Copyright (c) 2003, 2004, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package sun.nio.cs.ext;
|
||||
|
||||
import java.nio.charset.Charset;
|
||||
import java.nio.charset.CharsetDecoder;
|
||||
import java.nio.charset.CharsetEncoder;
|
||||
import java.util.Arrays;
|
||||
import sun.nio.cs.HistoricallyNamedCharset;
|
||||
|
||||
public class IBM949C extends Charset implements HistoricallyNamedCharset
|
||||
{
|
||||
|
||||
public IBM949C() {
|
||||
super("x-IBM949C", ExtendedCharsets.aliasesFor("x-IBM949C"));
|
||||
}
|
||||
|
||||
public String historicalName() {
|
||||
return "Cp949C";
|
||||
}
|
||||
|
||||
public boolean contains(Charset cs) {
|
||||
return ((cs.name().equals("US-ASCII"))
|
||||
|| (cs instanceof IBM949C));
|
||||
}
|
||||
|
||||
public CharsetDecoder newDecoder() {
|
||||
return new DoubleByte.Decoder(this,
|
||||
IBM949.b2c,
|
||||
b2cSB,
|
||||
0xa1,
|
||||
0xfe);
|
||||
}
|
||||
|
||||
public CharsetEncoder newEncoder() {
|
||||
return new DoubleByte.Encoder(this, c2b, c2bIndex);
|
||||
}
|
||||
|
||||
final static char[] b2cSB;
|
||||
final static char[] c2b;
|
||||
final static char[] c2bIndex;
|
||||
|
||||
static {
|
||||
IBM949.initb2c();
|
||||
b2cSB = new char[0x100];
|
||||
for (int i = 0; i < 0x80; i++) {
|
||||
b2cSB[i] = (char)i;
|
||||
}
|
||||
for (int i = 0x80; i < 0x100; i++) {
|
||||
b2cSB[i] = IBM949.b2cSB[i];
|
||||
}
|
||||
IBM949.initc2b();
|
||||
c2b = Arrays.copyOf(IBM949.c2b, IBM949.c2b.length);
|
||||
c2bIndex = Arrays.copyOf(IBM949.c2bIndex, IBM949.c2bIndex.length);
|
||||
for (char c = '\0'; c < '\u0080'; ++c) {
|
||||
int index = c2bIndex[c >> 8];
|
||||
c2b[index + (c & 0xff)] = c;
|
||||
}
|
||||
}
|
||||
}
|
||||
3339
jdkSrc/jdk8/sun/nio/cs/ext/IBM950.java
Normal file
3339
jdkSrc/jdk8/sun/nio/cs/ext/IBM950.java
Normal file
File diff suppressed because it is too large
Load Diff
10532
jdkSrc/jdk8/sun/nio/cs/ext/IBM964.java
Normal file
10532
jdkSrc/jdk8/sun/nio/cs/ext/IBM964.java
Normal file
File diff suppressed because it is too large
Load Diff
1398
jdkSrc/jdk8/sun/nio/cs/ext/IBM970.java
Normal file
1398
jdkSrc/jdk8/sun/nio/cs/ext/IBM970.java
Normal file
File diff suppressed because it is too large
Load Diff
963
jdkSrc/jdk8/sun/nio/cs/ext/ISCII91.java
Normal file
963
jdkSrc/jdk8/sun/nio/cs/ext/ISCII91.java
Normal file
@@ -0,0 +1,963 @@
|
||||
/*
|
||||
* Copyright (c) 2002, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
/*
|
||||
*/
|
||||
|
||||
|
||||
package sun.nio.cs.ext;
|
||||
|
||||
import java.nio.charset.Charset;
|
||||
import java.nio.CharBuffer;
|
||||
import java.nio.ByteBuffer;
|
||||
import java.nio.charset.CharsetDecoder;
|
||||
import java.nio.charset.CharsetEncoder;
|
||||
import java.nio.charset.CoderResult;
|
||||
import sun.nio.cs.Surrogate;
|
||||
import sun.nio.cs.HistoricallyNamedCharset;
|
||||
|
||||
public class ISCII91 extends Charset implements HistoricallyNamedCharset
|
||||
{
|
||||
private static final char NUKTA_CHAR = '\u093c';
|
||||
private static final char HALANT_CHAR = '\u094d';
|
||||
private static final byte NO_CHAR = (byte)255;
|
||||
|
||||
public ISCII91() {
|
||||
super("x-ISCII91", ExtendedCharsets.aliasesFor("x-ISCII91"));
|
||||
}
|
||||
|
||||
public String historicalName() {
|
||||
return "ISCII91";
|
||||
}
|
||||
|
||||
public boolean contains(Charset cs) {
|
||||
return ((cs.name().equals("US-ASCII"))
|
||||
|| (cs instanceof ISCII91));
|
||||
}
|
||||
|
||||
public CharsetDecoder newDecoder() {
|
||||
return new Decoder(this);
|
||||
}
|
||||
|
||||
public CharsetEncoder newEncoder() {
|
||||
return new Encoder(this);
|
||||
}
|
||||
|
||||
private static final char[] directMapTable = {
|
||||
'\u0000', // ascii character
|
||||
'\u0001', // ascii character
|
||||
'\u0002', // ascii character
|
||||
'\u0003', // ascii character
|
||||
'\u0004', // ascii character
|
||||
'\u0005', // ascii character
|
||||
'\u0006', // ascii character
|
||||
'\u0007', // ascii character
|
||||
'\u0008', // ascii character
|
||||
'\u0009', // ascii character
|
||||
'\012', // ascii character
|
||||
'\u000b', // ascii character
|
||||
'\u000c', // ascii character
|
||||
'\015', // ascii character
|
||||
'\u000e', // ascii character
|
||||
'\u000f', // ascii character
|
||||
'\u0010', // ascii character
|
||||
'\u0011', // ascii character
|
||||
'\u0012', // ascii character
|
||||
'\u0013', // ascii character
|
||||
'\u0014', // ascii character
|
||||
'\u0015', // ascii character
|
||||
'\u0016', // ascii character
|
||||
'\u0017', // ascii character
|
||||
'\u0018', // ascii character
|
||||
'\u0019', // ascii character
|
||||
'\u001a', // ascii character
|
||||
'\u001b', // ascii character
|
||||
'\u001c', // ascii character
|
||||
'\u001d', // ascii character
|
||||
'\u001e', // ascii character
|
||||
'\u001f', // ascii character
|
||||
'\u0020', // ascii character
|
||||
'\u0021', // ascii character
|
||||
'\u0022', // ascii character
|
||||
'\u0023', // ascii character
|
||||
'\u0024', // ascii character
|
||||
'\u0025', // ascii character
|
||||
'\u0026', // ascii character
|
||||
(char)0x0027, // '\u0027' control -- ascii character
|
||||
'\u0028', // ascii character
|
||||
'\u0029', // ascii character
|
||||
'\u002a', // ascii character
|
||||
'\u002b', // ascii character
|
||||
'\u002c', // ascii character
|
||||
'\u002d', // ascii character
|
||||
'\u002e', // ascii character
|
||||
'\u002f', // ascii character
|
||||
'\u0030', // ascii character
|
||||
'\u0031', // ascii character
|
||||
'\u0032', // ascii character
|
||||
'\u0033', // ascii character
|
||||
'\u0034', // ascii character
|
||||
'\u0035', // ascii character
|
||||
'\u0036', // ascii character
|
||||
'\u0037', // ascii character
|
||||
'\u0038', // ascii character
|
||||
'\u0039', // ascii character
|
||||
'\u003a', // ascii character
|
||||
'\u003b', // ascii character
|
||||
'\u003c', // ascii character
|
||||
'\u003d', // ascii character
|
||||
'\u003e', // ascii character
|
||||
'\u003f', // ascii character
|
||||
'\u0040', // ascii character
|
||||
'\u0041', // ascii character
|
||||
'\u0042', // ascii character
|
||||
'\u0043', // ascii character
|
||||
'\u0044', // ascii character
|
||||
'\u0045', // ascii character
|
||||
'\u0046', // ascii character
|
||||
'\u0047', // ascii character
|
||||
'\u0048', // ascii character
|
||||
'\u0049', // ascii character
|
||||
'\u004a', // ascii character
|
||||
'\u004b', // ascii character
|
||||
'\u004c', // ascii character
|
||||
'\u004d', // ascii character
|
||||
'\u004e', // ascii character
|
||||
'\u004f', // ascii character
|
||||
'\u0050', // ascii character
|
||||
'\u0051', // ascii character
|
||||
'\u0052', // ascii character
|
||||
'\u0053', // ascii character
|
||||
'\u0054', // ascii character
|
||||
'\u0055', // ascii character
|
||||
'\u0056', // ascii character
|
||||
'\u0057', // ascii character
|
||||
'\u0058', // ascii character
|
||||
'\u0059', // ascii character
|
||||
'\u005a', // ascii character
|
||||
'\u005b', // ascii character
|
||||
'\\',// '\u005c' -- ascii character
|
||||
'\u005d', // ascii character
|
||||
'\u005e', // ascii character
|
||||
'\u005f', // ascii character
|
||||
'\u0060', // ascii character
|
||||
'\u0061', // ascii character
|
||||
'\u0062', // ascii character
|
||||
'\u0063', // ascii character
|
||||
'\u0064', // ascii character
|
||||
'\u0065', // ascii character
|
||||
'\u0066', // ascii character
|
||||
'\u0067', // ascii character
|
||||
'\u0068', // ascii character
|
||||
'\u0069', // ascii character
|
||||
'\u006a', // ascii character
|
||||
'\u006b', // ascii character
|
||||
'\u006c', // ascii character
|
||||
'\u006d', // ascii character
|
||||
'\u006e', // ascii character
|
||||
'\u006f', // ascii character
|
||||
'\u0070', // ascii character
|
||||
'\u0071', // ascii character
|
||||
'\u0072', // ascii character
|
||||
'\u0073', // ascii character
|
||||
'\u0074', // ascii character
|
||||
'\u0075', // ascii character
|
||||
'\u0076', // ascii character
|
||||
'\u0077', // ascii character
|
||||
'\u0078', // ascii character
|
||||
'\u0079', // ascii character
|
||||
'\u007a', // ascii character
|
||||
'\u007b', // ascii character
|
||||
'\u007c', // ascii character
|
||||
'\u007d', // ascii character
|
||||
'\u007e', // ascii character
|
||||
'\u007f', // ascii character
|
||||
'\uffff', // unknown character
|
||||
'\uffff', // unknown character
|
||||
'\uffff', // unknown character
|
||||
'\uffff', // unknown character
|
||||
'\uffff', // unknown character
|
||||
'\uffff', // unknown character
|
||||
'\uffff', // unknown character
|
||||
'\uffff', // unknown character
|
||||
'\uffff', // unknown character
|
||||
'\uffff', // unknown character
|
||||
'\uffff', // unknown character
|
||||
'\uffff', // unknown character
|
||||
'\uffff', // unknown character
|
||||
'\uffff', // unknown character
|
||||
'\uffff', // unknown character
|
||||
'\uffff', // unknown character
|
||||
'\uffff', // unknown character
|
||||
'\uffff', // unknown character
|
||||
'\uffff', // unknown character
|
||||
'\uffff', // unknown character
|
||||
'\uffff', // unknown character
|
||||
'\uffff', // unknown character
|
||||
'\uffff', // unknown character
|
||||
'\uffff', // unknown character
|
||||
'\uffff', // unknown character
|
||||
'\uffff', // unknown character
|
||||
'\uffff', // unknown character
|
||||
'\uffff', // unknown character
|
||||
'\uffff', // unknown character
|
||||
'\uffff', // unknown character
|
||||
'\uffff', // unknown character
|
||||
'\uffff', // unknown character
|
||||
'\u0901', // a1 -- Vowel-modifier CHANDRABINDU
|
||||
'\u0902', // a2 -- Vowel-modifier ANUSWAR
|
||||
'\u0903', // a3 -- Vowel-modifier VISARG
|
||||
|
||||
'\u0905', // a4 -- Vowel A
|
||||
'\u0906', // a5 -- Vowel AA
|
||||
'\u0907', // a6 -- Vowel I
|
||||
'\u0908', // a7 -- Vowel II
|
||||
'\u0909', // a8 -- Vowel U
|
||||
'\u090a', // a9 -- Vowel UU
|
||||
'\u090b', // aa -- Vowel RI
|
||||
'\u090e', // ab -- Vowel E ( Southern Scripts )
|
||||
'\u090f', // ac -- Vowel EY
|
||||
'\u0910', // ad -- Vowel AI
|
||||
'\u090d', // ae -- Vowel AYE ( Devanagari Script )
|
||||
'\u0912', // af -- Vowel O ( Southern Scripts )
|
||||
'\u0913', // b0 -- Vowel OW
|
||||
'\u0914', // b1 -- Vowel AU
|
||||
'\u0911', // b2 -- Vowel AWE ( Devanagari Script )
|
||||
'\u0915', // b3 -- Consonant KA
|
||||
'\u0916', // b4 -- Consonant KHA
|
||||
'\u0917', // b5 -- Consonant GA
|
||||
'\u0918', // b6 -- Consonant GHA
|
||||
'\u0919', // b7 -- Consonant NGA
|
||||
'\u091a', // b8 -- Consonant CHA
|
||||
'\u091b', // b9 -- Consonant CHHA
|
||||
'\u091c', // ba -- Consonant JA
|
||||
'\u091d', // bb -- Consonant JHA
|
||||
'\u091e', // bc -- Consonant JNA
|
||||
'\u091f', // bd -- Consonant Hard TA
|
||||
'\u0920', // be -- Consonant Hard THA
|
||||
'\u0921', // bf -- Consonant Hard DA
|
||||
'\u0922', // c0 -- Consonant Hard DHA
|
||||
'\u0923', // c1 -- Consonant Hard NA
|
||||
'\u0924', // c2 -- Consonant Soft TA
|
||||
'\u0925', // c3 -- Consonant Soft THA
|
||||
'\u0926', // c4 -- Consonant Soft DA
|
||||
'\u0927', // c5 -- Consonant Soft DHA
|
||||
'\u0928', // c6 -- Consonant Soft NA
|
||||
'\u0929', // c7 -- Consonant NA ( Tamil )
|
||||
'\u092a', // c8 -- Consonant PA
|
||||
'\u092b', // c9 -- Consonant PHA
|
||||
'\u092c', // ca -- Consonant BA
|
||||
'\u092d', // cb -- Consonant BHA
|
||||
'\u092e', // cc -- Consonant MA
|
||||
'\u092f', // cd -- Consonant YA
|
||||
'\u095f', // ce -- Consonant JYA ( Bengali, Assamese & Oriya )
|
||||
'\u0930', // cf -- Consonant RA
|
||||
'\u0931', // d0 -- Consonant Hard RA ( Southern Scripts )
|
||||
'\u0932', // d1 -- Consonant LA
|
||||
'\u0933', // d2 -- Consonant Hard LA
|
||||
'\u0934', // d3 -- Consonant ZHA ( Tamil & Malayalam )
|
||||
'\u0935', // d4 -- Consonant VA
|
||||
'\u0936', // d5 -- Consonant SHA
|
||||
'\u0937', // d6 -- Consonant Hard SHA
|
||||
'\u0938', // d7 -- Consonant SA
|
||||
'\u0939', // d8 -- Consonant HA
|
||||
|
||||
'\u200d', // d9 -- Consonant INVISIBLE
|
||||
'\u093e', // da -- Vowel Sign AA
|
||||
|
||||
'\u093f', // db -- Vowel Sign I
|
||||
'\u0940', // dc -- Vowel Sign II
|
||||
'\u0941', // dd -- Vowel Sign U
|
||||
'\u0942', // de -- Vowel Sign UU
|
||||
'\u0943', // df -- Vowel Sign RI
|
||||
'\u0946', // e0 -- Vowel Sign E ( Southern Scripts )
|
||||
'\u0947', // e1 -- Vowel Sign EY
|
||||
'\u0948', // e2 -- Vowel Sign AI
|
||||
'\u0945', // e3 -- Vowel Sign AYE ( Devanagari Script )
|
||||
'\u094a', // e4 -- Vowel Sign O ( Southern Scripts )
|
||||
'\u094b', // e5 -- Vowel Sign OW
|
||||
'\u094c', // e6 -- Vowel Sign AU
|
||||
'\u0949', // e7 -- Vowel Sign AWE ( Devanagari Script )
|
||||
|
||||
'\u094d', // e8 -- Vowel Omission Sign ( Halant )
|
||||
'\u093c', // e9 -- Diacritic Sign ( Nukta )
|
||||
'\u0964', // ea -- Full Stop ( Viram, Northern Scripts )
|
||||
|
||||
'\uffff', // eb -- This position shall not be used
|
||||
'\uffff', // ec -- This position shall not be used
|
||||
'\uffff', // ed -- This position shall not be used
|
||||
'\uffff', // ee -- This position shall not be used
|
||||
|
||||
'\ufffd', // ef -- Attribute Code ( ATR )
|
||||
'\ufffd', // f0 -- Extension Code ( EXT )
|
||||
|
||||
'\u0966', // f1 -- Digit 0
|
||||
'\u0967', // f2 -- Digit 1
|
||||
'\u0968', // f3 -- Digit 2
|
||||
'\u0969', // f4 -- Digit 3
|
||||
'\u096a', // f5 -- Digit 4
|
||||
'\u096b', // f6 -- Digit 5
|
||||
'\u096c', // f7 -- Digit 6
|
||||
'\u096d', // f8 -- Digit 7
|
||||
'\u096e', // f9 -- Digit 8
|
||||
'\u096f', // fa -- Digit 9
|
||||
|
||||
'\uffff', // fb -- This position shall not be used
|
||||
'\uffff', // fc -- This position shall not be used
|
||||
'\uffff', // fd -- This position shall not be used
|
||||
'\uffff', // fe -- This position shall not be used
|
||||
'\uffff' // ff -- This position shall not be used
|
||||
}; //end of table definition
|
||||
|
||||
private static final byte[] encoderMappingTable = {
|
||||
NO_CHAR,NO_CHAR, //0900 <reserved>
|
||||
(byte)161,NO_CHAR, //0901 -- DEVANAGARI SIGN CANDRABINDU = anunasika
|
||||
(byte)162,NO_CHAR, //0902 -- DEVANAGARI SIGN ANUSVARA = bindu
|
||||
(byte)163,NO_CHAR, //0903 -- DEVANAGARI SIGN VISARGA
|
||||
NO_CHAR,NO_CHAR, //0904 <reserved>
|
||||
(byte)164,NO_CHAR, //0905 -- DEVANAGARI LETTER A
|
||||
(byte)165,NO_CHAR, //0906 -- DEVANAGARI LETTER AA
|
||||
(byte)166,NO_CHAR, //0907 -- DEVANAGARI LETTER I
|
||||
(byte)167,NO_CHAR, //0908 -- DEVANAGARI LETTER II
|
||||
(byte)168,NO_CHAR, //0909 -- DEVANAGARI LETTER U
|
||||
(byte)169,NO_CHAR, //090a -- DEVANAGARI LETTER UU
|
||||
(byte)170,NO_CHAR, //090b -- DEVANAGARI LETTER VOCALIC R
|
||||
(byte)166,(byte)233, //090c -- DEVANAGARI LETTER VOVALIC L
|
||||
(byte)174,NO_CHAR, //090d -- DEVANAGARI LETTER CANDRA E
|
||||
(byte)171,NO_CHAR, //090e -- DEVANAGARI LETTER SHORT E
|
||||
(byte)172,NO_CHAR, //090f -- DEVANAGARI LETTER E
|
||||
(byte)173,NO_CHAR, //0910 -- DEVANAGARI LETTER AI
|
||||
(byte)178,NO_CHAR, //0911 -- DEVANAGARI LETTER CANDRA O
|
||||
(byte)175,NO_CHAR, //0912 -- DEVANAGARI LETTER SHORT O
|
||||
(byte)176,NO_CHAR, //0913 -- DEVANAGARI LETTER O
|
||||
(byte)177,NO_CHAR, //0914 -- DEVANAGARI LETTER AU
|
||||
(byte)179,NO_CHAR, //0915 -- DEVANAGARI LETTER KA
|
||||
(byte)180,NO_CHAR, //0916 -- DEVANAGARI LETTER KHA
|
||||
(byte)181,NO_CHAR, //0917 -- DEVANAGARI LETTER GA
|
||||
(byte)182,NO_CHAR, //0918 -- DEVANAGARI LETTER GHA
|
||||
(byte)183,NO_CHAR, //0919 -- DEVANAGARI LETTER NGA
|
||||
(byte)184,NO_CHAR, //091a -- DEVANAGARI LETTER CA
|
||||
(byte)185,NO_CHAR, //091b -- DEVANAGARI LETTER CHA
|
||||
(byte)186,NO_CHAR, //091c -- DEVANAGARI LETTER JA
|
||||
(byte)187,NO_CHAR, //091d -- DEVANAGARI LETTER JHA
|
||||
(byte)188,NO_CHAR, //091e -- DEVANAGARI LETTER NYA
|
||||
(byte)189,NO_CHAR, //091f -- DEVANAGARI LETTER TTA
|
||||
(byte)190,NO_CHAR, //0920 -- DEVANAGARI LETTER TTHA
|
||||
(byte)191,NO_CHAR, //0921 -- DEVANAGARI LETTER DDA
|
||||
(byte)192,NO_CHAR, //0922 -- DEVANAGARI LETTER DDHA
|
||||
(byte)193,NO_CHAR, //0923 -- DEVANAGARI LETTER NNA
|
||||
(byte)194,NO_CHAR, //0924 -- DEVANAGARI LETTER TA
|
||||
(byte)195,NO_CHAR, //0925 -- DEVANAGARI LETTER THA
|
||||
(byte)196,NO_CHAR, //0926 -- DEVANAGARI LETTER DA
|
||||
(byte)197,NO_CHAR, //0927 -- DEVANAGARI LETTER DHA
|
||||
(byte)198,NO_CHAR, //0928 -- DEVANAGARI LETTER NA
|
||||
(byte)199,NO_CHAR, //0929 -- DEVANAGARI LETTER NNNA <=> 0928 + 093C
|
||||
(byte)200,NO_CHAR, //092a -- DEVANAGARI LETTER PA
|
||||
(byte)201,NO_CHAR, //092b -- DEVANAGARI LETTER PHA
|
||||
(byte)202,NO_CHAR, //092c -- DEVANAGARI LETTER BA
|
||||
(byte)203,NO_CHAR, //092d -- DEVANAGARI LETTER BHA
|
||||
(byte)204,NO_CHAR, //092e -- DEVANAGARI LETTER MA
|
||||
(byte)205,NO_CHAR, //092f -- DEVANAGARI LETTER YA
|
||||
(byte)207,NO_CHAR, //0930 -- DEVANAGARI LETTER RA
|
||||
(byte)208,NO_CHAR, //0931 -- DEVANAGARI LETTER RRA <=> 0930 + 093C
|
||||
(byte)209,NO_CHAR, //0932 -- DEVANAGARI LETTER LA
|
||||
(byte)210,NO_CHAR, //0933 -- DEVANAGARI LETTER LLA
|
||||
(byte)211,NO_CHAR, //0934 -- DEVANAGARI LETTER LLLA <=> 0933 + 093C
|
||||
(byte)212,NO_CHAR, //0935 -- DEVANAGARI LETTER VA
|
||||
(byte)213,NO_CHAR, //0936 -- DEVANAGARI LETTER SHA
|
||||
(byte)214,NO_CHAR, //0937 -- DEVANAGARI LETTER SSA
|
||||
(byte)215,NO_CHAR, //0938 -- DEVANAGARI LETTER SA
|
||||
(byte)216,NO_CHAR, //0939 -- DEVANAGARI LETTER HA
|
||||
NO_CHAR,NO_CHAR, //093a <reserved>
|
||||
NO_CHAR,NO_CHAR, //093b <reserved>
|
||||
(byte)233,NO_CHAR, //093c -- DEVANAGARI SIGN NUKTA
|
||||
(byte)234,(byte)233, //093d -- DEVANAGARI SIGN AVAGRAHA
|
||||
(byte)218,NO_CHAR, //093e -- DEVANAGARI VOWEL SIGN AA
|
||||
(byte)219,NO_CHAR, //093f -- DEVANAGARI VOWEL SIGN I
|
||||
(byte)220,NO_CHAR, //0940 -- DEVANAGARI VOWEL SIGN II
|
||||
(byte)221,NO_CHAR, //0941 -- DEVANAGARI VOWEL SIGN U
|
||||
(byte)222,NO_CHAR, //0942 -- DEVANAGARI VOWEL SIGN UU
|
||||
(byte)223,NO_CHAR, //0943 -- DEVANAGARI VOWEL SIGN VOCALIC R
|
||||
(byte)223,(byte)233, //0944 -- DEVANAGARI VOWEL SIGN VOCALIC RR
|
||||
(byte)227,NO_CHAR, //0945 -- DEVANAGARI VOWEL SIGN CANDRA E
|
||||
(byte)224,NO_CHAR, //0946 -- DEVANAGARI VOWEL SIGN SHORT E
|
||||
(byte)225,NO_CHAR, //0947 -- DEVANAGARI VOWEL SIGN E
|
||||
(byte)226,NO_CHAR, //0948 -- DEVANAGARI VOWEL SIGN AI
|
||||
(byte)231,NO_CHAR, //0949 -- DEVANAGARI VOWEL SIGN CANDRA O
|
||||
(byte)228,NO_CHAR, //094a -- DEVANAGARI VOWEL SIGN SHORT O
|
||||
(byte)229,NO_CHAR, //094b -- DEVANAGARI VOWEL SIGN O
|
||||
(byte)230,NO_CHAR, //094c -- DEVANAGARI VOWEL SIGN AU
|
||||
(byte)232,NO_CHAR, //094d -- DEVANAGARI SIGN VIRAMA ( halant )
|
||||
NO_CHAR,NO_CHAR, //094e <reserved>
|
||||
NO_CHAR,NO_CHAR, //094f <reserved>
|
||||
(byte)161,(byte)233, //0950 -- DEVANAGARI OM
|
||||
(byte)240,(byte)181, //0951 -- DEVANAGARI STRESS SIGN UDATTA
|
||||
(byte)240,(byte)184, //0952 -- DEVANAGARI STRESS SIGN ANUDATTA
|
||||
(byte)254,NO_CHAR, //0953 -- DEVANAGARI GRAVE ACCENT || MISSING
|
||||
(byte)254,NO_CHAR, //0954 -- DEVANAGARI ACUTE ACCENT || MISSING
|
||||
NO_CHAR,NO_CHAR, //0955 <reserved>
|
||||
NO_CHAR,NO_CHAR, //0956 <reserved>
|
||||
NO_CHAR,NO_CHAR, //0957 <reserved>
|
||||
(byte)179,(byte)233, //0958 -- DEVANAGARI LETTER QA <=> 0915 + 093C
|
||||
(byte)180,(byte)233, //0959 -- DEVANAGARI LETTER KHHA <=> 0916 + 093C
|
||||
(byte)181,(byte)233, //095a -- DEVANAGARI LETTER GHHA <=> 0917 + 093C
|
||||
(byte)186,(byte)233, //095b -- DEVANAGARI LETTER ZA <=> 091C + 093C
|
||||
(byte)191,(byte)233, //095c -- DEVANAGARI LETTER DDDHA <=> 0921 + 093C
|
||||
(byte)192,(byte)233, //095d -- DEVANAGARI LETTER RHA <=> 0922 + 093C
|
||||
(byte)201,(byte)233, //095e -- DEVANAGARI LETTER FA <=> 092B + 093C
|
||||
(byte)206,NO_CHAR, //095f -- DEVANAGARI LETTER YYA <=> 092F + 093C
|
||||
(byte)170,(byte)233, //0960 -- DEVANAGARI LETTER VOCALIC RR
|
||||
(byte)167,(byte)233, //0961 -- DEVANAGARI LETTER VOCALIC LL
|
||||
(byte)219,(byte)233, //0962 -- DEVANAGARI VOWEL SIGN VOCALIC L
|
||||
(byte)220,(byte)233, //0963 -- DEVANAGARI VOWEL SIGN VOCALIC LL
|
||||
(byte)234,NO_CHAR, //0964 -- DEVANAGARI DANDA ( phrase separator )
|
||||
(byte)234,(byte)234, //0965 -- DEVANAGARI DOUBLE DANDA
|
||||
(byte)241,NO_CHAR, //0966 -- DEVANAGARI DIGIT ZERO
|
||||
(byte)242,NO_CHAR, //0967 -- DEVANAGARI DIGIT ONE
|
||||
(byte)243,NO_CHAR, //0968 -- DEVANAGARI DIGIT TWO
|
||||
(byte)244,NO_CHAR, //0969 -- DEVANAGARI DIGIT THREE
|
||||
(byte)245,NO_CHAR, //096a -- DEVANAGARI DIGIT FOUR
|
||||
(byte)246,NO_CHAR, //096b -- DEVANAGARI DIGIT FIVE
|
||||
(byte)247,NO_CHAR, //096c -- DEVANAGARI DIGIT SIX
|
||||
(byte)248,NO_CHAR, //096d -- DEVANAGARI DIGIT SEVEN
|
||||
(byte)249,NO_CHAR, //096e -- DEVANAGARI DIGIT EIGHT
|
||||
(byte)250,NO_CHAR, //096f -- DEVANAGARI DIGIT NINE
|
||||
(byte)240,(byte)191, //0970 -- DEVANAGARI ABBREVIATION SIGN
|
||||
NO_CHAR,NO_CHAR, //0971 -- reserved
|
||||
NO_CHAR,NO_CHAR, //0972 -- reserved
|
||||
NO_CHAR,NO_CHAR, //0973 -- reserved
|
||||
NO_CHAR,NO_CHAR, //0974 -- reserved
|
||||
NO_CHAR,NO_CHAR, //0975 -- reserved
|
||||
NO_CHAR,NO_CHAR, //0976 -- reserved
|
||||
NO_CHAR,NO_CHAR, //0977 -- reserved
|
||||
NO_CHAR,NO_CHAR, //0978 -- reserved
|
||||
NO_CHAR,NO_CHAR, //0979 -- reserved
|
||||
NO_CHAR,NO_CHAR, //097a -- reserved
|
||||
NO_CHAR,NO_CHAR, //097b -- reserved
|
||||
NO_CHAR,NO_CHAR, //097c -- reserved
|
||||
NO_CHAR,NO_CHAR, //097d -- reserved
|
||||
NO_CHAR,NO_CHAR, //097e -- reserved
|
||||
NO_CHAR,NO_CHAR //097f -- reserved
|
||||
}; //end of table definition
|
||||
|
||||
private static class Decoder extends CharsetDecoder {
|
||||
|
||||
private static final char ZWNJ_CHAR = '\u200c';
|
||||
private static final char ZWJ_CHAR = '\u200d';
|
||||
private static final char INVALID_CHAR = '\uffff';
|
||||
|
||||
private char contextChar = INVALID_CHAR;
|
||||
private boolean needFlushing = false;
|
||||
|
||||
|
||||
private Decoder(Charset cs) {
|
||||
super(cs, 1.0f, 1.0f);
|
||||
}
|
||||
|
||||
protected CoderResult implFlush(CharBuffer out) {
|
||||
if(needFlushing) {
|
||||
if (out.remaining() < 1) {
|
||||
return CoderResult.OVERFLOW;
|
||||
} else {
|
||||
out.put(contextChar);
|
||||
}
|
||||
}
|
||||
contextChar = INVALID_CHAR;
|
||||
needFlushing = false;
|
||||
return CoderResult.UNDERFLOW;
|
||||
}
|
||||
|
||||
/*Rules:
|
||||
* 1)ATR,EXT,following character to be replaced with '\ufffd'
|
||||
* 2)Halant + Halant => '\u094d' (Virama) + '\u200c'(ZWNJ)
|
||||
* 3)Halant + Nukta => '\u094d' (Virama) + '\u200d'(ZWJ)
|
||||
*/
|
||||
private CoderResult decodeArrayLoop(ByteBuffer src,
|
||||
CharBuffer dst)
|
||||
{
|
||||
byte[] sa = src.array();
|
||||
int sp = src.arrayOffset() + src.position();
|
||||
int sl = src.arrayOffset() + src.limit();
|
||||
assert (sp <= sl);
|
||||
sp = (sp <= sl ? sp : sl);
|
||||
|
||||
char[] da = dst.array();
|
||||
int dp = dst.arrayOffset() + dst.position();
|
||||
int dl = dst.arrayOffset() + dst.limit();
|
||||
assert (dp <= dl);
|
||||
dp = (dp <= dl ? dp : dl);
|
||||
|
||||
try {
|
||||
while (sp < sl) {
|
||||
int index = sa[sp];
|
||||
index = ( index < 0 )? ( index + 255 ):index;
|
||||
char currentChar = directMapTable[index];
|
||||
|
||||
// if the contextChar is either ATR || EXT
|
||||
// set the output to '\ufffd'
|
||||
if(contextChar == '\ufffd') {
|
||||
if (dl - dp < 1)
|
||||
return CoderResult.OVERFLOW;
|
||||
da[dp++] = '\ufffd';
|
||||
contextChar = INVALID_CHAR;
|
||||
needFlushing = false;
|
||||
sp++;
|
||||
continue;
|
||||
}
|
||||
|
||||
switch(currentChar) {
|
||||
case '\u0901':
|
||||
case '\u0907':
|
||||
case '\u0908':
|
||||
case '\u090b':
|
||||
case '\u093f':
|
||||
case '\u0940':
|
||||
case '\u0943':
|
||||
case '\u0964':
|
||||
if(needFlushing) {
|
||||
if (dl - dp < 1)
|
||||
return CoderResult.OVERFLOW;
|
||||
da[dp++] = contextChar;
|
||||
contextChar = currentChar;
|
||||
sp++;
|
||||
continue;
|
||||
}
|
||||
contextChar = currentChar;
|
||||
needFlushing = true;
|
||||
sp++;
|
||||
continue;
|
||||
case NUKTA_CHAR:
|
||||
if (dl - dp < 1)
|
||||
return CoderResult.OVERFLOW;
|
||||
switch(contextChar) {
|
||||
case '\u0901':
|
||||
da[dp++] = '\u0950';
|
||||
break;
|
||||
case '\u0907':
|
||||
da[dp++] = '\u090c';
|
||||
break;
|
||||
case '\u0908':
|
||||
da[dp++] = '\u0961';
|
||||
break;
|
||||
case '\u090b':
|
||||
da[dp++] = '\u0960';
|
||||
break;
|
||||
case '\u093f':
|
||||
da[dp++] = '\u0962';
|
||||
break;
|
||||
case '\u0940':
|
||||
da[dp++] = '\u0963';
|
||||
break;
|
||||
case '\u0943':
|
||||
da[dp++] = '\u0944';
|
||||
break;
|
||||
case '\u0964':
|
||||
da[dp++] = '\u093d';
|
||||
break;
|
||||
case HALANT_CHAR:
|
||||
if(needFlushing) {
|
||||
da[dp++] = contextChar;
|
||||
contextChar = currentChar;
|
||||
sp++;
|
||||
continue;
|
||||
}
|
||||
da[dp++] = ZWJ_CHAR;
|
||||
break;
|
||||
default:
|
||||
if(needFlushing) {
|
||||
da[dp++] = contextChar;
|
||||
contextChar = currentChar;
|
||||
sp++;
|
||||
continue;
|
||||
}
|
||||
da[dp++] = NUKTA_CHAR;
|
||||
}
|
||||
break;
|
||||
case HALANT_CHAR:
|
||||
if (dl - dp < 1)
|
||||
return CoderResult.OVERFLOW;
|
||||
if(needFlushing) {
|
||||
da[dp++] = contextChar;
|
||||
contextChar = currentChar;
|
||||
sp++;
|
||||
continue;
|
||||
}
|
||||
if(contextChar == HALANT_CHAR) {
|
||||
da[dp++] = ZWNJ_CHAR;
|
||||
break;
|
||||
}
|
||||
da[dp++] = HALANT_CHAR;
|
||||
break;
|
||||
case INVALID_CHAR:
|
||||
if(needFlushing) {
|
||||
if (dl - dp < 1)
|
||||
return CoderResult.OVERFLOW;
|
||||
da[dp++] = contextChar;
|
||||
contextChar = currentChar;
|
||||
sp++;
|
||||
continue;
|
||||
}
|
||||
return CoderResult.unmappableForLength(1);
|
||||
default:
|
||||
if (dl - dp < 1)
|
||||
return CoderResult.OVERFLOW;
|
||||
if(needFlushing) {
|
||||
da[dp++] = contextChar;
|
||||
contextChar = currentChar;
|
||||
sp++;
|
||||
continue;
|
||||
}
|
||||
da[dp++] = currentChar;
|
||||
break;
|
||||
}//end switch
|
||||
|
||||
contextChar = currentChar;
|
||||
needFlushing = false;
|
||||
sp++;
|
||||
}
|
||||
return CoderResult.UNDERFLOW;
|
||||
} finally {
|
||||
src.position(sp - src.arrayOffset());
|
||||
dst.position(dp - dst.arrayOffset());
|
||||
}
|
||||
}
|
||||
|
||||
private CoderResult decodeBufferLoop(ByteBuffer src,
|
||||
CharBuffer dst)
|
||||
{
|
||||
int mark = src.position();
|
||||
|
||||
try {
|
||||
while (src.hasRemaining()) {
|
||||
int index = src.get();
|
||||
index = ( index < 0 )? ( index + 255 ):index;
|
||||
char currentChar = directMapTable[index];
|
||||
|
||||
// if the contextChar is either ATR || EXT
|
||||
// set the output to '\ufffd'
|
||||
if(contextChar == '\ufffd') {
|
||||
if (dst.remaining() < 1)
|
||||
return CoderResult.OVERFLOW;
|
||||
dst.put('\ufffd');
|
||||
contextChar = INVALID_CHAR;
|
||||
needFlushing = false;
|
||||
mark++;
|
||||
continue;
|
||||
}
|
||||
|
||||
switch(currentChar) {
|
||||
case '\u0901':
|
||||
case '\u0907':
|
||||
case '\u0908':
|
||||
case '\u090b':
|
||||
case '\u093f':
|
||||
case '\u0940':
|
||||
case '\u0943':
|
||||
case '\u0964':
|
||||
if(needFlushing) {
|
||||
if (dst.remaining() < 1)
|
||||
return CoderResult.OVERFLOW;
|
||||
dst.put(contextChar);
|
||||
contextChar = currentChar;
|
||||
mark++;
|
||||
continue;
|
||||
}
|
||||
contextChar = currentChar;
|
||||
needFlushing = true;
|
||||
mark++;
|
||||
continue;
|
||||
case NUKTA_CHAR:
|
||||
if (dst.remaining() < 1)
|
||||
return CoderResult.OVERFLOW;
|
||||
switch(contextChar) {
|
||||
case '\u0901':
|
||||
dst.put('\u0950');
|
||||
break;
|
||||
case '\u0907':
|
||||
dst.put('\u090c');
|
||||
break;
|
||||
case '\u0908':
|
||||
dst.put('\u0961');
|
||||
break;
|
||||
case '\u090b':
|
||||
dst.put('\u0960');
|
||||
break;
|
||||
case '\u093f':
|
||||
dst.put('\u0962');
|
||||
break;
|
||||
case '\u0940':
|
||||
dst.put('\u0963');
|
||||
break;
|
||||
case '\u0943':
|
||||
dst.put('\u0944');
|
||||
break;
|
||||
case '\u0964':
|
||||
dst.put('\u093d');
|
||||
break;
|
||||
case HALANT_CHAR:
|
||||
if(needFlushing) {
|
||||
dst.put(contextChar);
|
||||
contextChar = currentChar;
|
||||
mark++;
|
||||
continue;
|
||||
}
|
||||
dst.put(ZWJ_CHAR);
|
||||
break;
|
||||
default:
|
||||
if(needFlushing) {
|
||||
dst.put(contextChar);
|
||||
contextChar = currentChar;
|
||||
mark++;
|
||||
continue;
|
||||
}
|
||||
dst.put(NUKTA_CHAR);
|
||||
}
|
||||
break;
|
||||
case HALANT_CHAR:
|
||||
if (dst.remaining() < 1)
|
||||
return CoderResult.OVERFLOW;
|
||||
if(needFlushing) {
|
||||
dst.put(contextChar);
|
||||
contextChar = currentChar;
|
||||
mark++;
|
||||
continue;
|
||||
}
|
||||
if(contextChar == HALANT_CHAR) {
|
||||
dst.put(ZWNJ_CHAR);
|
||||
break;
|
||||
}
|
||||
dst.put(HALANT_CHAR);
|
||||
break;
|
||||
case INVALID_CHAR:
|
||||
if(needFlushing) {
|
||||
if (dst.remaining() < 1)
|
||||
return CoderResult.OVERFLOW;
|
||||
dst.put(contextChar);
|
||||
contextChar = currentChar;
|
||||
mark++;
|
||||
continue;
|
||||
}
|
||||
return CoderResult.unmappableForLength(1);
|
||||
default:
|
||||
if (dst.remaining() < 1)
|
||||
return CoderResult.OVERFLOW;
|
||||
if(needFlushing) {
|
||||
dst.put(contextChar);
|
||||
contextChar = currentChar;
|
||||
mark++;
|
||||
continue;
|
||||
}
|
||||
dst.put(currentChar);
|
||||
break;
|
||||
}//end switch
|
||||
contextChar = currentChar;
|
||||
needFlushing = false;
|
||||
mark++;
|
||||
}
|
||||
return CoderResult.UNDERFLOW;
|
||||
} finally {
|
||||
src.position(mark);
|
||||
}
|
||||
}
|
||||
|
||||
protected CoderResult decodeLoop(ByteBuffer src,
|
||||
CharBuffer dst)
|
||||
{
|
||||
if (src.hasArray() && dst.hasArray())
|
||||
return decodeArrayLoop(src, dst);
|
||||
else
|
||||
return decodeBufferLoop(src, dst);
|
||||
}
|
||||
}
|
||||
|
||||
private static class Encoder extends CharsetEncoder {
|
||||
|
||||
private static final byte NO_CHAR = (byte)255;
|
||||
|
||||
//private static CharToByteISCII91 c2b = new CharToByteISCII91();
|
||||
//private static final byte[] directMapTable = c2b.getISCIIEncoderMap();
|
||||
|
||||
private final Surrogate.Parser sgp = new Surrogate.Parser();
|
||||
|
||||
private Encoder(Charset cs) {
|
||||
super(cs, 2.0f, 2.0f);
|
||||
}
|
||||
|
||||
public boolean canEncode(char ch) {
|
||||
//check for Devanagari range,ZWJ,ZWNJ and ASCII range.
|
||||
return ((ch >= '\u0900' && ch <= '\u097f' &&
|
||||
encoderMappingTable[2*(ch-'\u0900')] != NO_CHAR) ||
|
||||
(ch == '\u200d') ||
|
||||
(ch == '\u200c') ||
|
||||
(ch <= '\u007f'));
|
||||
}
|
||||
|
||||
|
||||
private CoderResult encodeArrayLoop(CharBuffer src,
|
||||
ByteBuffer dst)
|
||||
{
|
||||
char[] sa = src.array();
|
||||
int sp = src.arrayOffset() + src.position();
|
||||
int sl = src.arrayOffset() + src.limit();
|
||||
assert (sp <= sl);
|
||||
sp = (sp <= sl ? sp : sl);
|
||||
byte[] da = dst.array();
|
||||
int dp = dst.arrayOffset() + dst.position();
|
||||
int dl = dst.arrayOffset() + dst.limit();
|
||||
assert (dp <= dl);
|
||||
dp = (dp <= dl ? dp : dl);
|
||||
|
||||
int outputSize = 0;
|
||||
|
||||
try {
|
||||
char inputChar;
|
||||
while (sp < sl) {
|
||||
int index = Integer.MIN_VALUE;
|
||||
inputChar = sa[sp];
|
||||
|
||||
if (inputChar >= 0x0000 && inputChar <= 0x007f) {
|
||||
if (dl - dp < 1)
|
||||
return CoderResult.OVERFLOW;
|
||||
da[dp++] = (byte) inputChar;
|
||||
sp++;
|
||||
continue;
|
||||
}
|
||||
|
||||
// if inputChar == ZWJ replace it with halant
|
||||
// if inputChar == ZWNJ replace it with Nukta
|
||||
|
||||
if (inputChar == 0x200c) {
|
||||
inputChar = HALANT_CHAR;
|
||||
}
|
||||
else if (inputChar == 0x200d) {
|
||||
inputChar = NUKTA_CHAR;
|
||||
}
|
||||
|
||||
if (inputChar >= 0x0900 && inputChar <= 0x097f) {
|
||||
index = ((int)(inputChar) - 0x0900)*2;
|
||||
}
|
||||
|
||||
if (Character.isSurrogate(inputChar)) {
|
||||
if (sgp.parse(inputChar, sa, sp, sl) < 0)
|
||||
return sgp.error();
|
||||
return sgp.unmappableResult();
|
||||
}
|
||||
|
||||
if (index == Integer.MIN_VALUE ||
|
||||
encoderMappingTable[index] == NO_CHAR) {
|
||||
return CoderResult.unmappableForLength(1);
|
||||
} else {
|
||||
if(encoderMappingTable[index + 1] == NO_CHAR) {
|
||||
if(dl - dp < 1)
|
||||
return CoderResult.OVERFLOW;
|
||||
da[dp++] = encoderMappingTable[index];
|
||||
} else {
|
||||
if(dl - dp < 2)
|
||||
return CoderResult.OVERFLOW;
|
||||
da[dp++] = encoderMappingTable[index];
|
||||
da[dp++] = encoderMappingTable[index + 1];
|
||||
}
|
||||
sp++;
|
||||
}
|
||||
}
|
||||
return CoderResult.UNDERFLOW;
|
||||
} finally {
|
||||
src.position(sp - src.arrayOffset());
|
||||
dst.position(dp - dst.arrayOffset());
|
||||
}
|
||||
}
|
||||
|
||||
private CoderResult encodeBufferLoop(CharBuffer src,
|
||||
ByteBuffer dst)
|
||||
{
|
||||
int mark = src.position();
|
||||
|
||||
try {
|
||||
char inputChar;
|
||||
while (src.hasRemaining()) {
|
||||
int index = Integer.MIN_VALUE;
|
||||
inputChar = src.get();
|
||||
|
||||
if (inputChar >= 0x0000 && inputChar <= 0x007f) {
|
||||
if (dst.remaining() < 1)
|
||||
return CoderResult.OVERFLOW;
|
||||
dst.put((byte) inputChar);
|
||||
mark++;
|
||||
continue;
|
||||
}
|
||||
|
||||
// if inputChar == ZWJ replace it with halant
|
||||
// if inputChar == ZWNJ replace it with Nukta
|
||||
|
||||
if (inputChar == 0x200c) {
|
||||
inputChar = HALANT_CHAR;
|
||||
}
|
||||
else if (inputChar == 0x200d) {
|
||||
inputChar = NUKTA_CHAR;
|
||||
}
|
||||
|
||||
if (inputChar >= 0x0900 && inputChar <= 0x097f) {
|
||||
index = ((int)(inputChar) - 0x0900)*2;
|
||||
}
|
||||
|
||||
if (Character.isSurrogate(inputChar)) {
|
||||
if (sgp.parse(inputChar, src) < 0)
|
||||
return sgp.error();
|
||||
return sgp.unmappableResult();
|
||||
}
|
||||
|
||||
if (index == Integer.MIN_VALUE ||
|
||||
encoderMappingTable[index] == NO_CHAR) {
|
||||
return CoderResult.unmappableForLength(1);
|
||||
} else {
|
||||
if(encoderMappingTable[index + 1] == NO_CHAR) {
|
||||
if(dst.remaining() < 1)
|
||||
return CoderResult.OVERFLOW;
|
||||
dst.put(encoderMappingTable[index]);
|
||||
} else {
|
||||
if(dst.remaining() < 2)
|
||||
return CoderResult.OVERFLOW;
|
||||
dst.put(encoderMappingTable[index]);
|
||||
dst.put(encoderMappingTable[index + 1]);
|
||||
}
|
||||
}
|
||||
mark++;
|
||||
}
|
||||
return CoderResult.UNDERFLOW;
|
||||
} finally {
|
||||
src.position(mark);
|
||||
}
|
||||
}
|
||||
|
||||
protected CoderResult encodeLoop(CharBuffer src,
|
||||
ByteBuffer dst)
|
||||
{
|
||||
if (src.hasArray() && dst.hasArray())
|
||||
return encodeArrayLoop(src, dst);
|
||||
else
|
||||
return encodeBufferLoop(src, dst);
|
||||
}
|
||||
}
|
||||
}
|
||||
631
jdkSrc/jdk8/sun/nio/cs/ext/ISO2022.java
Normal file
631
jdkSrc/jdk8/sun/nio/cs/ext/ISO2022.java
Normal file
@@ -0,0 +1,631 @@
|
||||
/*
|
||||
* Copyright (c) 2002, 2010, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
/*
|
||||
*/
|
||||
|
||||
package sun.nio.cs.ext;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
import java.nio.CharBuffer;
|
||||
import java.nio.charset.Charset;
|
||||
import java.nio.charset.CharsetDecoder;
|
||||
import java.nio.charset.CharsetEncoder;
|
||||
import java.nio.charset.CoderResult;
|
||||
import sun.nio.cs.Surrogate;
|
||||
|
||||
abstract class ISO2022
|
||||
extends Charset
|
||||
{
|
||||
|
||||
private static final byte ISO_ESC = 0x1b;
|
||||
private static final byte ISO_SI = 0x0f;
|
||||
private static final byte ISO_SO = 0x0e;
|
||||
private static final byte ISO_SS2_7 = 0x4e;
|
||||
private static final byte ISO_SS3_7 = 0x4f;
|
||||
private static final byte MSB = (byte)0x80;
|
||||
private static final char REPLACE_CHAR = '\uFFFD';
|
||||
private static final byte minDesignatorLength = 3;
|
||||
|
||||
public ISO2022(String csname, String[] aliases) {
|
||||
super(csname, aliases);
|
||||
}
|
||||
|
||||
public CharsetDecoder newDecoder() {
|
||||
return new Decoder(this);
|
||||
}
|
||||
|
||||
public CharsetEncoder newEncoder() {
|
||||
return new Encoder(this);
|
||||
}
|
||||
|
||||
protected static class Decoder extends CharsetDecoder {
|
||||
|
||||
// Value to be filled by subclass
|
||||
protected byte SODesig[][];
|
||||
protected byte SS2Desig[][] = null;
|
||||
protected byte SS3Desig[][] = null;
|
||||
|
||||
protected CharsetDecoder SODecoder[];
|
||||
protected CharsetDecoder SS2Decoder[] = null;
|
||||
protected CharsetDecoder SS3Decoder[] = null;
|
||||
|
||||
private static final byte SOFlag = 0;
|
||||
private static final byte SS2Flag = 1;
|
||||
private static final byte SS3Flag = 2;
|
||||
|
||||
private int curSODes, curSS2Des, curSS3Des;
|
||||
private boolean shiftout;
|
||||
private CharsetDecoder tmpDecoder[];
|
||||
|
||||
protected Decoder(Charset cs) {
|
||||
super(cs, 1.0f, 1.0f);
|
||||
}
|
||||
|
||||
protected void implReset() {
|
||||
curSODes = 0;
|
||||
curSS2Des = 0;
|
||||
curSS3Des = 0;
|
||||
shiftout = false;
|
||||
}
|
||||
|
||||
private char decode(byte byte1, byte byte2, byte shiftFlag)
|
||||
{
|
||||
byte1 |= MSB;
|
||||
byte2 |= MSB;
|
||||
|
||||
byte[] tmpByte = { byte1,byte2 };
|
||||
char[] tmpChar = new char[1];
|
||||
int i = 0,
|
||||
tmpIndex = 0;
|
||||
|
||||
switch(shiftFlag) {
|
||||
case SOFlag:
|
||||
tmpIndex = curSODes;
|
||||
tmpDecoder = SODecoder;
|
||||
break;
|
||||
case SS2Flag:
|
||||
tmpIndex = curSS2Des;
|
||||
tmpDecoder = SS2Decoder;
|
||||
break;
|
||||
case SS3Flag:
|
||||
tmpIndex = curSS3Des;
|
||||
tmpDecoder = SS3Decoder;
|
||||
break;
|
||||
}
|
||||
|
||||
if (tmpDecoder != null) {
|
||||
for(i = 0; i < tmpDecoder.length; i++) {
|
||||
if(tmpIndex == i) {
|
||||
try {
|
||||
ByteBuffer bb = ByteBuffer.wrap(tmpByte,0,2);
|
||||
CharBuffer cc = CharBuffer.wrap(tmpChar,0,1);
|
||||
tmpDecoder[i].decode(bb, cc, true);
|
||||
cc.flip();
|
||||
return cc.get();
|
||||
} catch (Exception e) {}
|
||||
}
|
||||
}
|
||||
}
|
||||
return REPLACE_CHAR;
|
||||
}
|
||||
|
||||
private int findDesig(byte[] in, int sp, int sl, byte[][] desigs) {
|
||||
if (desigs == null) return -1;
|
||||
int i = 0;
|
||||
while (i < desigs.length) {
|
||||
if (desigs[i] != null && sl - sp >= desigs[i].length) {
|
||||
int j = 0;
|
||||
while (j < desigs[i].length && in[sp+j] == desigs[i][j]) { j++; }
|
||||
if (j == desigs[i].length)
|
||||
return i;
|
||||
}
|
||||
i++;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
private int findDesigBuf(ByteBuffer in, byte[][] desigs) {
|
||||
if (desigs == null) return -1;
|
||||
int i = 0;
|
||||
while (i < desigs.length) {
|
||||
if (desigs[i] != null && in.remaining() >= desigs[i].length) {
|
||||
int j = 0;
|
||||
in.mark();
|
||||
while (j < desigs[i].length && in.get() == desigs[i][j]) { j++; }
|
||||
if (j == desigs[i].length)
|
||||
return i;
|
||||
in.reset();
|
||||
}
|
||||
i++;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
private CoderResult decodeArrayLoop(ByteBuffer src,
|
||||
CharBuffer dst)
|
||||
{
|
||||
byte[] sa = src.array();
|
||||
int sp = src.arrayOffset() + src.position();
|
||||
int sl = src.arrayOffset() + src.limit();
|
||||
assert (sp <= sl);
|
||||
sp = (sp <= sl ? sp : sl);
|
||||
|
||||
char[] da = dst.array();
|
||||
int dp = dst.arrayOffset() + dst.position();
|
||||
int dl = dst.arrayOffset() + dst.limit();
|
||||
assert (dp <= dl);
|
||||
dp = (dp <= dl ? dp : dl);
|
||||
|
||||
int b1 = 0, b2 = 0, b3 = 0;
|
||||
|
||||
try {
|
||||
while (sp < sl) {
|
||||
b1 = sa[sp] & 0xff;
|
||||
int inputSize = 1;
|
||||
switch (b1) {
|
||||
case ISO_SO:
|
||||
shiftout = true;
|
||||
inputSize = 1;
|
||||
break;
|
||||
case ISO_SI:
|
||||
shiftout = false;
|
||||
inputSize = 1;
|
||||
break;
|
||||
case ISO_ESC:
|
||||
if (sl - sp - 1 < minDesignatorLength)
|
||||
return CoderResult.UNDERFLOW;
|
||||
|
||||
int desig = findDesig(sa, sp + 1, sl, SODesig);
|
||||
if (desig != -1) {
|
||||
curSODes = desig;
|
||||
inputSize = SODesig[desig].length + 1;
|
||||
break;
|
||||
}
|
||||
desig = findDesig(sa, sp + 1, sl, SS2Desig);
|
||||
if (desig != -1) {
|
||||
curSS2Des = desig;
|
||||
inputSize = SS2Desig[desig].length + 1;
|
||||
break;
|
||||
}
|
||||
desig = findDesig(sa, sp + 1, sl, SS3Desig);
|
||||
if (desig != -1) {
|
||||
curSS3Des = desig;
|
||||
inputSize = SS3Desig[desig].length + 1;
|
||||
break;
|
||||
}
|
||||
if (sl - sp < 2)
|
||||
return CoderResult.UNDERFLOW;
|
||||
b1 = sa[sp + 1];
|
||||
switch(b1) {
|
||||
case ISO_SS2_7:
|
||||
if (sl - sp < 4)
|
||||
return CoderResult.UNDERFLOW;
|
||||
b2 = sa[sp +2];
|
||||
b3 = sa[sp +3];
|
||||
if (dl - dp <1)
|
||||
return CoderResult.OVERFLOW;
|
||||
da[dp] = decode((byte)b2,
|
||||
(byte)b3,
|
||||
SS2Flag);
|
||||
dp++;
|
||||
inputSize = 4;
|
||||
break;
|
||||
case ISO_SS3_7:
|
||||
if (sl - sp < 4)
|
||||
return CoderResult.UNDERFLOW;
|
||||
b2 = sa[sp + 2];
|
||||
b3 = sa[sp + 3];
|
||||
if (dl - dp <1)
|
||||
return CoderResult.OVERFLOW;
|
||||
da[dp] = decode((byte)b2,
|
||||
(byte)b3,
|
||||
SS3Flag);
|
||||
dp++;
|
||||
inputSize = 4;
|
||||
break;
|
||||
default:
|
||||
return CoderResult.malformedForLength(2);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
if (dl - dp < 1)
|
||||
return CoderResult.OVERFLOW;
|
||||
if (!shiftout) {
|
||||
da[dp++]=(char)(sa[sp] & 0xff);
|
||||
} else {
|
||||
if (dl - dp < 1)
|
||||
return CoderResult.OVERFLOW;
|
||||
if (sl - sp < 2)
|
||||
return CoderResult.UNDERFLOW;
|
||||
b2 = sa[sp+1] & 0xff;
|
||||
da[dp++] = decode((byte)b1,
|
||||
(byte)b2,
|
||||
SOFlag);
|
||||
inputSize = 2;
|
||||
}
|
||||
break;
|
||||
}
|
||||
sp += inputSize;
|
||||
}
|
||||
return CoderResult.UNDERFLOW;
|
||||
} finally {
|
||||
src.position(sp - src.arrayOffset());
|
||||
dst.position(dp - dst.arrayOffset());
|
||||
}
|
||||
}
|
||||
|
||||
private CoderResult decodeBufferLoop(ByteBuffer src,
|
||||
CharBuffer dst)
|
||||
{
|
||||
int mark = src.position();
|
||||
int b1 = 0, b2 = 0, b3 = 0;
|
||||
|
||||
try {
|
||||
while (src.hasRemaining()) {
|
||||
b1 = src.get();
|
||||
int inputSize = 1;
|
||||
switch (b1) {
|
||||
case ISO_SO:
|
||||
shiftout = true;
|
||||
break;
|
||||
case ISO_SI:
|
||||
shiftout = false;
|
||||
break;
|
||||
case ISO_ESC:
|
||||
if (src.remaining() < minDesignatorLength)
|
||||
return CoderResult.UNDERFLOW;
|
||||
|
||||
int desig = findDesigBuf(src, SODesig);
|
||||
if (desig != -1) {
|
||||
curSODes = desig;
|
||||
inputSize = SODesig[desig].length + 1;
|
||||
break;
|
||||
}
|
||||
desig = findDesigBuf(src, SS2Desig);
|
||||
if (desig != -1) {
|
||||
curSS2Des = desig;
|
||||
inputSize = SS2Desig[desig].length + 1;
|
||||
break;
|
||||
}
|
||||
desig = findDesigBuf(src, SS3Desig);
|
||||
if (desig != -1) {
|
||||
curSS3Des = desig;
|
||||
inputSize = SS3Desig[desig].length + 1;
|
||||
break;
|
||||
}
|
||||
|
||||
if (src.remaining() < 1)
|
||||
return CoderResult.UNDERFLOW;
|
||||
b1 = src.get();
|
||||
switch(b1) {
|
||||
case ISO_SS2_7:
|
||||
if (src.remaining() < 2)
|
||||
return CoderResult.UNDERFLOW;
|
||||
b2 = src.get();
|
||||
b3 = src.get();
|
||||
if (dst.remaining() < 1)
|
||||
return CoderResult.OVERFLOW;
|
||||
dst.put(decode((byte)b2,
|
||||
(byte)b3,
|
||||
SS2Flag));
|
||||
inputSize = 4;
|
||||
break;
|
||||
case ISO_SS3_7:
|
||||
if (src.remaining() < 2)
|
||||
return CoderResult.UNDERFLOW;
|
||||
b2 = src.get();
|
||||
b3 = src.get();
|
||||
if (dst.remaining() < 1)
|
||||
return CoderResult.OVERFLOW;
|
||||
dst.put(decode((byte)b2,
|
||||
(byte)b3,
|
||||
SS3Flag));
|
||||
inputSize = 4;
|
||||
break;
|
||||
default:
|
||||
return CoderResult.malformedForLength(2);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
if (dst.remaining() < 1)
|
||||
return CoderResult.OVERFLOW;
|
||||
if (!shiftout) {
|
||||
dst.put((char)(b1 & 0xff));
|
||||
} else {
|
||||
if (dst.remaining() < 1)
|
||||
return CoderResult.OVERFLOW;
|
||||
if (src.remaining() < 1)
|
||||
return CoderResult.UNDERFLOW;
|
||||
b2 = src.get() & 0xff;
|
||||
dst.put(decode((byte)b1,
|
||||
(byte)b2,
|
||||
SOFlag));
|
||||
inputSize = 2;
|
||||
}
|
||||
break;
|
||||
}
|
||||
mark += inputSize;
|
||||
}
|
||||
return CoderResult.UNDERFLOW;
|
||||
} catch (Exception e) { e.printStackTrace(); return CoderResult.OVERFLOW; }
|
||||
finally {
|
||||
src.position(mark);
|
||||
}
|
||||
}
|
||||
|
||||
protected CoderResult decodeLoop(ByteBuffer src,
|
||||
CharBuffer dst)
|
||||
{
|
||||
if (src.hasArray() && dst.hasArray())
|
||||
return decodeArrayLoop(src, dst);
|
||||
else
|
||||
return decodeBufferLoop(src, dst);
|
||||
}
|
||||
}
|
||||
|
||||
protected static class Encoder extends CharsetEncoder {
|
||||
private final Surrogate.Parser sgp = new Surrogate.Parser();
|
||||
public static final byte SS2 = (byte)0x8e;
|
||||
public static final byte PLANE2 = (byte)0xA2;
|
||||
public static final byte PLANE3 = (byte)0xA3;
|
||||
private final byte MSB = (byte)0x80;
|
||||
|
||||
protected final byte maximumDesignatorLength = 4;
|
||||
|
||||
protected String SODesig,
|
||||
SS2Desig = null,
|
||||
SS3Desig = null;
|
||||
|
||||
protected CharsetEncoder ISOEncoder;
|
||||
|
||||
private boolean shiftout = false;
|
||||
private boolean SODesDefined = false;
|
||||
private boolean SS2DesDefined = false;
|
||||
private boolean SS3DesDefined = false;
|
||||
|
||||
private boolean newshiftout = false;
|
||||
private boolean newSODesDefined = false;
|
||||
private boolean newSS2DesDefined = false;
|
||||
private boolean newSS3DesDefined = false;
|
||||
|
||||
protected Encoder(Charset cs) {
|
||||
super(cs, 4.0f, 8.0f);
|
||||
}
|
||||
|
||||
public boolean canEncode(char c) {
|
||||
return (ISOEncoder.canEncode(c));
|
||||
}
|
||||
|
||||
protected void implReset() {
|
||||
shiftout = false;
|
||||
SODesDefined = false;
|
||||
SS2DesDefined = false;
|
||||
SS3DesDefined = false;
|
||||
}
|
||||
|
||||
private int unicodeToNative(char unicode, byte ebyte[])
|
||||
{
|
||||
int index = 0;
|
||||
byte tmpByte[];
|
||||
char convChar[] = {unicode};
|
||||
byte convByte[] = new byte[4];
|
||||
int converted;
|
||||
|
||||
try{
|
||||
CharBuffer cc = CharBuffer.wrap(convChar);
|
||||
ByteBuffer bb = ByteBuffer.allocate(4);
|
||||
ISOEncoder.encode(cc, bb, true);
|
||||
bb.flip();
|
||||
converted = bb.remaining();
|
||||
bb.get(convByte,0,converted);
|
||||
} catch(Exception e) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (converted == 2) {
|
||||
if (!SODesDefined) {
|
||||
newSODesDefined = true;
|
||||
ebyte[0] = ISO_ESC;
|
||||
tmpByte = SODesig.getBytes();
|
||||
System.arraycopy(tmpByte,0,ebyte,1,tmpByte.length);
|
||||
index = tmpByte.length+1;
|
||||
}
|
||||
if (!shiftout) {
|
||||
newshiftout = true;
|
||||
ebyte[index++] = ISO_SO;
|
||||
}
|
||||
ebyte[index++] = (byte)(convByte[0] & 0x7f);
|
||||
ebyte[index++] = (byte)(convByte[1] & 0x7f);
|
||||
} else {
|
||||
if(convByte[0] == SS2) {
|
||||
if (convByte[1] == PLANE2) {
|
||||
if (!SS2DesDefined) {
|
||||
newSS2DesDefined = true;
|
||||
ebyte[0] = ISO_ESC;
|
||||
tmpByte = SS2Desig.getBytes();
|
||||
System.arraycopy(tmpByte, 0, ebyte, 1, tmpByte.length);
|
||||
index = tmpByte.length+1;
|
||||
}
|
||||
ebyte[index++] = ISO_ESC;
|
||||
ebyte[index++] = ISO_SS2_7;
|
||||
ebyte[index++] = (byte)(convByte[2] & 0x7f);
|
||||
ebyte[index++] = (byte)(convByte[3] & 0x7f);
|
||||
} else if (convByte[1] == PLANE3) {
|
||||
if(!SS3DesDefined){
|
||||
newSS3DesDefined = true;
|
||||
ebyte[0] = ISO_ESC;
|
||||
tmpByte = SS3Desig.getBytes();
|
||||
System.arraycopy(tmpByte, 0, ebyte, 1, tmpByte.length);
|
||||
index = tmpByte.length+1;
|
||||
}
|
||||
ebyte[index++] = ISO_ESC;
|
||||
ebyte[index++] = ISO_SS3_7;
|
||||
ebyte[index++] = (byte)(convByte[2] & 0x7f);
|
||||
ebyte[index++] = (byte)(convByte[3] & 0x7f);
|
||||
}
|
||||
}
|
||||
}
|
||||
return index;
|
||||
}
|
||||
|
||||
private CoderResult encodeArrayLoop(CharBuffer src,
|
||||
ByteBuffer dst)
|
||||
{
|
||||
char[] sa = src.array();
|
||||
int sp = src.arrayOffset() + src.position();
|
||||
int sl = src.arrayOffset() + src.limit();
|
||||
assert (sp <= sl);
|
||||
sp = (sp <= sl ? sp : sl);
|
||||
byte[] da = dst.array();
|
||||
int dp = dst.arrayOffset() + dst.position();
|
||||
int dl = dst.arrayOffset() + dst.limit();
|
||||
assert (dp <= dl);
|
||||
dp = (dp <= dl ? dp : dl);
|
||||
|
||||
int outputSize = 0;
|
||||
byte[] outputByte = new byte[8];
|
||||
newshiftout = shiftout;
|
||||
newSODesDefined = SODesDefined;
|
||||
newSS2DesDefined = SS2DesDefined;
|
||||
newSS3DesDefined = SS3DesDefined;
|
||||
|
||||
try {
|
||||
while (sp < sl) {
|
||||
char c = sa[sp];
|
||||
if (Character.isSurrogate(c)) {
|
||||
if (sgp.parse(c, sa, sp, sl) < 0)
|
||||
return sgp.error();
|
||||
return sgp.unmappableResult();
|
||||
}
|
||||
|
||||
if (c < 0x80) { // ASCII
|
||||
if (shiftout){
|
||||
newshiftout = false;
|
||||
outputSize = 2;
|
||||
outputByte[0] = ISO_SI;
|
||||
outputByte[1] = (byte)(c & 0x7f);
|
||||
} else {
|
||||
outputSize = 1;
|
||||
outputByte[0] = (byte)(c & 0x7f);
|
||||
}
|
||||
if(sa[sp] == '\n'){
|
||||
newSODesDefined = false;
|
||||
newSS2DesDefined = false;
|
||||
newSS3DesDefined = false;
|
||||
}
|
||||
} else {
|
||||
outputSize = unicodeToNative(c, outputByte);
|
||||
if (outputSize == 0) {
|
||||
return CoderResult.unmappableForLength(1);
|
||||
}
|
||||
}
|
||||
if (dl - dp < outputSize)
|
||||
return CoderResult.OVERFLOW;
|
||||
|
||||
for (int i = 0; i < outputSize; i++)
|
||||
da[dp++] = outputByte[i];
|
||||
sp++;
|
||||
shiftout = newshiftout;
|
||||
SODesDefined = newSODesDefined;
|
||||
SS2DesDefined = newSS2DesDefined;
|
||||
SS3DesDefined = newSS3DesDefined;
|
||||
}
|
||||
return CoderResult.UNDERFLOW;
|
||||
} finally {
|
||||
src.position(sp - src.arrayOffset());
|
||||
dst.position(dp - dst.arrayOffset());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private CoderResult encodeBufferLoop(CharBuffer src,
|
||||
ByteBuffer dst)
|
||||
{
|
||||
int outputSize = 0;
|
||||
byte[] outputByte = new byte[8];
|
||||
int inputSize = 0; // Size of input
|
||||
newshiftout = shiftout;
|
||||
newSODesDefined = SODesDefined;
|
||||
newSS2DesDefined = SS2DesDefined;
|
||||
newSS3DesDefined = SS3DesDefined;
|
||||
int mark = src.position();
|
||||
|
||||
try {
|
||||
while (src.hasRemaining()) {
|
||||
char inputChar = src.get();
|
||||
if (Character.isSurrogate(inputChar)) {
|
||||
if (sgp.parse(inputChar, src) < 0)
|
||||
return sgp.error();
|
||||
return sgp.unmappableResult();
|
||||
}
|
||||
if (inputChar < 0x80) { // ASCII
|
||||
if (shiftout){
|
||||
newshiftout = false;
|
||||
outputSize = 2;
|
||||
outputByte[0] = ISO_SI;
|
||||
outputByte[1] = (byte)(inputChar & 0x7f);
|
||||
} else {
|
||||
outputSize = 1;
|
||||
outputByte[0] = (byte)(inputChar & 0x7f);
|
||||
}
|
||||
if(inputChar == '\n'){
|
||||
newSODesDefined = false;
|
||||
newSS2DesDefined = false;
|
||||
newSS3DesDefined = false;
|
||||
}
|
||||
} else {
|
||||
outputSize = unicodeToNative(inputChar, outputByte);
|
||||
if (outputSize == 0) {
|
||||
return CoderResult.unmappableForLength(1);
|
||||
}
|
||||
}
|
||||
|
||||
if (dst.remaining() < outputSize)
|
||||
return CoderResult.OVERFLOW;
|
||||
for (int i = 0; i < outputSize; i++)
|
||||
dst.put(outputByte[i]);
|
||||
mark++;
|
||||
shiftout = newshiftout;
|
||||
SODesDefined = newSODesDefined;
|
||||
SS2DesDefined = newSS2DesDefined;
|
||||
SS3DesDefined = newSS3DesDefined;
|
||||
}
|
||||
return CoderResult.UNDERFLOW;
|
||||
} finally {
|
||||
src.position(mark);
|
||||
}
|
||||
}
|
||||
|
||||
protected CoderResult encodeLoop(CharBuffer src,
|
||||
ByteBuffer dst)
|
||||
{
|
||||
if (src.hasArray() && dst.hasArray())
|
||||
return encodeArrayLoop(src, dst);
|
||||
else
|
||||
return encodeBufferLoop(src, dst);
|
||||
}
|
||||
}
|
||||
}
|
||||
409
jdkSrc/jdk8/sun/nio/cs/ext/ISO2022_CN.java
Normal file
409
jdkSrc/jdk8/sun/nio/cs/ext/ISO2022_CN.java
Normal file
@@ -0,0 +1,409 @@
|
||||
/*
|
||||
* Copyright (c) 2003, 2006, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
/*
|
||||
*/
|
||||
|
||||
package sun.nio.cs.ext;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
import java.nio.CharBuffer;
|
||||
import java.nio.charset.Charset;
|
||||
import java.nio.charset.CharsetDecoder;
|
||||
import java.nio.charset.CharsetEncoder;
|
||||
import java.nio.charset.CoderResult;
|
||||
import java.nio.charset.CharacterCodingException;
|
||||
import sun.nio.cs.HistoricallyNamedCharset;
|
||||
import sun.nio.cs.US_ASCII;
|
||||
|
||||
public class ISO2022_CN
|
||||
extends Charset
|
||||
implements HistoricallyNamedCharset
|
||||
{
|
||||
private static final byte ISO_ESC = 0x1b;
|
||||
private static final byte ISO_SI = 0x0f;
|
||||
private static final byte ISO_SO = 0x0e;
|
||||
private static final byte ISO_SS2_7 = 0x4e;
|
||||
private static final byte ISO_SS3_7 = 0x4f;
|
||||
private static final byte MSB = (byte)0x80;
|
||||
private static final char REPLACE_CHAR = '\uFFFD';
|
||||
|
||||
private static final byte SODesigGB = 0;
|
||||
private static final byte SODesigCNS = 1;
|
||||
|
||||
public ISO2022_CN() {
|
||||
super("ISO-2022-CN", ExtendedCharsets.aliasesFor("ISO-2022-CN"));
|
||||
}
|
||||
|
||||
public String historicalName() {
|
||||
return "ISO2022CN";
|
||||
}
|
||||
|
||||
public boolean contains(Charset cs) {
|
||||
return ((cs instanceof EUC_CN) // GB2312-80 repertoire
|
||||
|| (cs instanceof US_ASCII)
|
||||
|| (cs instanceof EUC_TW) // CNS11643 repertoire
|
||||
|| (cs instanceof ISO2022_CN));
|
||||
}
|
||||
|
||||
public CharsetDecoder newDecoder() {
|
||||
return new Decoder(this);
|
||||
}
|
||||
|
||||
public CharsetEncoder newEncoder() {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
public boolean canEncode() {
|
||||
return false;
|
||||
}
|
||||
|
||||
static class Decoder extends CharsetDecoder {
|
||||
private boolean shiftOut;
|
||||
private byte currentSODesig;
|
||||
|
||||
private static final Charset gb2312 = new EUC_CN();
|
||||
private static final Charset cns = new EUC_TW();
|
||||
private final DoubleByte.Decoder gb2312Decoder;
|
||||
private final EUC_TW.Decoder cnsDecoder;
|
||||
|
||||
Decoder(Charset cs) {
|
||||
super(cs, 1.0f, 1.0f);
|
||||
shiftOut = false;
|
||||
currentSODesig = SODesigGB;
|
||||
gb2312Decoder = (DoubleByte.Decoder)gb2312.newDecoder();
|
||||
cnsDecoder = (EUC_TW.Decoder)cns.newDecoder();
|
||||
}
|
||||
|
||||
protected void implReset() {
|
||||
shiftOut= false;
|
||||
currentSODesig = SODesigGB;
|
||||
}
|
||||
|
||||
private char cnsDecode(byte byte1, byte byte2, byte SS) {
|
||||
byte1 |= MSB;
|
||||
byte2 |= MSB;
|
||||
int p = 0;
|
||||
if (SS == ISO_SS2_7)
|
||||
p = 1; //plane 2, index -- 1
|
||||
else if (SS == ISO_SS3_7)
|
||||
p = 2; //plane 3, index -- 2
|
||||
else
|
||||
return REPLACE_CHAR; //never happen.
|
||||
char[] ret = cnsDecoder.toUnicode(byte1 & 0xff,
|
||||
byte2 & 0xff,
|
||||
p);
|
||||
if (ret == null || ret.length == 2)
|
||||
return REPLACE_CHAR;
|
||||
return ret[0];
|
||||
}
|
||||
|
||||
private char SODecode(byte byte1, byte byte2, byte SOD) {
|
||||
byte1 |= MSB;
|
||||
byte2 |= MSB;
|
||||
if (SOD == SODesigGB) {
|
||||
return gb2312Decoder.decodeDouble(byte1 & 0xff,
|
||||
byte2 & 0xff);
|
||||
} else { // SOD == SODesigCNS
|
||||
char[] ret = cnsDecoder.toUnicode(byte1 & 0xff,
|
||||
byte2 & 0xff,
|
||||
0);
|
||||
if (ret == null)
|
||||
return REPLACE_CHAR;
|
||||
return ret[0];
|
||||
}
|
||||
}
|
||||
|
||||
private CoderResult decodeBufferLoop(ByteBuffer src,
|
||||
CharBuffer dst)
|
||||
{
|
||||
int mark = src.position();
|
||||
byte b1 = 0, b2 = 0, b3 = 0, b4 = 0;
|
||||
int inputSize = 0;
|
||||
char c = REPLACE_CHAR;
|
||||
try {
|
||||
while (src.hasRemaining()) {
|
||||
b1 = src.get();
|
||||
inputSize = 1;
|
||||
|
||||
while (b1 == ISO_ESC ||
|
||||
b1 == ISO_SO ||
|
||||
b1 == ISO_SI) {
|
||||
if (b1 == ISO_ESC) { // ESC
|
||||
currentSODesig = SODesigGB;
|
||||
|
||||
if (src.remaining() < 1)
|
||||
return CoderResult.UNDERFLOW;
|
||||
|
||||
b2 = src.get();
|
||||
inputSize++;
|
||||
|
||||
if ((b2 & (byte)0x80) != 0)
|
||||
return CoderResult.malformedForLength(inputSize);
|
||||
|
||||
if (b2 == (byte)0x24) {
|
||||
if (src.remaining() < 1)
|
||||
return CoderResult.UNDERFLOW;
|
||||
|
||||
b3 = src.get();
|
||||
inputSize++;
|
||||
|
||||
if ((b3 & (byte)0x80) != 0)
|
||||
return CoderResult.malformedForLength(inputSize);
|
||||
if (b3 == 'A'){ // "$A"
|
||||
currentSODesig = SODesigGB;
|
||||
} else if (b3 == ')') {
|
||||
if (src.remaining() < 1)
|
||||
return CoderResult.UNDERFLOW;
|
||||
b4 = src.get();
|
||||
inputSize++;
|
||||
if (b4 == 'A'){ // "$)A"
|
||||
currentSODesig = SODesigGB;
|
||||
} else if (b4 == 'G'){ // "$)G"
|
||||
currentSODesig = SODesigCNS;
|
||||
} else {
|
||||
return CoderResult.malformedForLength(inputSize);
|
||||
}
|
||||
} else if (b3 == '*') {
|
||||
if (src.remaining() < 1)
|
||||
return CoderResult.UNDERFLOW;
|
||||
b4 = src.get();
|
||||
inputSize++;
|
||||
if (b4 != 'H') { // "$*H"
|
||||
//SS2Desig -> CNS-P1
|
||||
return CoderResult.malformedForLength(inputSize);
|
||||
}
|
||||
} else if (b3 == '+') {
|
||||
if (src.remaining() < 1)
|
||||
return CoderResult.UNDERFLOW;
|
||||
b4 = src.get();
|
||||
inputSize++;
|
||||
if (b4 != 'I'){ // "$+I"
|
||||
//SS3Desig -> CNS-P2.
|
||||
return CoderResult.malformedForLength(inputSize);
|
||||
}
|
||||
} else {
|
||||
return CoderResult.malformedForLength(inputSize);
|
||||
}
|
||||
} else if (b2 == ISO_SS2_7 || b2 == ISO_SS3_7) {
|
||||
if (src.remaining() < 2)
|
||||
return CoderResult.UNDERFLOW;
|
||||
b3 = src.get();
|
||||
b4 = src.get();
|
||||
inputSize += 2;
|
||||
if (dst.remaining() < 1)
|
||||
return CoderResult.OVERFLOW;
|
||||
//SS2->CNS-P2, SS3->CNS-P3
|
||||
c = cnsDecode(b3, b4, b2);
|
||||
if (c == REPLACE_CHAR)
|
||||
return CoderResult.unmappableForLength(inputSize);
|
||||
dst.put(c);
|
||||
} else {
|
||||
return CoderResult.malformedForLength(inputSize);
|
||||
}
|
||||
} else if (b1 == ISO_SO) {
|
||||
shiftOut = true;
|
||||
} else if (b1 == ISO_SI) { // shift back in
|
||||
shiftOut = false;
|
||||
}
|
||||
mark += inputSize;
|
||||
if (src.remaining() < 1)
|
||||
return CoderResult.UNDERFLOW;
|
||||
b1 = src.get();
|
||||
inputSize = 1;
|
||||
}
|
||||
|
||||
if (dst.remaining() < 1)
|
||||
return CoderResult.OVERFLOW;
|
||||
|
||||
if (!shiftOut) {
|
||||
dst.put((char)(b1 & 0xff)); //clear the upper byte
|
||||
mark += inputSize;
|
||||
} else {
|
||||
if (src.remaining() < 1)
|
||||
return CoderResult.UNDERFLOW;
|
||||
b2 = src.get();
|
||||
inputSize++;
|
||||
c = SODecode(b1, b2, currentSODesig);
|
||||
if (c == REPLACE_CHAR)
|
||||
return CoderResult.unmappableForLength(inputSize);
|
||||
dst.put(c);
|
||||
mark += inputSize;
|
||||
}
|
||||
}
|
||||
return CoderResult.UNDERFLOW;
|
||||
} finally {
|
||||
src.position(mark);
|
||||
}
|
||||
}
|
||||
|
||||
private CoderResult decodeArrayLoop(ByteBuffer src,
|
||||
CharBuffer dst)
|
||||
{
|
||||
int inputSize = 0;
|
||||
byte b1 = 0, b2 = 0, b3 = 0, b4 = 0;
|
||||
char c = REPLACE_CHAR;
|
||||
|
||||
byte[] sa = src.array();
|
||||
int sp = src.arrayOffset() + src.position();
|
||||
int sl = src.arrayOffset() + src.limit();
|
||||
assert (sp <= sl);
|
||||
sp = (sp <= sl ? sp : sl);
|
||||
|
||||
char[] da = dst.array();
|
||||
int dp = dst.arrayOffset() + dst.position();
|
||||
int dl = dst.arrayOffset() + dst.limit();
|
||||
assert (dp <= dl);
|
||||
dp = (dp <= dl ? dp : dl);
|
||||
|
||||
try {
|
||||
while (sp < sl) {
|
||||
b1 = sa[sp];
|
||||
inputSize = 1;
|
||||
|
||||
while (b1 == ISO_ESC || b1 == ISO_SO || b1 == ISO_SI) {
|
||||
if (b1 == ISO_ESC) { // ESC
|
||||
currentSODesig = SODesigGB;
|
||||
|
||||
if (sp + 2 > sl)
|
||||
return CoderResult.UNDERFLOW;
|
||||
|
||||
b2 = sa[sp + 1];
|
||||
inputSize++;
|
||||
|
||||
if ((b2 & (byte)0x80) != 0)
|
||||
return CoderResult.malformedForLength(inputSize);
|
||||
if (b2 == (byte)0x24) {
|
||||
if (sp + 3 > sl)
|
||||
return CoderResult.UNDERFLOW;
|
||||
|
||||
b3 = sa[sp + 2];
|
||||
inputSize++;
|
||||
|
||||
if ((b3 & (byte)0x80) != 0)
|
||||
return CoderResult.malformedForLength(inputSize);
|
||||
if (b3 == 'A'){ // "$A"
|
||||
/* <ESC>$A is not a legal designator sequence for
|
||||
ISO2022_CN, it is listed as an escape sequence
|
||||
for GB2312 in ISO2022-JP-2. Keep it here just for
|
||||
the sake of "compatibility".
|
||||
*/
|
||||
currentSODesig = SODesigGB;
|
||||
} else if (b3 == ')') {
|
||||
if (sp + 4 > sl)
|
||||
return CoderResult.UNDERFLOW;
|
||||
b4 = sa[sp + 3];
|
||||
inputSize++;
|
||||
|
||||
if (b4 == 'A'){ // "$)A"
|
||||
currentSODesig = SODesigGB;
|
||||
} else if (b4 == 'G'){ // "$)G"
|
||||
currentSODesig = SODesigCNS;
|
||||
} else {
|
||||
return CoderResult.malformedForLength(inputSize);
|
||||
}
|
||||
} else if (b3 == '*') {
|
||||
if (sp + 4 > sl)
|
||||
return CoderResult.UNDERFLOW;
|
||||
b4 = sa[sp + 3];
|
||||
inputSize++;
|
||||
if (b4 != 'H'){ // "$*H"
|
||||
return CoderResult.malformedForLength(inputSize);
|
||||
}
|
||||
} else if (b3 == '+') {
|
||||
if (sp + 4 > sl)
|
||||
return CoderResult.UNDERFLOW;
|
||||
b4 = sa[sp + 3];
|
||||
inputSize++;
|
||||
if (b4 != 'I'){ // "$+I"
|
||||
return CoderResult.malformedForLength(inputSize);
|
||||
}
|
||||
} else {
|
||||
return CoderResult.malformedForLength(inputSize);
|
||||
}
|
||||
} else if (b2 == ISO_SS2_7 || b2 == ISO_SS3_7) {
|
||||
if (sp + 4 > sl) {
|
||||
return CoderResult.UNDERFLOW;
|
||||
}
|
||||
b3 = sa[sp + 2];
|
||||
b4 = sa[sp + 3];
|
||||
if (dl - dp < 1) {
|
||||
return CoderResult.OVERFLOW;
|
||||
}
|
||||
inputSize += 2;
|
||||
c = cnsDecode(b3, b4, b2);
|
||||
if (c == REPLACE_CHAR)
|
||||
return CoderResult.unmappableForLength(inputSize);
|
||||
da[dp++] = c;
|
||||
} else {
|
||||
return CoderResult.malformedForLength(inputSize);
|
||||
}
|
||||
} else if (b1 == ISO_SO) {
|
||||
shiftOut = true;
|
||||
} else if (b1 == ISO_SI) { // shift back in
|
||||
shiftOut = false;
|
||||
}
|
||||
sp += inputSize;
|
||||
if (sp + 1 > sl)
|
||||
return CoderResult.UNDERFLOW;
|
||||
b1 = sa[sp];
|
||||
inputSize = 1;
|
||||
}
|
||||
|
||||
if (dl - dp < 1) {
|
||||
return CoderResult.OVERFLOW;
|
||||
}
|
||||
|
||||
if (!shiftOut) {
|
||||
da[dp++] = (char)(b1 & 0xff); //clear the upper byte
|
||||
} else {
|
||||
if (sp + 2 > sl)
|
||||
return CoderResult.UNDERFLOW;
|
||||
b2 = sa[sp + 1];
|
||||
inputSize++;
|
||||
c = SODecode(b1, b2, currentSODesig);
|
||||
if (c == REPLACE_CHAR)
|
||||
return CoderResult.unmappableForLength(inputSize);
|
||||
da[dp++] = c;
|
||||
}
|
||||
sp += inputSize;
|
||||
}
|
||||
return CoderResult.UNDERFLOW;
|
||||
} finally {
|
||||
src.position(sp - src.arrayOffset());
|
||||
dst.position(dp - dst.arrayOffset());
|
||||
}
|
||||
}
|
||||
|
||||
protected CoderResult decodeLoop(ByteBuffer src,
|
||||
CharBuffer dst)
|
||||
{
|
||||
if (src.hasArray() && dst.hasArray())
|
||||
return decodeArrayLoop(src, dst);
|
||||
else
|
||||
return decodeBufferLoop(src, dst);
|
||||
}
|
||||
}
|
||||
}
|
||||
101
jdkSrc/jdk8/sun/nio/cs/ext/ISO2022_CN_CNS.java
Normal file
101
jdkSrc/jdk8/sun/nio/cs/ext/ISO2022_CN_CNS.java
Normal file
@@ -0,0 +1,101 @@
|
||||
/*
|
||||
* Copyright (c) 2002, 2006, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
/*
|
||||
*/
|
||||
|
||||
package sun.nio.cs.ext;
|
||||
|
||||
import java.nio.charset.Charset;
|
||||
import java.nio.ByteBuffer;
|
||||
import java.nio.CharBuffer;
|
||||
import java.nio.charset.CharsetDecoder;
|
||||
import java.nio.charset.CharsetEncoder;
|
||||
import java.nio.charset.CoderResult;
|
||||
import sun.nio.cs.HistoricallyNamedCharset;
|
||||
|
||||
public class ISO2022_CN_CNS extends ISO2022 implements HistoricallyNamedCharset
|
||||
{
|
||||
public ISO2022_CN_CNS() {
|
||||
super("x-ISO-2022-CN-CNS", ExtendedCharsets.aliasesFor("x-ISO-2022-CN-CNS"));
|
||||
}
|
||||
|
||||
public boolean contains(Charset cs) {
|
||||
// overlapping repertoire of EUC_TW, CNS11643
|
||||
return ((cs instanceof EUC_TW) ||
|
||||
(cs.name().equals("US-ASCII")) ||
|
||||
(cs instanceof ISO2022_CN_CNS));
|
||||
}
|
||||
|
||||
public String historicalName() {
|
||||
return "ISO2022CN_CNS";
|
||||
}
|
||||
|
||||
public CharsetDecoder newDecoder() {
|
||||
return new ISO2022_CN.Decoder(this);
|
||||
}
|
||||
|
||||
public CharsetEncoder newEncoder() {
|
||||
return new Encoder(this);
|
||||
}
|
||||
|
||||
private static class Encoder extends ISO2022.Encoder {
|
||||
|
||||
public Encoder(Charset cs)
|
||||
{
|
||||
super(cs);
|
||||
SODesig = "$)G";
|
||||
SS2Desig = "$*H";
|
||||
SS3Desig = "$+I";
|
||||
|
||||
try {
|
||||
Charset cset = Charset.forName("EUC_TW"); // CNS11643
|
||||
ISOEncoder = cset.newEncoder();
|
||||
} catch (Exception e) { }
|
||||
}
|
||||
|
||||
private byte[] bb = new byte[4];
|
||||
public boolean canEncode(char c) {
|
||||
int n = 0;
|
||||
return (c <= '\u007f' ||
|
||||
(n = ((EUC_TW.Encoder)ISOEncoder).toEUC(c, bb)) == 2 ||
|
||||
(n == 4 && bb[0] == SS2 &&
|
||||
(bb[1] == PLANE2 || bb[1] == PLANE3)));
|
||||
}
|
||||
|
||||
/*
|
||||
* Since ISO2022-CN-CNS possesses a CharsetEncoder
|
||||
* without the corresponding CharsetDecoder half the
|
||||
* default replacement check needs to be overridden
|
||||
* since the parent class version attempts to
|
||||
* decode 0x3f (?).
|
||||
*/
|
||||
|
||||
public boolean isLegalReplacement(byte[] repl) {
|
||||
// 0x3f is OK as the replacement byte
|
||||
return (repl.length == 1 && repl[0] == (byte) 0x3f);
|
||||
}
|
||||
}
|
||||
}
|
||||
91
jdkSrc/jdk8/sun/nio/cs/ext/ISO2022_CN_GB.java
Normal file
91
jdkSrc/jdk8/sun/nio/cs/ext/ISO2022_CN_GB.java
Normal file
@@ -0,0 +1,91 @@
|
||||
/*
|
||||
* Copyright (c) 2002, 2006, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
/*
|
||||
*/
|
||||
|
||||
package sun.nio.cs.ext;
|
||||
|
||||
import java.nio.charset.Charset;
|
||||
import java.nio.ByteBuffer;
|
||||
import java.nio.CharBuffer;
|
||||
import java.nio.charset.CharsetDecoder;
|
||||
import java.nio.charset.CharsetEncoder;
|
||||
import java.nio.charset.CoderResult;
|
||||
import sun.nio.cs.HistoricallyNamedCharset;
|
||||
|
||||
public class ISO2022_CN_GB extends ISO2022 implements HistoricallyNamedCharset
|
||||
{
|
||||
public ISO2022_CN_GB() {
|
||||
super("x-ISO-2022-CN-GB",
|
||||
ExtendedCharsets.aliasesFor("x-ISO-2022-CN-GB"));
|
||||
}
|
||||
|
||||
public boolean contains(Charset cs) {
|
||||
// overlapping repertoire of EUC_CN, GB2312
|
||||
return ((cs instanceof EUC_CN) ||
|
||||
(cs.name().equals("US-ASCII")) ||
|
||||
(cs instanceof ISO2022_CN_GB));
|
||||
}
|
||||
|
||||
public String historicalName() {
|
||||
return "ISO2022CN_GB";
|
||||
}
|
||||
|
||||
public CharsetDecoder newDecoder() {
|
||||
return new ISO2022_CN.Decoder(this);
|
||||
}
|
||||
|
||||
public CharsetEncoder newEncoder() {
|
||||
return new Encoder(this);
|
||||
}
|
||||
|
||||
private static class Encoder extends ISO2022.Encoder {
|
||||
|
||||
public Encoder(Charset cs)
|
||||
{
|
||||
super(cs);
|
||||
SODesig = "$)A";
|
||||
|
||||
try {
|
||||
Charset cset = Charset.forName("EUC_CN"); // GB2312
|
||||
ISOEncoder = cset.newEncoder();
|
||||
} catch (Exception e) { }
|
||||
}
|
||||
|
||||
/*
|
||||
* Since ISO2022-CN-GB possesses a CharsetEncoder
|
||||
* without the corresponding CharsetDecoder half the
|
||||
* default replacement check needs to be overridden
|
||||
* since the parent class version attempts to
|
||||
* decode 0x3f (?).
|
||||
*/
|
||||
|
||||
public boolean isLegalReplacement(byte[] repl) {
|
||||
// 0x3f is OK as the replacement byte
|
||||
return (repl.length == 1 && repl[0] == (byte) 0x3f);
|
||||
}
|
||||
}
|
||||
}
|
||||
762
jdkSrc/jdk8/sun/nio/cs/ext/ISO2022_JP.java
Normal file
762
jdkSrc/jdk8/sun/nio/cs/ext/ISO2022_JP.java
Normal file
@@ -0,0 +1,762 @@
|
||||
/*
|
||||
* Copyright (c) 2002, 2012, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package sun.nio.cs.ext;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
import java.nio.CharBuffer;
|
||||
import java.nio.charset.Charset;
|
||||
import java.nio.charset.CharsetDecoder;
|
||||
import java.nio.charset.CharsetEncoder;
|
||||
import java.nio.charset.CoderResult;
|
||||
import java.nio.charset.CodingErrorAction;
|
||||
import sun.nio.cs.HistoricallyNamedCharset;
|
||||
import sun.nio.cs.Surrogate;
|
||||
import sun.nio.cs.US_ASCII;
|
||||
import static sun.nio.cs.CharsetMapping.*;
|
||||
|
||||
/*
|
||||
* Implementation notes:
|
||||
*
|
||||
* (1)"Standard based" (ASCII, JIS_X_0201 and JIS_X_0208) ISO2022-JP charset
|
||||
* is provided by the base implementation of this class.
|
||||
*
|
||||
* Three Microsoft ISO2022-JP variants, MS50220, MS50221 and MSISO2022JP
|
||||
* are provided via subclasses.
|
||||
*
|
||||
* (2)MS50220 and MS50221 are assumed to work the same way as Microsoft
|
||||
* CP50220 and CP50221's 7-bit implementation works by using CP5022X
|
||||
* specific JIS0208 and JIS0212 mapping tables (generated via Microsoft's
|
||||
* MultiByteToWideChar/WideCharToMultiByte APIs). The only difference
|
||||
* between these 2 classes is that MS50220 does not support singlebyte
|
||||
* halfwidth kana (Uff61-Uff9f) shiftin mechanism when "encoding", instead
|
||||
* these halfwidth kana characters are converted to their fullwidth JIS0208
|
||||
* counterparts.
|
||||
*
|
||||
* The difference between the standard JIS_X_0208 and JIS_X_0212 mappings
|
||||
* and the CP50220/50221 specific are
|
||||
*
|
||||
* 0208 mapping:
|
||||
* 1)0x213d <-> U2015 (compared to U2014)
|
||||
* 2)One way mappings for 5 characters below
|
||||
* u2225 (ms) -> 0x2142 <-> u2016 (jis)
|
||||
* uff0d (ms) -> 0x215d <-> u2212 (jis)
|
||||
* uffe0 (ms) -> 0x2171 <-> u00a2 (jis)
|
||||
* uffe1 (ms) -> 0x2172 <-> u00a3 (jis)
|
||||
* uffe2 (ms) -> 0x224c <-> u00ac (jis)
|
||||
* //should consider 0xff5e -> 0x2141 <-> U301c?
|
||||
* 3)NEC Row13 0x2d21-0x2d79
|
||||
* 4)85-94 ku <-> UE000,UE3AB (includes NEC selected
|
||||
* IBM kanji in 89-92ku)
|
||||
* 5)UFF61-UFF9f -> Fullwidth 0208 KANA
|
||||
*
|
||||
* 0212 mapping:
|
||||
* 1)0x2237 <-> UFF5E (Fullwidth Tilde)
|
||||
* 2)0x2271 <-> U2116 (Numero Sign)
|
||||
* 3)85-94 ku <-> UE3AC - UE757
|
||||
*
|
||||
* (3)MSISO2022JP uses a JIS0208 mapping generated from MS932DB.b2c
|
||||
* and MS932DB.c2b by converting the SJIS codepoints back to their
|
||||
* JIS0208 counterparts. With the exception of
|
||||
*
|
||||
* (a)Codepoints with a resulting JIS0208 codepoints beyond 0x7e00 are
|
||||
* dropped (this includs the IBM Extended Kanji/Non-kanji from 0x9321
|
||||
* to 0x972c)
|
||||
* (b)The Unicode codepoints that the IBM Extended Kanji/Non-kanji are
|
||||
* mapped to (in MS932) are mapped back to NEC selected IBM Kanji/
|
||||
* Non-kanji area at 0x7921-0x7c7e.
|
||||
*
|
||||
* Compared to JIS_X_0208 mapping, this MS932 based mapping has
|
||||
|
||||
* (a)different mappings for 7 JIS codepoints
|
||||
* 0x213d <-> U2015
|
||||
* 0x2141 <-> UFF5E
|
||||
* 0x2142 <-> U2225
|
||||
* 0x215d <-> Uff0d
|
||||
* 0x2171 <-> Uffe0
|
||||
* 0x2172 <-> Uffe1
|
||||
* 0x224c <-> Uffe2
|
||||
* (b)added one-way c2b mappings for
|
||||
* U00b8 -> 0x2124
|
||||
* U00b7 -> 0x2126
|
||||
* U00af -> 0x2131
|
||||
* U00ab -> 0x2263
|
||||
* U00bb -> 0x2264
|
||||
* U3094 -> 0x2574
|
||||
* U00b5 -> 0x264c
|
||||
* (c)NEC Row 13
|
||||
* (d)NEC selected IBM extended Kanji/Non-kanji
|
||||
* These codepoints are mapped to the same Unicode codepoints as
|
||||
* the MS932 does, while MS50220/50221 maps them to the Unicode
|
||||
* private area.
|
||||
*
|
||||
* # There is also an interesting difference when compared to MS5022X
|
||||
* 0208 mapping for JIS codepoint "0x2D60", MS932 maps it to U301d
|
||||
* but MS5022X maps it to U301e, obvious MS5022X is wrong, but...
|
||||
*/
|
||||
|
||||
public class ISO2022_JP
|
||||
extends Charset
|
||||
implements HistoricallyNamedCharset
|
||||
{
|
||||
private static final int ASCII = 0; // ESC ( B
|
||||
private static final int JISX0201_1976 = 1; // ESC ( J
|
||||
private static final int JISX0208_1978 = 2; // ESC $ @
|
||||
private static final int JISX0208_1983 = 3; // ESC $ B
|
||||
private static final int JISX0212_1990 = 4; // ESC $ ( D
|
||||
private static final int JISX0201_1976_KANA = 5; // ESC ( I
|
||||
private static final int SHIFTOUT = 6;
|
||||
|
||||
private static final int ESC = 0x1b;
|
||||
private static final int SO = 0x0e;
|
||||
private static final int SI = 0x0f;
|
||||
|
||||
public ISO2022_JP() {
|
||||
super("ISO-2022-JP",
|
||||
ExtendedCharsets.aliasesFor("ISO-2022-JP"));
|
||||
}
|
||||
|
||||
protected ISO2022_JP(String canonicalName,
|
||||
String[] aliases) {
|
||||
super(canonicalName, aliases);
|
||||
}
|
||||
|
||||
public String historicalName() {
|
||||
return "ISO2022JP";
|
||||
}
|
||||
|
||||
public boolean contains(Charset cs) {
|
||||
return ((cs instanceof JIS_X_0201)
|
||||
|| (cs instanceof US_ASCII)
|
||||
|| (cs instanceof JIS_X_0208)
|
||||
|| (cs instanceof ISO2022_JP));
|
||||
}
|
||||
|
||||
public CharsetDecoder newDecoder() {
|
||||
return new Decoder(this);
|
||||
}
|
||||
|
||||
public CharsetEncoder newEncoder() {
|
||||
return new Encoder(this);
|
||||
}
|
||||
|
||||
protected boolean doSBKANA() {
|
||||
return true;
|
||||
}
|
||||
|
||||
static class Decoder extends CharsetDecoder
|
||||
implements DelegatableDecoder {
|
||||
|
||||
final static DoubleByte.Decoder DEC0208 =
|
||||
(DoubleByte.Decoder)new JIS_X_0208().newDecoder();
|
||||
|
||||
private int currentState;
|
||||
private int previousState;
|
||||
|
||||
private DoubleByte.Decoder dec0208;
|
||||
private DoubleByte.Decoder dec0212;
|
||||
|
||||
private Decoder(Charset cs) {
|
||||
this(cs, DEC0208, null);
|
||||
}
|
||||
|
||||
protected Decoder(Charset cs,
|
||||
DoubleByte.Decoder dec0208,
|
||||
DoubleByte.Decoder dec0212) {
|
||||
super(cs, 0.5f, 1.0f);
|
||||
this.dec0208 = dec0208;
|
||||
this.dec0212 = dec0212;
|
||||
currentState = ASCII;
|
||||
previousState = ASCII;
|
||||
}
|
||||
|
||||
public void implReset() {
|
||||
currentState = ASCII;
|
||||
previousState = ASCII;
|
||||
}
|
||||
|
||||
private CoderResult decodeArrayLoop(ByteBuffer src,
|
||||
CharBuffer dst)
|
||||
{
|
||||
int inputSize = 0;
|
||||
int b1 = 0, b2 = 0, b3 = 0, b4 = 0;
|
||||
char c = UNMAPPABLE_DECODING;
|
||||
byte[] sa = src.array();
|
||||
int sp = src.arrayOffset() + src.position();
|
||||
int sl = src.arrayOffset() + src.limit();
|
||||
assert (sp <= sl);
|
||||
sp = (sp <= sl ? sp : sl);
|
||||
|
||||
char[] da = dst.array();
|
||||
int dp = dst.arrayOffset() + dst.position();
|
||||
int dl = dst.arrayOffset() + dst.limit();
|
||||
assert (dp <= dl);
|
||||
dp = (dp <= dl ? dp : dl);
|
||||
|
||||
try {
|
||||
while (sp < sl) {
|
||||
b1 = sa[sp] & 0xff;
|
||||
inputSize = 1;
|
||||
if ((b1 & 0x80) != 0) {
|
||||
return CoderResult.malformedForLength(inputSize);
|
||||
}
|
||||
if (b1 == ESC || b1 == SO || b1 == SI) {
|
||||
if (b1 == ESC) {
|
||||
if (sp + inputSize + 2 > sl)
|
||||
return CoderResult.UNDERFLOW;
|
||||
b2 = sa[sp + inputSize++] & 0xff;
|
||||
if (b2 == '(') {
|
||||
b3 = sa[sp + inputSize++] & 0xff;
|
||||
if (b3 == 'B'){
|
||||
currentState = ASCII;
|
||||
} else if (b3 == 'J'){
|
||||
currentState = JISX0201_1976;
|
||||
} else if (b3 == 'I'){
|
||||
currentState = JISX0201_1976_KANA;
|
||||
} else {
|
||||
return CoderResult.malformedForLength(inputSize);
|
||||
}
|
||||
} else if (b2 == '$'){
|
||||
b3 = sa[sp + inputSize++] & 0xff;
|
||||
if (b3 == '@'){
|
||||
currentState = JISX0208_1978;
|
||||
} else if (b3 == 'B'){
|
||||
currentState = JISX0208_1983;
|
||||
} else if (b3 == '(' && dec0212 != null) {
|
||||
if (sp + inputSize + 1 > sl)
|
||||
return CoderResult.UNDERFLOW;
|
||||
b4 = sa[sp + inputSize++] & 0xff;
|
||||
if (b4 == 'D') {
|
||||
currentState = JISX0212_1990;
|
||||
} else {
|
||||
return CoderResult.malformedForLength(inputSize);
|
||||
}
|
||||
} else {
|
||||
return CoderResult.malformedForLength(inputSize);
|
||||
}
|
||||
} else {
|
||||
return CoderResult.malformedForLength(inputSize);
|
||||
}
|
||||
} else if (b1 == SO) {
|
||||
previousState = currentState;
|
||||
currentState = SHIFTOUT;
|
||||
} else if (b1 == SI) {
|
||||
currentState = previousState;
|
||||
}
|
||||
sp += inputSize;
|
||||
continue;
|
||||
}
|
||||
if (dp + 1 > dl)
|
||||
return CoderResult.OVERFLOW;
|
||||
|
||||
switch (currentState){
|
||||
case ASCII:
|
||||
da[dp++] = (char)(b1 & 0xff);
|
||||
break;
|
||||
case JISX0201_1976:
|
||||
switch (b1) {
|
||||
case 0x5c: // Yen/tilde substitution
|
||||
da[dp++] = '\u00a5';
|
||||
break;
|
||||
case 0x7e:
|
||||
da[dp++] = '\u203e';
|
||||
break;
|
||||
default:
|
||||
da[dp++] = (char)b1;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case JISX0208_1978:
|
||||
case JISX0208_1983:
|
||||
if (sp + inputSize + 1 > sl)
|
||||
return CoderResult.UNDERFLOW;
|
||||
b2 = sa[sp + inputSize++] & 0xff;
|
||||
c = dec0208.decodeDouble(b1,b2);
|
||||
if (c == UNMAPPABLE_DECODING)
|
||||
return CoderResult.unmappableForLength(inputSize);
|
||||
da[dp++] = c;
|
||||
break;
|
||||
case JISX0212_1990:
|
||||
if (sp + inputSize + 1 > sl)
|
||||
return CoderResult.UNDERFLOW;
|
||||
b2 = sa[sp + inputSize++] & 0xff;
|
||||
c = dec0212.decodeDouble(b1,b2);
|
||||
if (c == UNMAPPABLE_DECODING)
|
||||
return CoderResult.unmappableForLength(inputSize);
|
||||
da[dp++] = c;
|
||||
break;
|
||||
case JISX0201_1976_KANA:
|
||||
case SHIFTOUT:
|
||||
if (b1 > 0x5f) {
|
||||
return CoderResult.malformedForLength(inputSize);
|
||||
}
|
||||
da[dp++] = (char)(b1 + 0xff40);
|
||||
break;
|
||||
}
|
||||
sp += inputSize;
|
||||
}
|
||||
return CoderResult.UNDERFLOW;
|
||||
} finally {
|
||||
src.position(sp - src.arrayOffset());
|
||||
dst.position(dp - dst.arrayOffset());
|
||||
}
|
||||
}
|
||||
|
||||
private CoderResult decodeBufferLoop(ByteBuffer src,
|
||||
CharBuffer dst)
|
||||
{
|
||||
int mark = src.position();
|
||||
int b1 = 0, b2 = 0, b3 = 0, b4=0;
|
||||
char c = UNMAPPABLE_DECODING;
|
||||
int inputSize = 0;
|
||||
try {
|
||||
while (src.hasRemaining()) {
|
||||
b1 = src.get() & 0xff;
|
||||
inputSize = 1;
|
||||
if ((b1 & 0x80) != 0)
|
||||
return CoderResult.malformedForLength(inputSize);
|
||||
if (b1 == ESC || b1 == SO || b1 == SI) {
|
||||
if (b1 == ESC) { // ESC
|
||||
if (src.remaining() < 2)
|
||||
return CoderResult.UNDERFLOW;
|
||||
b2 = src.get() & 0xff;
|
||||
inputSize++;
|
||||
if (b2 == '(') {
|
||||
b3 = src.get() & 0xff;
|
||||
inputSize++;
|
||||
if (b3 == 'B'){
|
||||
currentState = ASCII;
|
||||
} else if (b3 == 'J'){
|
||||
currentState = JISX0201_1976;
|
||||
} else if (b3 == 'I'){
|
||||
currentState = JISX0201_1976_KANA;
|
||||
} else {
|
||||
return CoderResult.malformedForLength(inputSize);
|
||||
}
|
||||
} else if (b2 == '$'){
|
||||
b3 = src.get() & 0xff;
|
||||
inputSize++;
|
||||
if (b3 == '@'){
|
||||
currentState = JISX0208_1978;
|
||||
} else if (b3 == 'B'){
|
||||
currentState = JISX0208_1983;
|
||||
} else if (b3 == '(' && dec0212 != null) {
|
||||
if (!src.hasRemaining())
|
||||
return CoderResult.UNDERFLOW;
|
||||
b4 = src.get() & 0xff;
|
||||
inputSize++;
|
||||
if (b4 == 'D') {
|
||||
currentState = JISX0212_1990;
|
||||
} else {
|
||||
return CoderResult.malformedForLength(inputSize);
|
||||
}
|
||||
} else {
|
||||
return CoderResult.malformedForLength(inputSize);
|
||||
}
|
||||
} else {
|
||||
return CoderResult.malformedForLength(inputSize);
|
||||
}
|
||||
} else if (b1 == SO) {
|
||||
previousState = currentState;
|
||||
currentState = SHIFTOUT;
|
||||
} else if (b1 == SI) { // shift back in
|
||||
currentState = previousState;
|
||||
}
|
||||
mark += inputSize;
|
||||
continue;
|
||||
}
|
||||
if (!dst.hasRemaining())
|
||||
return CoderResult.OVERFLOW;
|
||||
|
||||
switch (currentState){
|
||||
case ASCII:
|
||||
dst.put((char)(b1 & 0xff));
|
||||
break;
|
||||
case JISX0201_1976:
|
||||
switch (b1) {
|
||||
case 0x5c: // Yen/tilde substitution
|
||||
dst.put('\u00a5');
|
||||
break;
|
||||
case 0x7e:
|
||||
dst.put('\u203e');
|
||||
break;
|
||||
default:
|
||||
dst.put((char)b1);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case JISX0208_1978:
|
||||
case JISX0208_1983:
|
||||
if (!src.hasRemaining())
|
||||
return CoderResult.UNDERFLOW;
|
||||
b2 = src.get() & 0xff;
|
||||
inputSize++;
|
||||
c = dec0208.decodeDouble(b1,b2);
|
||||
if (c == UNMAPPABLE_DECODING)
|
||||
return CoderResult.unmappableForLength(inputSize);
|
||||
dst.put(c);
|
||||
break;
|
||||
case JISX0212_1990:
|
||||
if (!src.hasRemaining())
|
||||
return CoderResult.UNDERFLOW;
|
||||
b2 = src.get() & 0xff;
|
||||
inputSize++;
|
||||
c = dec0212.decodeDouble(b1,b2);
|
||||
if (c == UNMAPPABLE_DECODING)
|
||||
return CoderResult.unmappableForLength(inputSize);
|
||||
dst.put(c);
|
||||
break;
|
||||
case JISX0201_1976_KANA:
|
||||
case SHIFTOUT:
|
||||
if (b1 > 0x5f) {
|
||||
return CoderResult.malformedForLength(inputSize);
|
||||
}
|
||||
dst.put((char)(b1 + 0xff40));
|
||||
break;
|
||||
}
|
||||
mark += inputSize;
|
||||
}
|
||||
return CoderResult.UNDERFLOW;
|
||||
} finally {
|
||||
src.position(mark);
|
||||
}
|
||||
}
|
||||
|
||||
// Make some protected methods public for use by JISAutoDetect
|
||||
public CoderResult decodeLoop(ByteBuffer src, CharBuffer dst) {
|
||||
if (src.hasArray() && dst.hasArray())
|
||||
return decodeArrayLoop(src, dst);
|
||||
else
|
||||
return decodeBufferLoop(src, dst);
|
||||
}
|
||||
|
||||
public CoderResult implFlush(CharBuffer out) {
|
||||
return super.implFlush(out);
|
||||
}
|
||||
}
|
||||
|
||||
static class Encoder extends CharsetEncoder {
|
||||
|
||||
final static DoubleByte.Encoder ENC0208 =
|
||||
(DoubleByte.Encoder)new JIS_X_0208().newEncoder();
|
||||
|
||||
private static byte[] repl = { (byte)0x21, (byte)0x29 };
|
||||
private int currentMode = ASCII;
|
||||
private int replaceMode = JISX0208_1983;
|
||||
private DoubleByte.Encoder enc0208;
|
||||
private DoubleByte.Encoder enc0212;
|
||||
private boolean doSBKANA;
|
||||
|
||||
private Encoder(Charset cs) {
|
||||
this(cs, ENC0208, null, true);
|
||||
}
|
||||
|
||||
Encoder(Charset cs,
|
||||
DoubleByte.Encoder enc0208,
|
||||
DoubleByte.Encoder enc0212,
|
||||
boolean doSBKANA) {
|
||||
super(cs, 4.0f, (enc0212 != null)? 9.0f : 8.0f, repl);
|
||||
this.enc0208 = enc0208;
|
||||
this.enc0212 = enc0212;
|
||||
this.doSBKANA = doSBKANA;
|
||||
}
|
||||
|
||||
protected int encodeSingle(char inputChar) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
protected void implReset() {
|
||||
currentMode = ASCII;
|
||||
}
|
||||
|
||||
protected void implReplaceWith(byte[] newReplacement) {
|
||||
/* It's almost impossible to decide which charset they belong
|
||||
to. The best thing we can do here is to "guess" based on
|
||||
the length of newReplacement.
|
||||
*/
|
||||
if (newReplacement.length == 1) {
|
||||
replaceMode = ASCII;
|
||||
} else if (newReplacement.length == 2) {
|
||||
replaceMode = JISX0208_1983;
|
||||
}
|
||||
}
|
||||
|
||||
protected CoderResult implFlush(ByteBuffer out) {
|
||||
if (currentMode != ASCII) {
|
||||
if (out.remaining() < 3)
|
||||
return CoderResult.OVERFLOW;
|
||||
out.put((byte)0x1b);
|
||||
out.put((byte)0x28);
|
||||
out.put((byte)0x42);
|
||||
currentMode = ASCII;
|
||||
}
|
||||
return CoderResult.UNDERFLOW;
|
||||
}
|
||||
|
||||
public boolean canEncode(char c) {
|
||||
return ((c <= '\u007F') ||
|
||||
(c >= 0xFF61 && c <= 0xFF9F) ||
|
||||
(c == '\u00A5') ||
|
||||
(c == '\u203E') ||
|
||||
enc0208.canEncode(c) ||
|
||||
(enc0212!=null && enc0212.canEncode(c)));
|
||||
}
|
||||
|
||||
private final Surrogate.Parser sgp = new Surrogate.Parser();
|
||||
|
||||
private CoderResult encodeArrayLoop(CharBuffer src,
|
||||
ByteBuffer dst)
|
||||
{
|
||||
char[] sa = src.array();
|
||||
int sp = src.arrayOffset() + src.position();
|
||||
int sl = src.arrayOffset() + src.limit();
|
||||
assert (sp <= sl);
|
||||
sp = (sp <= sl ? sp : sl);
|
||||
byte[] da = dst.array();
|
||||
int dp = dst.arrayOffset() + dst.position();
|
||||
int dl = dst.arrayOffset() + dst.limit();
|
||||
assert (dp <= dl);
|
||||
dp = (dp <= dl ? dp : dl);
|
||||
|
||||
try {
|
||||
while (sp < sl) {
|
||||
char c = sa[sp];
|
||||
if (c <= '\u007F') {
|
||||
if (currentMode != ASCII) {
|
||||
if (dl - dp < 3)
|
||||
return CoderResult.OVERFLOW;
|
||||
da[dp++] = (byte)0x1b;
|
||||
da[dp++] = (byte)0x28;
|
||||
da[dp++] = (byte)0x42;
|
||||
currentMode = ASCII;
|
||||
}
|
||||
if (dl - dp < 1)
|
||||
return CoderResult.OVERFLOW;
|
||||
da[dp++] = (byte)c;
|
||||
} else if (c >= 0xff61 && c <= 0xff9f && doSBKANA) {
|
||||
//a single byte kana
|
||||
if (currentMode != JISX0201_1976_KANA) {
|
||||
if (dl - dp < 3)
|
||||
return CoderResult.OVERFLOW;
|
||||
da[dp++] = (byte)0x1b;
|
||||
da[dp++] = (byte)0x28;
|
||||
da[dp++] = (byte)0x49;
|
||||
currentMode = JISX0201_1976_KANA;
|
||||
}
|
||||
if (dl - dp < 1)
|
||||
return CoderResult.OVERFLOW;
|
||||
da[dp++] = (byte)(c - 0xff40);
|
||||
} else if (c == '\u00A5' || c == '\u203E') {
|
||||
//backslash or tilde
|
||||
if (currentMode != JISX0201_1976) {
|
||||
if (dl - dp < 3)
|
||||
return CoderResult.OVERFLOW;
|
||||
da[dp++] = (byte)0x1b;
|
||||
da[dp++] = (byte)0x28;
|
||||
da[dp++] = (byte)0x4a;
|
||||
currentMode = JISX0201_1976;
|
||||
}
|
||||
if (dl - dp < 1)
|
||||
return CoderResult.OVERFLOW;
|
||||
da[dp++] = (c == '\u00A5')?(byte)0x5C:(byte)0x7e;
|
||||
} else {
|
||||
int index = enc0208.encodeChar(c);
|
||||
if (index != UNMAPPABLE_ENCODING) {
|
||||
if (currentMode != JISX0208_1983) {
|
||||
if (dl - dp < 3)
|
||||
return CoderResult.OVERFLOW;
|
||||
da[dp++] = (byte)0x1b;
|
||||
da[dp++] = (byte)0x24;
|
||||
da[dp++] = (byte)0x42;
|
||||
currentMode = JISX0208_1983;
|
||||
}
|
||||
if (dl - dp < 2)
|
||||
return CoderResult.OVERFLOW;
|
||||
da[dp++] = (byte)(index >> 8);
|
||||
da[dp++] = (byte)(index & 0xff);
|
||||
} else if (enc0212 != null &&
|
||||
(index = enc0212.encodeChar(c)) != UNMAPPABLE_ENCODING) {
|
||||
if (currentMode != JISX0212_1990) {
|
||||
if (dl - dp < 4)
|
||||
return CoderResult.OVERFLOW;
|
||||
da[dp++] = (byte)0x1b;
|
||||
da[dp++] = (byte)0x24;
|
||||
da[dp++] = (byte)0x28;
|
||||
da[dp++] = (byte)0x44;
|
||||
currentMode = JISX0212_1990;
|
||||
}
|
||||
if (dl - dp < 2)
|
||||
return CoderResult.OVERFLOW;
|
||||
da[dp++] = (byte)(index >> 8);
|
||||
da[dp++] = (byte)(index & 0xff);
|
||||
} else {
|
||||
if (Character.isSurrogate(c) && sgp.parse(c, sa, sp, sl) < 0)
|
||||
return sgp.error();
|
||||
if (unmappableCharacterAction()
|
||||
== CodingErrorAction.REPLACE
|
||||
&& currentMode != replaceMode) {
|
||||
if (dl - dp < 3)
|
||||
return CoderResult.OVERFLOW;
|
||||
if (replaceMode == ASCII) {
|
||||
da[dp++] = (byte)0x1b;
|
||||
da[dp++] = (byte)0x28;
|
||||
da[dp++] = (byte)0x42;
|
||||
} else {
|
||||
da[dp++] = (byte)0x1b;
|
||||
da[dp++] = (byte)0x24;
|
||||
da[dp++] = (byte)0x42;
|
||||
}
|
||||
currentMode = replaceMode;
|
||||
}
|
||||
if (Character.isSurrogate(c))
|
||||
return sgp.unmappableResult();
|
||||
return CoderResult.unmappableForLength(1);
|
||||
}
|
||||
}
|
||||
sp++;
|
||||
}
|
||||
return CoderResult.UNDERFLOW;
|
||||
} finally {
|
||||
src.position(sp - src.arrayOffset());
|
||||
dst.position(dp - dst.arrayOffset());
|
||||
}
|
||||
}
|
||||
|
||||
private CoderResult encodeBufferLoop(CharBuffer src,
|
||||
ByteBuffer dst)
|
||||
{
|
||||
int mark = src.position();
|
||||
try {
|
||||
while (src.hasRemaining()) {
|
||||
char c = src.get();
|
||||
|
||||
if (c <= '\u007F') {
|
||||
if (currentMode != ASCII) {
|
||||
if (dst.remaining() < 3)
|
||||
return CoderResult.OVERFLOW;
|
||||
dst.put((byte)0x1b);
|
||||
dst.put((byte)0x28);
|
||||
dst.put((byte)0x42);
|
||||
currentMode = ASCII;
|
||||
}
|
||||
if (dst.remaining() < 1)
|
||||
return CoderResult.OVERFLOW;
|
||||
dst.put((byte)c);
|
||||
} else if (c >= 0xff61 && c <= 0xff9f && doSBKANA) {
|
||||
//Is it a single byte kana?
|
||||
if (currentMode != JISX0201_1976_KANA) {
|
||||
if (dst.remaining() < 3)
|
||||
return CoderResult.OVERFLOW;
|
||||
dst.put((byte)0x1b);
|
||||
dst.put((byte)0x28);
|
||||
dst.put((byte)0x49);
|
||||
currentMode = JISX0201_1976_KANA;
|
||||
}
|
||||
if (dst.remaining() < 1)
|
||||
return CoderResult.OVERFLOW;
|
||||
dst.put((byte)(c - 0xff40));
|
||||
} else if (c == '\u00a5' || c == '\u203E') {
|
||||
if (currentMode != JISX0201_1976) {
|
||||
if (dst.remaining() < 3)
|
||||
return CoderResult.OVERFLOW;
|
||||
dst.put((byte)0x1b);
|
||||
dst.put((byte)0x28);
|
||||
dst.put((byte)0x4a);
|
||||
currentMode = JISX0201_1976;
|
||||
}
|
||||
if (dst.remaining() < 1)
|
||||
return CoderResult.OVERFLOW;
|
||||
dst.put((c == '\u00A5')?(byte)0x5C:(byte)0x7e);
|
||||
} else {
|
||||
int index = enc0208.encodeChar(c);
|
||||
if (index != UNMAPPABLE_ENCODING) {
|
||||
if (currentMode != JISX0208_1983) {
|
||||
if (dst.remaining() < 3)
|
||||
return CoderResult.OVERFLOW;
|
||||
dst.put((byte)0x1b);
|
||||
dst.put((byte)0x24);
|
||||
dst.put((byte)0x42);
|
||||
currentMode = JISX0208_1983;
|
||||
}
|
||||
if (dst.remaining() < 2)
|
||||
return CoderResult.OVERFLOW;
|
||||
dst.put((byte)(index >> 8));
|
||||
dst.put((byte)(index & 0xff));
|
||||
} else if (enc0212 != null &&
|
||||
(index = enc0212.encodeChar(c)) != UNMAPPABLE_ENCODING) {
|
||||
if (currentMode != JISX0212_1990) {
|
||||
if (dst.remaining() < 4)
|
||||
return CoderResult.OVERFLOW;
|
||||
dst.put((byte)0x1b);
|
||||
dst.put((byte)0x24);
|
||||
dst.put((byte)0x28);
|
||||
dst.put((byte)0x44);
|
||||
currentMode = JISX0212_1990;
|
||||
}
|
||||
if (dst.remaining() < 2)
|
||||
return CoderResult.OVERFLOW;
|
||||
dst.put((byte)(index >> 8));
|
||||
dst.put((byte)(index & 0xff));
|
||||
} else {
|
||||
if (Character.isSurrogate(c) && sgp.parse(c, src) < 0)
|
||||
return sgp.error();
|
||||
if (unmappableCharacterAction() == CodingErrorAction.REPLACE
|
||||
&& currentMode != replaceMode) {
|
||||
if (dst.remaining() < 3)
|
||||
return CoderResult.OVERFLOW;
|
||||
if (replaceMode == ASCII) {
|
||||
dst.put((byte)0x1b);
|
||||
dst.put((byte)0x28);
|
||||
dst.put((byte)0x42);
|
||||
} else {
|
||||
dst.put((byte)0x1b);
|
||||
dst.put((byte)0x24);
|
||||
dst.put((byte)0x42);
|
||||
}
|
||||
currentMode = replaceMode;
|
||||
}
|
||||
if (Character.isSurrogate(c))
|
||||
return sgp.unmappableResult();
|
||||
return CoderResult.unmappableForLength(1);
|
||||
}
|
||||
}
|
||||
mark++;
|
||||
}
|
||||
return CoderResult.UNDERFLOW;
|
||||
} finally {
|
||||
src.position(mark);
|
||||
}
|
||||
}
|
||||
|
||||
protected CoderResult encodeLoop(CharBuffer src,
|
||||
ByteBuffer dst)
|
||||
{
|
||||
if (src.hasArray() && dst.hasArray())
|
||||
return encodeArrayLoop(src, dst);
|
||||
else
|
||||
return encodeBufferLoop(src, dst);
|
||||
}
|
||||
}
|
||||
}
|
||||
63
jdkSrc/jdk8/sun/nio/cs/ext/ISO2022_JP_2.java
Normal file
63
jdkSrc/jdk8/sun/nio/cs/ext/ISO2022_JP_2.java
Normal file
@@ -0,0 +1,63 @@
|
||||
/*
|
||||
* Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package sun.nio.cs.ext;
|
||||
|
||||
import java.nio.charset.Charset;
|
||||
import java.nio.charset.CharsetDecoder;
|
||||
import java.nio.charset.CharsetEncoder;
|
||||
|
||||
public class ISO2022_JP_2 extends ISO2022_JP
|
||||
{
|
||||
public ISO2022_JP_2() {
|
||||
super("ISO-2022-JP-2",
|
||||
ExtendedCharsets.aliasesFor("ISO-2022-JP-2"));
|
||||
}
|
||||
|
||||
public String historicalName() {
|
||||
return "ISO2022JP2";
|
||||
}
|
||||
|
||||
public boolean contains(Charset cs) {
|
||||
return super.contains(cs) ||
|
||||
(cs instanceof JIS_X_0212) ||
|
||||
(cs instanceof ISO2022_JP_2);
|
||||
}
|
||||
|
||||
public CharsetDecoder newDecoder() {
|
||||
return new Decoder(this, Decoder.DEC0208, CoderHolder.DEC0212);
|
||||
}
|
||||
|
||||
public CharsetEncoder newEncoder() {
|
||||
return new Encoder(this, Encoder.ENC0208, CoderHolder.ENC0212, true);
|
||||
}
|
||||
|
||||
private static class CoderHolder {
|
||||
final static DoubleByte.Decoder DEC0212 =
|
||||
(DoubleByte.Decoder)new JIS_X_0212().newDecoder();
|
||||
final static DoubleByte.Encoder ENC0212 =
|
||||
(DoubleByte.Encoder)new JIS_X_0212().newEncoder();
|
||||
}
|
||||
}
|
||||
98
jdkSrc/jdk8/sun/nio/cs/ext/ISO2022_KR.java
Normal file
98
jdkSrc/jdk8/sun/nio/cs/ext/ISO2022_KR.java
Normal file
@@ -0,0 +1,98 @@
|
||||
/*
|
||||
* Copyright (c) 2002, 2006, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
/*
|
||||
*/
|
||||
|
||||
package sun.nio.cs.ext;
|
||||
|
||||
import java.nio.charset.Charset;
|
||||
import java.nio.ByteBuffer;
|
||||
import java.nio.CharBuffer;
|
||||
import java.nio.charset.CharsetDecoder;
|
||||
import java.nio.charset.CharsetEncoder;
|
||||
import java.nio.charset.CoderResult;
|
||||
import sun.nio.cs.HistoricallyNamedCharset;
|
||||
import sun.nio.cs.ext.EUC_KR;
|
||||
|
||||
public class ISO2022_KR extends ISO2022
|
||||
implements HistoricallyNamedCharset
|
||||
{
|
||||
private static Charset ksc5601_cs;
|
||||
|
||||
public ISO2022_KR() {
|
||||
super("ISO-2022-KR", ExtendedCharsets.aliasesFor("ISO-2022-KR"));
|
||||
ksc5601_cs = new EUC_KR();
|
||||
}
|
||||
|
||||
public boolean contains(Charset cs) {
|
||||
// overlapping repertoire of EUC_KR, aka KSC5601
|
||||
return ((cs instanceof EUC_KR) ||
|
||||
(cs.name().equals("US-ASCII")) ||
|
||||
(cs instanceof ISO2022_KR));
|
||||
}
|
||||
|
||||
public String historicalName() {
|
||||
return "ISO2022KR";
|
||||
}
|
||||
|
||||
public CharsetDecoder newDecoder() {
|
||||
return new Decoder(this);
|
||||
}
|
||||
|
||||
public CharsetEncoder newEncoder() {
|
||||
return new Encoder(this);
|
||||
}
|
||||
|
||||
private static class Decoder extends ISO2022.Decoder {
|
||||
public Decoder(Charset cs)
|
||||
{
|
||||
super(cs);
|
||||
SODesig = new byte[][] {{(byte)'$', (byte)')', (byte)'C'}};
|
||||
SODecoder = new CharsetDecoder[1];
|
||||
|
||||
try {
|
||||
SODecoder[0] = ksc5601_cs.newDecoder();
|
||||
} catch (Exception e) {};
|
||||
}
|
||||
}
|
||||
|
||||
private static class Encoder extends ISO2022.Encoder {
|
||||
|
||||
public Encoder(Charset cs)
|
||||
{
|
||||
super(cs);
|
||||
SODesig = "$)C";
|
||||
|
||||
try {
|
||||
ISOEncoder = ksc5601_cs.newEncoder();
|
||||
} catch (Exception e) { }
|
||||
}
|
||||
|
||||
public boolean canEncode(char c) {
|
||||
return (ISOEncoder.canEncode(c));
|
||||
}
|
||||
}
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user