8261254: Initialize charset mapping data lazily
Reviewed-by: alanb, jkuhn, naoto
This commit is contained in:
parent
351d788809
commit
92c6e6dffa
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2009, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2009, 2021, 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
|
||||
@ -49,26 +49,19 @@ public class $NAME_CLZ$ extends Charset
|
||||
}
|
||||
|
||||
public CharsetDecoder newDecoder() {
|
||||
initb2c();
|
||||
return new DoubleByte.Decoder$DECTYPE$(this, b2c, b2cSB, $B2MIN$, $B2MAX$, $ASCIICOMPATIBLE$);
|
||||
return new DoubleByte.Decoder$DECTYPE$(this, DecodeHolder.b2c, DecodeHolder.b2cSB, $B2MIN$, $B2MAX$, $ASCIICOMPATIBLE$);
|
||||
}
|
||||
|
||||
public CharsetEncoder newEncoder() {
|
||||
initc2b();
|
||||
return new DoubleByte.Encoder$ENCTYPE$(this, $ENC_REPLACEMENT$ c2b, c2bIndex, $ASCIICOMPATIBLE$);
|
||||
return new DoubleByte.Encoder$ENCTYPE$(this, $ENC_REPLACEMENT$ EncodeHolder.c2b, EncodeHolder.c2bIndex, $ASCIICOMPATIBLE$);
|
||||
}
|
||||
|
||||
$B2C$
|
||||
static char[][] b2c = new char[b2cStr.length][];
|
||||
static char[] b2cSB;
|
||||
private static volatile boolean b2cInitialized = false;
|
||||
static class DecodeHolder {
|
||||
$B2C$
|
||||
static final char[][] b2c = new char[b2cStr.length][];
|
||||
static final char[] b2cSB;
|
||||
|
||||
static void initb2c() {
|
||||
if (b2cInitialized)
|
||||
return;
|
||||
synchronized (b2c) {
|
||||
if (b2cInitialized)
|
||||
return;
|
||||
static {
|
||||
for (int i = 0; i < b2cStr.length; i++) {
|
||||
if (b2cStr[i] == null)
|
||||
b2c[i] = DoubleByte.B2C_UNMAPPABLE;
|
||||
@ -76,26 +69,20 @@ public class $NAME_CLZ$ extends Charset
|
||||
b2c[i] = b2cStr[i].toCharArray();
|
||||
}
|
||||
b2cSB = b2cSBStr.toCharArray();
|
||||
b2cInitialized = true;
|
||||
}
|
||||
}
|
||||
|
||||
static char[] c2b = new char[$C2BLENGTH$];
|
||||
static char[] c2bIndex = new char[0x100];
|
||||
private static volatile boolean c2bInitialized = false;
|
||||
static class EncodeHolder {
|
||||
static final char[] c2b = new char[$C2BLENGTH$];
|
||||
static final char[] c2bIndex = new char[0x100];
|
||||
|
||||
static void initc2b() {
|
||||
if (c2bInitialized)
|
||||
return;
|
||||
synchronized (c2b) {
|
||||
if (c2bInitialized)
|
||||
return;
|
||||
static {
|
||||
$NONROUNDTRIP_B2C$
|
||||
$NONROUNDTRIP_C2B$
|
||||
DoubleByte.Encoder.initC2B(b2cStr, b2cSBStr, b2cNR, c2bNR,
|
||||
DoubleByte.Encoder.initC2B(DecodeHolder.b2cStr, DecodeHolder.b2cSBStr,
|
||||
b2cNR, c2bNR,
|
||||
$B2MIN$, $B2MAX$,
|
||||
c2b, c2bIndex);
|
||||
c2bInitialized = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2008, 2019, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2008, 2021, 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
|
||||
@ -48,24 +48,26 @@ public class $NAME_CLZ$ extends Charset implements HistoricallyNamedCharset
|
||||
}
|
||||
|
||||
public CharsetDecoder newDecoder() {
|
||||
return new SingleByte.Decoder(this, b2c, $ASCIICOMPATIBLE$, $LATIN1DECODABLE$);
|
||||
return new SingleByte.Decoder(this, Holder.b2c, $ASCIICOMPATIBLE$, $LATIN1DECODABLE$);
|
||||
}
|
||||
|
||||
public CharsetEncoder newEncoder() {
|
||||
return new SingleByte.Encoder(this, c2b, c2bIndex, $ASCIICOMPATIBLE$);
|
||||
return new SingleByte.Encoder(this, Holder.c2b, Holder.c2bIndex, $ASCIICOMPATIBLE$);
|
||||
}
|
||||
|
||||
private final static String b2cTable = $B2CTABLE$
|
||||
private static class Holder {
|
||||
private static final String b2cTable = $B2CTABLE$
|
||||
|
||||
private final static char[] b2c = b2cTable.toCharArray();
|
||||
private final static char[] c2b = new char[$C2BLENGTH$];
|
||||
private final static char[] c2bIndex = new char[0x100];
|
||||
private static final char[] b2c = b2cTable.toCharArray();
|
||||
private static final char[] c2b = new char[$C2BLENGTH$];
|
||||
private static final char[] c2bIndex = new char[0x100];
|
||||
|
||||
static {
|
||||
char[] b2cMap = b2c;
|
||||
char[] c2bNR = null;
|
||||
$NONROUNDTRIP_B2C$
|
||||
$NONROUNDTRIP_C2B$
|
||||
SingleByte.initC2B(b2cMap, c2bNR, c2b, c2bIndex);
|
||||
static {
|
||||
char[] b2cMap = b2c;
|
||||
char[] c2bNR = null;
|
||||
$NONROUNDTRIP_B2C$
|
||||
$NONROUNDTRIP_C2B$
|
||||
SingleByte.initC2B(b2cMap, c2bNR, c2b, c2bIndex);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2014, 2020, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2014, 2021, 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
|
||||
@ -931,7 +931,9 @@ public final class ModuleLayer {
|
||||
servicesCatalog = this.servicesCatalog;
|
||||
if (servicesCatalog == null) {
|
||||
servicesCatalog = ServicesCatalog.create();
|
||||
nameToModule.values().forEach(servicesCatalog::register);
|
||||
for (Module m : nameToModule.values()) {
|
||||
servicesCatalog.register(m);
|
||||
}
|
||||
this.servicesCatalog = servicesCatalog;
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2000, 2021, 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
|
||||
@ -68,11 +68,11 @@ public class AbstractCharsetProvider
|
||||
private String packagePrefix;
|
||||
|
||||
protected AbstractCharsetProvider() {
|
||||
packagePrefix = "sun.nio.cs";
|
||||
packagePrefix = "sun.nio.cs.";
|
||||
}
|
||||
|
||||
protected AbstractCharsetProvider(String pkgPrefixName) {
|
||||
packagePrefix = pkgPrefixName;
|
||||
packagePrefix = pkgPrefixName.concat(".");
|
||||
}
|
||||
|
||||
/* Add an entry to the given map, but only if no mapping yet exists
|
||||
@ -144,7 +144,7 @@ public class AbstractCharsetProvider
|
||||
// Instantiate the charset and cache it
|
||||
try {
|
||||
|
||||
Class<?> c = Class.forName(packagePrefix + "." + cln,
|
||||
Class<?> c = Class.forName(packagePrefix.concat(cln),
|
||||
true,
|
||||
this.getClass().getClassLoader());
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2010, 2021, 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
|
||||
@ -59,11 +59,11 @@ public class Big5_HKSCS extends Charset implements HistoricallyNamedCharset
|
||||
}
|
||||
|
||||
static class Decoder extends HKSCS.Decoder {
|
||||
private static DoubleByte.Decoder big5 =
|
||||
private static final DoubleByte.Decoder big5 =
|
||||
(DoubleByte.Decoder)new Big5().newDecoder();
|
||||
|
||||
private static char[][] b2cBmp = new char[0x100][];
|
||||
private static char[][] b2cSupp = new char[0x100][];
|
||||
private static final char[][] b2cBmp = new char[0x100][];
|
||||
private static final char[][] b2cSupp = new char[0x100][];
|
||||
static {
|
||||
initb2c(b2cBmp, HKSCSMapping.b2cBmpStr);
|
||||
initb2c(b2cSupp, HKSCSMapping.b2cSuppStr);
|
||||
@ -75,11 +75,11 @@ public class Big5_HKSCS extends Charset implements HistoricallyNamedCharset
|
||||
}
|
||||
|
||||
static class Encoder extends HKSCS.Encoder {
|
||||
private static DoubleByte.Encoder big5 =
|
||||
private static final DoubleByte.Encoder big5 =
|
||||
(DoubleByte.Encoder)new Big5().newEncoder();
|
||||
|
||||
static char[][] c2bBmp = new char[0x100][];
|
||||
static char[][] c2bSupp = new char[0x100][];
|
||||
static final char[][] c2bBmp = new char[0x100][];
|
||||
static final char[][] c2bSupp = new char[0x100][];
|
||||
static {
|
||||
initc2b(c2bBmp, HKSCSMapping.b2cBmpStr, HKSCSMapping.pua);
|
||||
initc2b(c2bSupp, HKSCSMapping.b2cSuppStr, null);
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2002, 2010, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2002, 2021, 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
|
||||
@ -56,8 +56,8 @@ public class Big5_HKSCS_2001 extends Charset
|
||||
private static DoubleByte.Decoder big5 =
|
||||
(DoubleByte.Decoder)new Big5().newDecoder();
|
||||
|
||||
private static char[][] b2cBmp = new char[0x100][];
|
||||
private static char[][] b2cSupp = new char[0x100][];
|
||||
private static final char[][] b2cBmp = new char[0x100][];
|
||||
private static final char[][] b2cSupp = new char[0x100][];
|
||||
static {
|
||||
initb2c(b2cBmp, HKSCS2001Mapping.b2cBmpStr);
|
||||
initb2c(b2cSupp, HKSCS2001Mapping.b2cSuppStr);
|
||||
@ -72,8 +72,8 @@ public class Big5_HKSCS_2001 extends Charset
|
||||
private static DoubleByte.Encoder big5 =
|
||||
(DoubleByte.Encoder)new Big5().newEncoder();
|
||||
|
||||
static char[][] c2bBmp = new char[0x100][];
|
||||
static char[][] c2bSupp = new char[0x100][];
|
||||
static final char[][] c2bBmp = new char[0x100][];
|
||||
static final char[][] c2bSupp = new char[0x100][];
|
||||
static {
|
||||
initc2b(c2bBmp, HKSCS2001Mapping.b2cBmpStr,
|
||||
HKSCS2001Mapping.pua);
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2004, 2010, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2004, 2021, 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
|
||||
@ -50,27 +50,21 @@ public class Big5_Solaris extends Charset implements HistoricallyNamedCharset
|
||||
}
|
||||
|
||||
public CharsetDecoder newDecoder() {
|
||||
initb2c();
|
||||
return new DoubleByte.Decoder(this, b2c, b2cSB, 0x40, 0xfe, true);
|
||||
return new DoubleByte.Decoder(this, Holder.b2c, Holder.b2cSB, 0x40, 0xfe, true);
|
||||
}
|
||||
|
||||
public CharsetEncoder newEncoder() {
|
||||
initc2b();
|
||||
return new DoubleByte.Encoder(this, c2b, c2bIndex, true);
|
||||
return new DoubleByte.Encoder(this, Holder.c2b, Holder.c2bIndex, true);
|
||||
}
|
||||
|
||||
static char[][] b2c;
|
||||
static char[] b2cSB;
|
||||
private static volatile boolean b2cInitialized = false;
|
||||
private static class Holder {
|
||||
static final char[][] b2c;
|
||||
static final char[] b2cSB;
|
||||
static final char[] c2b;
|
||||
static final char[] c2bIndex;
|
||||
|
||||
static void initb2c() {
|
||||
if (b2cInitialized)
|
||||
return;
|
||||
synchronized (Big5_Solaris.class) {
|
||||
if (b2cInitialized)
|
||||
return;
|
||||
Big5.initb2c();
|
||||
b2c = Big5.b2c.clone();
|
||||
static {
|
||||
b2c = Big5.DecodeHolder.b2c.clone();
|
||||
// Big5 Solaris implementation has 7 additional mappings
|
||||
int[] sol = new int[] {
|
||||
0xF9D6, 0x7881,
|
||||
@ -88,25 +82,11 @@ public class Big5_Solaris extends Charset implements HistoricallyNamedCharset
|
||||
for (int i = 0; i < sol.length;) {
|
||||
b2c[0xf9][sol[i++] & 0xff - 0x40] = (char)sol[i++];
|
||||
}
|
||||
b2cSB = Big5.b2cSB;
|
||||
b2cInitialized = true;
|
||||
}
|
||||
}
|
||||
b2cSB = Big5.DecodeHolder.b2cSB;
|
||||
|
||||
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[] {
|
||||
c2b = Big5.EncodeHolder.c2b.clone();
|
||||
c2bIndex = Big5.EncodeHolder.c2bIndex.clone();
|
||||
sol = new int[] {
|
||||
0x7881, 0xF9D6,
|
||||
0x92B9, 0xF9D7,
|
||||
0x88CF, 0xF9D8,
|
||||
@ -121,7 +101,6 @@ public class Big5_Solaris extends Charset implements HistoricallyNamedCharset
|
||||
// to the appropriate place.
|
||||
c2b[c2bIndex[c >> 8] + (c & 0xff)] = (char)sol[i++];
|
||||
}
|
||||
c2bInitialized = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2002, 2019, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2002, 2021, 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
|
||||
@ -67,23 +67,23 @@ public class IBM29626C
|
||||
static class Decoder extends CharsetDecoder
|
||||
implements DelegatableDecoder {
|
||||
|
||||
final static SingleByte.Decoder DEC0201 =
|
||||
static final SingleByte.Decoder DEC0201 =
|
||||
(SingleByte.Decoder)new JIS_X_0201().newDecoder();
|
||||
|
||||
final static DoubleByte.Decoder DEC0208 =
|
||||
static final DoubleByte.Decoder DEC0208 =
|
||||
(DoubleByte.Decoder)new JIS_X_0208().newDecoder();
|
||||
|
||||
final static DoubleByte.Decoder DEC0212 =
|
||||
static final DoubleByte.Decoder DEC0212 =
|
||||
(DoubleByte.Decoder)new JIS_X_0212().newDecoder();
|
||||
|
||||
final static DoubleByte.Encoder ibm943 =
|
||||
static final DoubleByte.Encoder ibm943 =
|
||||
(DoubleByte.Encoder)new IBM943().newEncoder();
|
||||
|
||||
private final SingleByte.Decoder dec0201;
|
||||
private final DoubleByte.Decoder dec0208;
|
||||
private final DoubleByte.Decoder dec0212;
|
||||
|
||||
private final String G2_b =
|
||||
private static final String G2_b =
|
||||
"\uA1F1\uA1F2\uA2CC\uADA1\uADA2\uADA3\uADA4\uADA5\uADA6\uADA7"+
|
||||
"\uADA8\uADA9\uADAA\uADAB\uADAC\uADAD\uADAE\uADAF\uADB0\uADB1"+
|
||||
"\uADB2\uADB3\uADB4\uADB5\uADB6\uADB7\uADB8\uADB9\uADBA\uADBB"+
|
||||
@ -94,7 +94,7 @@ public class IBM29626C
|
||||
"\uADED\uADEE\uADEF\uADF0\uADF1\uADF2\uADF3\uADF4\uADF5\uADF6"+
|
||||
"\uADF7\uADF8\uADF9\uADFA\uADFB\uADFC";
|
||||
|
||||
private final String G2_c =
|
||||
private static final String G2_c =
|
||||
"\uFFE0\uFFE1\uFFE2\u2460\u2461\u2462\u2463\u2464\u2465\u2466"+
|
||||
"\u2467\u2468\u2469\u246A\u246B\u246C\u246D\u246E\u246F\u2470"+
|
||||
"\u2471\u2472\u2473\u2160\u2161\u2162\u2163\u2164\u2165\u2166"+
|
||||
@ -105,7 +105,7 @@ public class IBM29626C
|
||||
"\u337E\u337D\u337C\u2252\u2261\u222B\u222E\u2211\u221A\u22A5"+
|
||||
"\u2220\u221F\u22BF\u2235\u2229\u222A";
|
||||
|
||||
private final String G3_b =
|
||||
private static final String G3_b =
|
||||
"\uF3B8\uF3B9\uF3AB\uF3AC\uF3AD\uF3AE\uF3AF\uF3B0\uF3B1\uF3B2"+
|
||||
"\uF3B3\uF3B4\uF3A1\uF3A2\uF3A3\uF3A4\uF3A5\uF3A6\uF3A7\uF3A8"+
|
||||
"\uF3A9\uF3AA\uF3B7\uF3B8\uF4A2\uF4A3\uF4A4\uF4A5\uF4A6\uF4A8"+
|
||||
@ -118,7 +118,7 @@ public class IBM29626C
|
||||
"\uF4D6\uF4D8\uF4DA\uF4DB\uF4DE\uF4E2\uF4E3\uF4E4\uF4E6\uF4E8"+
|
||||
"\uF4E9\uF4EC\uF4F1\uF4F2\uF4F3\uF4F7\uF3B6\uF3B5";
|
||||
|
||||
private final String G3_c =
|
||||
private static final String G3_c =
|
||||
"\u2116\u2121\u2160\u2161\u2162\u2163\u2164\u2165\u2166\u2167"+
|
||||
"\u2168\u2169\u2170\u2171\u2172\u2173\u2174\u2175\u2176\u2177"+
|
||||
"\u2178\u2179\u3231\u00A6\u4EFC\u50F4\u51EC\u5307\u5324\u548A"+
|
||||
@ -164,7 +164,7 @@ public class IBM29626C
|
||||
return UNMAPPABLE_DECODING;
|
||||
}
|
||||
|
||||
final static String g1_c = "\u00a2\u00a3\u00ac\\\u007e";
|
||||
static final String g1_c = "\u00a2\u00a3\u00ac\\\u007e";
|
||||
|
||||
protected char decodeDouble(int byte1, int byte2) {
|
||||
if (byte1 == 0x8e) {
|
||||
@ -322,16 +322,16 @@ public class IBM29626C
|
||||
|
||||
static class Encoder extends CharsetEncoder {
|
||||
|
||||
final static SingleByte.Encoder ENC0201 =
|
||||
static final SingleByte.Encoder ENC0201 =
|
||||
(SingleByte.Encoder)new JIS_X_0201().newEncoder();
|
||||
|
||||
final static DoubleByte.Encoder ENC0208 =
|
||||
static final DoubleByte.Encoder ENC0208 =
|
||||
(DoubleByte.Encoder)new JIS_X_0208().newEncoder();
|
||||
|
||||
final static DoubleByte.Encoder ENC0212 =
|
||||
static final DoubleByte.Encoder ENC0212 =
|
||||
(DoubleByte.Encoder)new JIS_X_0212().newEncoder();
|
||||
|
||||
final static DoubleByte.Encoder ibm943 =
|
||||
static final DoubleByte.Encoder ibm943 =
|
||||
(DoubleByte.Encoder)new IBM943().newEncoder();
|
||||
|
||||
private final Surrogate.Parser sgp = new Surrogate.Parser();
|
||||
@ -340,7 +340,7 @@ public class IBM29626C
|
||||
private final DoubleByte.Encoder enc0208;
|
||||
private final DoubleByte.Encoder enc0212;
|
||||
|
||||
private final String G2_c =
|
||||
private static final String G2_c =
|
||||
"\u2015\u2211\u221F\u2225\u222E\u22BF\u2460\u2461\u2462\u2463"+
|
||||
"\u2464\u2465\u2466\u2467\u2468\u2469\u246A\u246B\u246C\u246D"+
|
||||
"\u246E\u246F\u2470\u2471\u2472\u2473\u301D\u301F\u3232\u3239"+
|
||||
@ -353,7 +353,7 @@ public class IBM29626C
|
||||
"\u881F\u8EC0\u91AC\u91B1\u9830\u9839\u985A\u9A52\u9DD7\u9E7C"+
|
||||
"\u9EB4\u9EB5\uFF0D\uFF5E\uFFE0\uFFE1\uFFE2";
|
||||
|
||||
private final String G2_b =
|
||||
private static final String G2_b =
|
||||
"\uA1BD\uADF4\uADF8\uA1C2\uADF3\uADF9\uADA1\uADA2\uADA3\uADA4"+
|
||||
"\uADA5\uADA6\uADA7\uADA8\uADA9\uADAA\uADAB\uADAC\uADAD\uADAE"+
|
||||
"\uADAF\uADB0\uADB1\uADB2\uADB3\uADB4\uADE0\uADE1\uADEB\uADEC"+
|
||||
@ -366,7 +366,7 @@ public class IBM29626C
|
||||
"\uCFB9\uB6ED\uBEDF\uC8B0\uCBCB\uF0F8\uC5BF\uC2CD\uB2AA\uB8B4"+
|
||||
"\uB9ED\uCCCD\uA1DD\uA1C1\uA1F1\uA1F2\uA2CC";
|
||||
|
||||
private final String G3_c =
|
||||
private static final String G3_c =
|
||||
"\u2116\u2121\u2160\u2161\u2162\u2163\u2164\u2165\u2166\u2167"+
|
||||
"\u2168\u2169\u2170\u2171\u2172\u2173\u2174\u2175\u2176\u2177"+
|
||||
"\u2178\u2179\u3231\u4EFC\u50F4\u51EC\u5307\u5324\u548A\u5759"+
|
||||
@ -379,7 +379,7 @@ public class IBM29626C
|
||||
"\uFA1F\uFA20\uFA21\uFA22\uFA23\uFA24\uFA25\uFA26\uFA27\uFA28"+
|
||||
"\uFA29\uFA2A\uFA2B\uFA2C\uFA2D\uFF02\uFF07\uFFE4";
|
||||
|
||||
private final String G3_b =
|
||||
private static final String G3_b =
|
||||
"\uF3B8\uF3B9\uF3AB\uF3AC\uF3AD\uF3AE\uF3AF\uF3B0\uF3B1\uF3B2"+
|
||||
"\uF3B3\uF3B4\uF3A1\uF3A2\uF3A3\uF3A4\uF3A5\uF3A6\uF3A7\uF3A8"+
|
||||
"\uF3A9\uF3AA\uF3B7\uF4A2\uF4A3\uF4A4\uF4A5\uF4A6\uF4A8\uF4A9"+
|
||||
@ -412,7 +412,7 @@ public class IBM29626C
|
||||
encodeDouble(c) != UNMAPPABLE_ENCODING;
|
||||
}
|
||||
|
||||
private final static String G1_c = "\u00A2\u00A3\u00AC";
|
||||
private static final String G1_c = "\u00A2\u00A3\u00AC";
|
||||
|
||||
protected int encodeSingle(char inputChar, byte[] outputByte) {
|
||||
if (inputChar >= 0x80 && inputChar < 0x8e) {
|
||||
|
@ -1,6 +1,5 @@
|
||||
|
||||
/*
|
||||
* Copyright (c) 2006, 2020, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2006, 2021, 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
|
||||
@ -49,20 +48,18 @@ public class IBM834 extends Charset
|
||||
}
|
||||
|
||||
public CharsetDecoder newDecoder() {
|
||||
IBM933.initb2c();
|
||||
return new DoubleByte.Decoder_DBCSONLY(
|
||||
this, IBM933.b2c, null, 0x40, 0xfe); // hardcode the b2min/max
|
||||
this, IBM933.DecodeHolder.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, false);
|
||||
IBM933.EncodeHolder.c2b, IBM933.EncodeHolder.c2bIndex, false);
|
||||
}
|
||||
|
||||
public int encodeChar(char ch) {
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2003, 2021, 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
|
||||
@ -50,44 +50,43 @@ public class IBM942C extends Charset implements HistoricallyNamedCharset
|
||||
|
||||
public CharsetDecoder newDecoder() {
|
||||
return new DoubleByte.Decoder(this,
|
||||
IBM942.b2c,
|
||||
b2cSB,
|
||||
IBM942.DecodeHolder.b2c,
|
||||
Holder.b2cSB,
|
||||
0x40,
|
||||
0xfc);
|
||||
}
|
||||
|
||||
public CharsetEncoder newEncoder() {
|
||||
return new DoubleByte.Encoder(this, c2b, c2bIndex);
|
||||
return new DoubleByte.Encoder(this, Holder.c2b, Holder.c2bIndex);
|
||||
}
|
||||
|
||||
final static char[] b2cSB;
|
||||
final static char[] c2b;
|
||||
final static char[] c2bIndex;
|
||||
private static class Holder {
|
||||
static final char[] b2cSB;
|
||||
static final char[] c2b;
|
||||
static final char[] c2bIndex;
|
||||
|
||||
static {
|
||||
IBM942.initb2c();
|
||||
static {
|
||||
// the mappings need udpate are
|
||||
// u+001a <-> 0x1a
|
||||
// u+001c <-> 0x1c
|
||||
// u+005c <-> 0x5c
|
||||
// u+007e <-> 0x7e
|
||||
// u+007f <-> 0x7f
|
||||
|
||||
// the mappings need udpate are
|
||||
// u+001a <-> 0x1a
|
||||
// u+001c <-> 0x1c
|
||||
// u+005c <-> 0x5c
|
||||
// u+007e <-> 0x7e
|
||||
// u+007f <-> 0x7f
|
||||
b2cSB = Arrays.copyOf(IBM942.DecodeHolder.b2cSB, IBM942.DecodeHolder.b2cSB.length);
|
||||
b2cSB[0x1a] = 0x1a;
|
||||
b2cSB[0x1c] = 0x1c;
|
||||
b2cSB[0x5c] = 0x5c;
|
||||
b2cSB[0x7e] = 0x7e;
|
||||
b2cSB[0x7f] = 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;
|
||||
c2b = Arrays.copyOf(IBM942.EncodeHolder.c2b, IBM942.EncodeHolder.c2b.length);
|
||||
c2bIndex = Arrays.copyOf(IBM942.EncodeHolder.c2bIndex, IBM942.EncodeHolder.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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2003, 2021, 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
|
||||
@ -50,36 +50,35 @@ public class IBM943C extends Charset implements HistoricallyNamedCharset
|
||||
|
||||
public CharsetDecoder newDecoder() {
|
||||
return new DoubleByte.Decoder(this,
|
||||
IBM943.b2c,
|
||||
b2cSB,
|
||||
IBM943.DecodeHolder.b2c,
|
||||
Holder.b2cSB,
|
||||
0x40,
|
||||
0xfc);
|
||||
}
|
||||
|
||||
public CharsetEncoder newEncoder() {
|
||||
return new DoubleByte.Encoder(this, c2b, c2bIndex);
|
||||
return new DoubleByte.Encoder(this, Holder.c2b, Holder.c2bIndex);
|
||||
}
|
||||
|
||||
final static char[] b2cSB;
|
||||
final static char[] c2b;
|
||||
final static char[] c2bIndex;
|
||||
private static class Holder {
|
||||
static final char[] b2cSB;
|
||||
static final char[] c2b;
|
||||
static final 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;
|
||||
static {
|
||||
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.DecodeHolder.b2cSB[i];
|
||||
}
|
||||
c2b = Arrays.copyOf(IBM943.EncodeHolder.c2b, IBM943.EncodeHolder.c2b.length);
|
||||
c2bIndex = Arrays.copyOf(IBM943.EncodeHolder.c2bIndex, IBM943.EncodeHolder.c2bIndex.length);
|
||||
for (char c = '\0'; c < '\u0080'; ++c) {
|
||||
int index = c2bIndex[c >> 8];
|
||||
c2b[index + (c & 0xff)] = c;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2003, 2020, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2003, 2021, 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
|
||||
@ -50,35 +50,35 @@ public class IBM949C extends Charset implements HistoricallyNamedCharset
|
||||
|
||||
public CharsetDecoder newDecoder() {
|
||||
return new DoubleByte.Decoder(this,
|
||||
IBM949.b2c,
|
||||
b2cSB,
|
||||
IBM949.DecodeHolder.b2c,
|
||||
Holder.b2cSB,
|
||||
0xa1,
|
||||
0xfe);
|
||||
}
|
||||
|
||||
public CharsetEncoder newEncoder() {
|
||||
return new DoubleByte.Encoder(this, c2b, c2bIndex);
|
||||
return new DoubleByte.Encoder(this, Holder.c2b, Holder.c2bIndex);
|
||||
}
|
||||
|
||||
final static char[] b2cSB;
|
||||
final static char[] c2b;
|
||||
final static char[] c2bIndex;
|
||||
private static class Holder {
|
||||
static final char[] b2cSB;
|
||||
static final char[] c2b;
|
||||
static final 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;
|
||||
static {
|
||||
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.DecodeHolder.b2cSB[i];
|
||||
}
|
||||
c2b = Arrays.copyOf(IBM949.EncodeHolder.c2b, IBM949.EncodeHolder.c2b.length);
|
||||
c2bIndex = Arrays.copyOf(IBM949.EncodeHolder.c2bIndex, IBM949.EncodeHolder.c2bIndex.length);
|
||||
for (char c = '\0'; c < '\u0080'; ++c) {
|
||||
int index = c2bIndex[c >> 8];
|
||||
c2b[index + (c & 0xff)] = c;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2002, 2006, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2002, 2021, 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
|
||||
@ -64,17 +64,15 @@ public class ISO2022_CN_CNS extends ISO2022 implements HistoricallyNamedCharset
|
||||
|
||||
private static class Encoder extends ISO2022.Encoder {
|
||||
|
||||
private static final Charset cns = new EUC_TW();
|
||||
|
||||
public Encoder(Charset cs)
|
||||
{
|
||||
super(cs);
|
||||
SODesig = new byte[] {'$', ')', 'G' };
|
||||
SS2Desig = new byte[] {'$', '*', 'H' };
|
||||
SS3Desig = new byte[] {'$', '+', 'I' };
|
||||
|
||||
try {
|
||||
Charset cset = Charset.forName("EUC_TW"); // CNS11643
|
||||
ISOEncoder = cset.newEncoder();
|
||||
} catch (Exception e) { }
|
||||
ISOEncoder = cns.newEncoder();
|
||||
}
|
||||
|
||||
private byte[] bb = new byte[4];
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2002, 2006, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2002, 2021, 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
|
||||
@ -65,15 +65,12 @@ public class ISO2022_CN_GB extends ISO2022 implements HistoricallyNamedCharset
|
||||
|
||||
private static class Encoder extends ISO2022.Encoder {
|
||||
|
||||
private static final Charset gb2312 = new EUC_CN();
|
||||
public Encoder(Charset cs)
|
||||
{
|
||||
super(cs);
|
||||
SODesig = new byte[] { '$', ')', 'A'};
|
||||
|
||||
try {
|
||||
Charset cset = Charset.forName("EUC_CN"); // GB2312
|
||||
ISOEncoder = cset.newEncoder();
|
||||
} catch (Exception e) { }
|
||||
ISOEncoder = gb2312.newEncoder();
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2002, 2006, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2002, 2021, 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
|
||||
@ -40,11 +40,12 @@ import sun.nio.cs.*;
|
||||
public class ISO2022_KR extends ISO2022
|
||||
implements HistoricallyNamedCharset
|
||||
{
|
||||
private static Charset ksc5601_cs;
|
||||
private static class Holder {
|
||||
private static final Charset ksc5601_cs = new EUC_KR();
|
||||
}
|
||||
|
||||
public ISO2022_KR() {
|
||||
super("ISO-2022-KR", ExtendedCharsets.aliasesFor("ISO-2022-KR"));
|
||||
ksc5601_cs = new EUC_KR();
|
||||
}
|
||||
|
||||
public boolean contains(Charset cs) {
|
||||
@ -74,7 +75,7 @@ implements HistoricallyNamedCharset
|
||||
SODecoder = new CharsetDecoder[1];
|
||||
|
||||
try {
|
||||
SODecoder[0] = ksc5601_cs.newDecoder();
|
||||
SODecoder[0] = Holder.ksc5601_cs.newDecoder();
|
||||
} catch (Exception e) {};
|
||||
}
|
||||
}
|
||||
@ -85,7 +86,7 @@ implements HistoricallyNamedCharset
|
||||
super(cs);
|
||||
SODesig = new byte[] {'$', ')', 'C' };
|
||||
try {
|
||||
ISOEncoder = ksc5601_cs.newEncoder();
|
||||
ISOEncoder = Holder.ksc5601_cs.newEncoder();
|
||||
} catch (Exception e) { }
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2005, 2012, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2005, 2021, 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
|
||||
@ -53,24 +53,26 @@ public class MS50220 extends ISO2022_JP
|
||||
}
|
||||
|
||||
public CharsetDecoder newDecoder() {
|
||||
return new Decoder(this, DEC0208, DEC0212);
|
||||
return new Decoder(this, Holder.DEC0208, Holder.DEC0212);
|
||||
}
|
||||
|
||||
public CharsetEncoder newEncoder() {
|
||||
return new Encoder(this, ENC0208, ENC0212, doSBKANA());
|
||||
return new Encoder(this, Holder.ENC0208, Holder.ENC0212, doSBKANA());
|
||||
}
|
||||
|
||||
private final static DoubleByte.Decoder DEC0208 =
|
||||
(DoubleByte.Decoder)new JIS_X_0208_MS5022X().newDecoder();
|
||||
private static class Holder {
|
||||
private static final DoubleByte.Decoder DEC0208 =
|
||||
(DoubleByte.Decoder) new JIS_X_0208_MS5022X().newDecoder();
|
||||
|
||||
private final static DoubleByte.Decoder DEC0212 =
|
||||
(DoubleByte.Decoder)new JIS_X_0212_MS5022X().newDecoder();
|
||||
private static final DoubleByte.Decoder DEC0212 =
|
||||
(DoubleByte.Decoder) new JIS_X_0212_MS5022X().newDecoder();
|
||||
|
||||
private final static DoubleByte.Encoder ENC0208 =
|
||||
(DoubleByte.Encoder)new JIS_X_0208_MS5022X().newEncoder();
|
||||
private static final DoubleByte.Encoder ENC0208 =
|
||||
(DoubleByte.Encoder) new JIS_X_0208_MS5022X().newEncoder();
|
||||
|
||||
private final static DoubleByte.Encoder ENC0212 =
|
||||
(DoubleByte.Encoder)new JIS_X_0212_MS5022X().newEncoder();
|
||||
private static final DoubleByte.Encoder ENC0212 =
|
||||
(DoubleByte.Encoder) new JIS_X_0212_MS5022X().newEncoder();
|
||||
}
|
||||
|
||||
protected boolean doSBKANA() {
|
||||
return false;
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2008, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2008, 2021, 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
|
||||
@ -52,7 +52,7 @@ public class MS932_0213 extends Charset {
|
||||
}
|
||||
|
||||
protected static class Decoder extends SJIS_0213.Decoder {
|
||||
static DoubleByte.Decoder decMS932 =
|
||||
static final DoubleByte.Decoder decMS932 =
|
||||
(DoubleByte.Decoder)new MS932().newDecoder();
|
||||
protected Decoder(Charset cs) {
|
||||
super(cs);
|
||||
@ -68,7 +68,7 @@ public class MS932_0213 extends Charset {
|
||||
|
||||
protected static class Encoder extends SJIS_0213.Encoder {
|
||||
// we only use its encodeChar() method
|
||||
static DoubleByte.Encoder encMS932 =
|
||||
static final DoubleByte.Encoder encMS932 =
|
||||
(DoubleByte.Encoder)new MS932().newEncoder();
|
||||
protected Encoder(Charset cs) {
|
||||
super(cs);
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2010, 2021, 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
|
||||
@ -60,8 +60,8 @@ public class MS950_HKSCS extends Charset implements HistoricallyNamedCharset
|
||||
private static DoubleByte.Decoder ms950 =
|
||||
(DoubleByte.Decoder)new MS950().newDecoder();
|
||||
|
||||
private static char[][] b2cBmp = new char[0x100][];
|
||||
private static char[][] b2cSupp = new char[0x100][];
|
||||
private static final char[][] b2cBmp = new char[0x100][];
|
||||
private static final char[][] b2cSupp = new char[0x100][];
|
||||
static {
|
||||
initb2c(b2cBmp, HKSCSMapping.b2cBmpStr);
|
||||
initb2c(b2cSupp, HKSCSMapping.b2cSuppStr);
|
||||
@ -76,8 +76,8 @@ public class MS950_HKSCS extends Charset implements HistoricallyNamedCharset
|
||||
private static DoubleByte.Encoder ms950 =
|
||||
(DoubleByte.Encoder)new MS950().newEncoder();
|
||||
|
||||
static char[][] c2bBmp = new char[0x100][];
|
||||
static char[][] c2bSupp = new char[0x100][];
|
||||
static final char[][] c2bBmp = new char[0x100][];
|
||||
static final char[][] c2bSupp = new char[0x100][];
|
||||
static {
|
||||
initc2b(c2bBmp, HKSCSMapping.b2cBmpStr, HKSCSMapping.pua);
|
||||
initc2b(c2bSupp, HKSCSMapping.b2cSuppStr, null);
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2002, 2010, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2002, 2021, 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
|
||||
@ -65,7 +65,7 @@ public class MS950_HKSCS_XP extends Charset
|
||||
* MS HKSCS mappings which maps 0x8BC2 --> U+5C22
|
||||
* a character defined with the Unified CJK block
|
||||
*/
|
||||
private static char[][] b2cBmp = new char[0x100][];
|
||||
private static final char[][] b2cBmp = new char[0x100][];
|
||||
static {
|
||||
initb2c(b2cBmp, HKSCS_XPMapping.b2cBmpStr);
|
||||
}
|
||||
@ -88,7 +88,7 @@ public class MS950_HKSCS_XP extends Charset
|
||||
* Published MS HKSCS mappings show
|
||||
* U+5C22 <--> 0x8BC2
|
||||
*/
|
||||
static char[][] c2bBmp = new char[0x100][];
|
||||
static final char[][] c2bBmp = new char[0x100][];
|
||||
static {
|
||||
initc2b(c2bBmp, HKSCS_XPMapping.b2cBmpStr, null);
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2005, 2021, 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
|
||||
@ -55,9 +55,9 @@ public class MSISO2022JP extends ISO2022_JP
|
||||
}
|
||||
|
||||
private static class CoderHolder {
|
||||
final static DoubleByte.Decoder DEC0208 =
|
||||
static final DoubleByte.Decoder DEC0208 =
|
||||
(DoubleByte.Decoder)new JIS_X_0208_MS932().newDecoder();
|
||||
final static DoubleByte.Encoder ENC0208 =
|
||||
static final DoubleByte.Encoder ENC0208 =
|
||||
(DoubleByte.Encoder)new JIS_X_0208_MS932().newEncoder();
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2008, 2012, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2008, 2021, 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
|
||||
@ -76,12 +76,14 @@ public class SJIS_0213 extends Charset {
|
||||
return new Encoder(this);
|
||||
}
|
||||
|
||||
static CharsetMapping mapping = AccessController.doPrivileged(
|
||||
new PrivilegedAction<CharsetMapping>() {
|
||||
public CharsetMapping run() {
|
||||
return CharsetMapping.get(SJIS_0213.class.getResourceAsStream("sjis0213.dat"));
|
||||
}
|
||||
});
|
||||
private static class Holder {
|
||||
static final CharsetMapping mapping = AccessController.doPrivileged(
|
||||
new PrivilegedAction<CharsetMapping>() {
|
||||
public CharsetMapping run() {
|
||||
return CharsetMapping.get(SJIS_0213.class.getResourceAsStream("sjis0213.dat"));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
protected static class Decoder extends CharsetDecoder {
|
||||
protected static final char UNMAPPABLE = CharsetMapping.UNMAPPABLE_DECODING;
|
||||
@ -188,21 +190,21 @@ public class SJIS_0213 extends Charset {
|
||||
}
|
||||
|
||||
protected char decodeSingle(int b) {
|
||||
return mapping.decodeSingle(b);
|
||||
return Holder.mapping.decodeSingle(b);
|
||||
}
|
||||
|
||||
protected char decodeDouble(int b1, int b2) {
|
||||
return mapping.decodeDouble(b1, b2);
|
||||
return Holder.mapping.decodeDouble(b1, b2);
|
||||
}
|
||||
|
||||
private char[] cc = new char[2];
|
||||
private CharsetMapping.Entry comp = new CharsetMapping.Entry();
|
||||
protected char[] decodeDoubleEx(int b1, int b2) {
|
||||
int db = (b1 << 8) | b2;
|
||||
if (mapping.decodeSurrogate(db, cc) != null)
|
||||
if (Holder.mapping.decodeSurrogate(db, cc) != null)
|
||||
return cc;
|
||||
comp.bs = db;
|
||||
if (mapping.decodeComposite(comp, cc) != null)
|
||||
if (Holder.mapping.decodeComposite(comp, cc) != null)
|
||||
return cc;
|
||||
return null;
|
||||
}
|
||||
@ -221,23 +223,23 @@ public class SJIS_0213 extends Charset {
|
||||
}
|
||||
|
||||
protected int encodeChar(char ch) {
|
||||
return mapping.encodeChar(ch);
|
||||
return Holder.mapping.encodeChar(ch);
|
||||
}
|
||||
|
||||
protected int encodeSurrogate(char hi, char lo) {
|
||||
return mapping.encodeSurrogate(hi, lo);
|
||||
return Holder.mapping.encodeSurrogate(hi, lo);
|
||||
}
|
||||
|
||||
private CharsetMapping.Entry comp = new CharsetMapping.Entry();
|
||||
protected int encodeComposite(char base, char cc) {
|
||||
comp.cp = base;
|
||||
comp.cp2 = cc;
|
||||
return mapping.encodeComposite(comp);
|
||||
return Holder.mapping.encodeComposite(comp);
|
||||
}
|
||||
|
||||
protected boolean isCompositeBase(char ch) {
|
||||
comp.cp = ch;
|
||||
return mapping.isCompositeBase(comp);
|
||||
return Holder.mapping.isCompositeBase(comp);
|
||||
}
|
||||
|
||||
// Unlike surrogate pair, the base character of a base+cc composite
|
||||
|
Loading…
x
Reference in New Issue
Block a user