mirror of
https://github.com/openjdk/jdk.git
synced 2026-02-11 10:58:26 +00:00
8073152: Update Standard/ExtendedCharsets to work with module system
To reorganize the standard and extendec charset configuration during build time Reviewed-by: alanb
This commit is contained in:
parent
8104906db2
commit
1eb1419d72
@ -32,7 +32,8 @@ import java.nio.charset.CharsetDecoder;
|
||||
import java.nio.charset.CharsetEncoder;
|
||||
import java.util.Arrays;
|
||||
import sun.nio.cs.HistoricallyNamedCharset;
|
||||
import sun.nio.cs.ext.DoubleByte;
|
||||
import sun.nio.cs.DoubleByte;
|
||||
import sun.nio.cs.*;
|
||||
|
||||
public class $NAME_CLZ$ extends Charset
|
||||
$IMPLEMENTS$
|
||||
|
||||
1818
jdk/make/data/charsetmapping/charsets
Normal file
1818
jdk/make/data/charsetmapping/charsets
Normal file
File diff suppressed because it is too large
Load Diff
@ -1,36 +0,0 @@
|
||||
#
|
||||
#clzName csName hisName dbtype pkg ascii b1min b1max b2min b2max
|
||||
#
|
||||
Big5 Big5 Big5 basic sun.nio.cs.ext true 0xa1 0xf9 0x40 0xfe
|
||||
Johab x-Johab x-Johab basic sun.nio.cs.ext true 0x84 0xf9 0x31 0xfe
|
||||
EUC_CN GB2312 EUC_CN basic sun.nio.cs.ext true 0xa1 0xf7 0xa1 0xfe
|
||||
EUC_KR EUC-KR EUC_KR basic sun.nio.cs.ext true 0xa1 0xfd 0xa1 0xfe
|
||||
MS932 windows-31j MS932 basic sun.nio.cs.ext true 0x81 0xfc 0x40 0xfc
|
||||
MS936 x-mswin-936 MS936 basic sun.nio.cs.ext true 0x81 0xfe 0x40 0xfe
|
||||
MS949 x-windows-949 MS949 basic sun.nio.cs.ext true 0x81 0xfe 0x41 0xfe
|
||||
MS950 x-windows-950 MS950 basic sun.nio.cs.ext true 0x81 0xfe 0x40 0xfe
|
||||
GBK GBK GBK basic sun.nio.cs.ext true 0x81 0xfe 0x40 0xfe
|
||||
SJIS Shift_JIS SJIS basic sun.nio.cs.ext true 0x81 0xfc 0x40 0xfc
|
||||
PCK x-PCK PCK basic sun.nio.cs.ext true 0x81 0xfc 0x40 0xfc
|
||||
IBM1364 x-IBM1364 Cp1364 ebcdic sun.nio.cs.ext false 0x40 0xde 0x40 0xfe
|
||||
IBM1381 x-IBM1381 Cp1381 basic sun.nio.cs.ext true 0x8c 0xf7 0xa1 0xfe
|
||||
IBM1383 x-IBM1383 Cp1383 euc_sim sun.nio.cs.ext true 0xa1 0xfe 0xa1 0xfe
|
||||
IBM300 x-IBM300 Cp300 dbcsonly sun.nio.cs.ext false 0x40 0x7f 0x40 0xfe
|
||||
IBM930 x-IBM930 Cp930 ebcdic sun.nio.cs.ext false 0x40 0x7f 0x40 0xfe
|
||||
IBM933 x-IBM933 Cp933 ebcdic sun.nio.cs.ext false 0x40 0xdd 0x40 0xfe
|
||||
IBM935 x-IBM935 Cp935 ebcdic sun.nio.cs.ext false 0x40 0x7f 0x40 0xfe
|
||||
IBM937 x-IBM937 Cp937 ebcdic sun.nio.cs.ext false 0x40 0xe2 0x40 0xfe
|
||||
IBM939 x-IBM939 Cp939 ebcdic sun.nio.cs.ext false 0x40 0x7f 0x40 0xfe
|
||||
IBM942 x-IBM942 Cp942 basic sun.nio.cs.ext false 0x81 0xfc 0x40 0xfc
|
||||
IBM943 x-IBM943 Cp943 basic sun.nio.cs.ext false 0x81 0xfc 0x40 0xfc
|
||||
IBM948 x-IBM948 Cp948 basic sun.nio.cs.ext true 0x81 0xfe 0x40 0xfc
|
||||
IBM949 x-IBM949 Cp949 basic sun.nio.cs.ext false 0x8f 0xfe 0xa1 0xfe
|
||||
IBM950 x-IBM950 Cp950 basic sun.nio.cs.ext true 0x81 0xfe 0x40 0xfe
|
||||
IBM970 x-IBM970 Cp970 euc_sim sun.nio.cs.ext true 0xa1 0xfe 0xa1 0xfe
|
||||
JIS_X_0208 x-JIS0208 JIS0208 dbcsonly sun.nio.cs.ext false 0x21 0x7e 0x21 0x7e
|
||||
JIS_X_0212 JIS_X0212-1990 JIS0212 dbcsonly sun.nio.cs.ext false 0x21 0x7e 0x21 0x7e
|
||||
JIS_X_0208_Solaris x-JIS0208_Solaris JIS0208_Solaris dbcsonly sun.nio.cs.ext false 0x21 0x9e 0x21 0x7e
|
||||
JIS_X_0208_MS5022X x-JIS0208_MS5022X JIS0208_MS5022X dbcsonly sun.nio.cs.ext false 0x21 0x7e 0x21 0x7e
|
||||
JIS_X_0208_MS932 x-JIS0208_MS932 JIS0208_MS932 dbcsonly sun.nio.cs.ext false 0x21 0x7e 0x21 0x7e
|
||||
JIS_X_0212_Solaris x-JIS0212_Solaris JIS0212_Solaris dbcsonly sun.nio.cs.ext false 0x21 0x7e 0x21 0x7e
|
||||
JIS_X_0212_MS5022X x-JIS0212_MS5022X JIS0212_MS5022X dbcsonly sun.nio.cs.ext false 0x21 0x7e 0x21 0x7e
|
||||
@ -1,76 +0,0 @@
|
||||
# clzName csName hisName containASCII pkg
|
||||
IBM037 IBM037 Cp037 false sun.nio.cs.ext
|
||||
IBM1006 x-IBM1006 Cp1006 false sun.nio.cs.ext
|
||||
IBM1025 x-IBM1025 Cp1025 false sun.nio.cs.ext
|
||||
IBM1026 IBM1026 Cp1026 false sun.nio.cs.ext
|
||||
IBM1046 x-IBM1046 Cp1046 false sun.nio.cs.ext
|
||||
IBM1047 IBM1047 Cp1047 false sun.nio.cs.ext
|
||||
IBM1097 x-IBM1097 Cp1097 false sun.nio.cs.ext
|
||||
IBM1098 x-IBM1098 Cp1098 false sun.nio.cs.ext
|
||||
IBM1112 x-IBM1112 Cp1112 false sun.nio.cs.ext
|
||||
IBM1122 x-IBM1122 Cp1122 false sun.nio.cs.ext
|
||||
IBM1123 x-IBM1123 Cp1123 false sun.nio.cs.ext
|
||||
IBM1124 x-IBM1124 Cp1124 false sun.nio.cs.ext
|
||||
# map tables for 1140-1149 are updated manualy with the u+20ac entry
|
||||
IBM1140 IBM01140 Cp1140 false sun.nio.cs.ext
|
||||
IBM1141 IBM01141 Cp1141 false sun.nio.cs.ext
|
||||
IBM1142 IBM01142 Cp1142 false sun.nio.cs.ext
|
||||
IBM1143 IBM01143 Cp1143 false sun.nio.cs.ext
|
||||
IBM1144 IBM01144 Cp1144 false sun.nio.cs.ext
|
||||
IBM1145 IBM01145 Cp1145 false sun.nio.cs.ext
|
||||
IBM1146 IBM01146 Cp1146 false sun.nio.cs.ext
|
||||
IBM1147 IBM01147 Cp1147 false sun.nio.cs.ext
|
||||
IBM1148 IBM01148 Cp1148 false sun.nio.cs.ext
|
||||
IBM1149 IBM01149 Cp1149 false sun.nio.cs.ext
|
||||
IBM273 IBM273 Cp273 false sun.nio.cs.ext
|
||||
IBM277 IBM277 Cp277 false sun.nio.cs.ext
|
||||
IBM278 IBM278 Cp278 false sun.nio.cs.ext
|
||||
IBM280 IBM280 Cp280 false sun.nio.cs.ext
|
||||
IBM284 IBM284 Cp284 false sun.nio.cs.ext
|
||||
IBM285 IBM285 Cp285 false sun.nio.cs.ext
|
||||
IBM290 IBM290 Cp290 false sun.nio.cs.ext
|
||||
IBM297 IBM297 Cp297 false sun.nio.cs.ext
|
||||
IBM420 IBM420 Cp420 false sun.nio.cs.ext
|
||||
IBM424 IBM424 Cp424 false sun.nio.cs.ext
|
||||
IBM500 IBM500 Cp500 false sun.nio.cs.ext
|
||||
IBM833 x-IBM833 Cp833 false sun.nio.cs.ext
|
||||
IBM838 IBM-Thai Cp838 false sun.nio.cs.ext
|
||||
IBM856 x-IBM856 Cp856 false sun.nio.cs.ext
|
||||
IBM860 IBM860 Cp860 false sun.nio.cs.ext
|
||||
IBM861 IBM861 Cp861 false sun.nio.cs.ext
|
||||
IBM863 IBM863 Cp863 false sun.nio.cs.ext
|
||||
IBM864 IBM864 Cp864 false sun.nio.cs.ext
|
||||
IBM865 IBM865 Cp865 false sun.nio.cs.ext
|
||||
IBM868 IBM868 Cp868 false sun.nio.cs.ext
|
||||
IBM869 IBM869 Cp869 false sun.nio.cs.ext
|
||||
IBM870 IBM870 Cp870 false sun.nio.cs.ext
|
||||
IBM871 IBM871 Cp871 false sun.nio.cs.ext
|
||||
IBM875 x-IBM875 Cp875 false sun.nio.cs.ext
|
||||
IBM918 IBM918 Cp918 false sun.nio.cs.ext
|
||||
IBM921 x-IBM921 Cp921 false sun.nio.cs.ext
|
||||
IBM922 x-IBM922 Cp922 false sun.nio.cs.ext
|
||||
# use name as hisname as well, cs did not support hisname prevously
|
||||
ISO_8859_11 x-iso-8859-11 x-iso-8859-11 true sun.nio.cs.ext
|
||||
ISO_8859_3 ISO-8859-3 ISO8859_3 true sun.nio.cs.ext
|
||||
ISO_8859_6 ISO-8859-6 ISO8859_6 true sun.nio.cs.ext
|
||||
ISO_8859_8 ISO-8859-8 ISO8859_8 true sun.nio.cs.ext
|
||||
JIS_X_0201 JIS_X0201 JIS_X0201 true sun.nio.cs.ext
|
||||
MS1255 windows-1255 Cp1255 true sun.nio.cs.ext
|
||||
MS1256 windows-1256 Cp1256 true sun.nio.cs.ext
|
||||
MS1258 windows-1258 Cp1258 true sun.nio.cs.ext
|
||||
MS874 x-windows-874 MS874 true sun.nio.cs.ext
|
||||
MacArabic x-MacArabic MacArabic false sun.nio.cs.ext
|
||||
MacCentralEurope x-MacCentralEurope MacCentralEurope false sun.nio.cs.ext
|
||||
MacCroatian x-MacCroatian MacCroatian false sun.nio.cs.ext
|
||||
MacCyrillic x-MacCyrillic MacCyrillic false sun.nio.cs.ext
|
||||
MacDingbat x-MacDingbat MacDingbat false sun.nio.cs.ext
|
||||
MacGreek x-MacGreek MacGreek false sun.nio.cs.ext
|
||||
MacHebrew x-MacHebrew MacHebrew false sun.nio.cs.ext
|
||||
MacIceland x-MacIceland MacIceland false sun.nio.cs.ext
|
||||
MacRoman x-MacRoman MacRoman false sun.nio.cs.ext
|
||||
MacRomania x-MacRomania MacRomania false sun.nio.cs.ext
|
||||
MacSymbol x-MacSymbol MacSymbol false sun.nio.cs.ext
|
||||
MacThai x-MacThai MacThai false sun.nio.cs.ext
|
||||
MacTurkish x-MacTurkish MacTurkish false sun.nio.cs.ext
|
||||
MacUkraine x-MacUkraine MacUkraine false sun.nio.cs.ext
|
||||
TIS_620 TIS-620 TIS620 true sun.nio.cs.ext
|
||||
149
jdk/make/data/charsetmapping/list_old
Normal file
149
jdk/make/data/charsetmapping/list_old
Normal file
@ -0,0 +1,149 @@
|
||||
#
|
||||
# This is the copy of the old configuration files sbcs, dbcs and extsbcs
|
||||
# used in jdk8.
|
||||
############################### sbcs #########################################
|
||||
#
|
||||
# clzName csName hisName containASCII pkg
|
||||
#
|
||||
IBM437 IBM437 Cp437 false sun.nio.cs
|
||||
IBM737 x-IBM737 Cp737 false sun.nio.cs
|
||||
IBM775 IBM775 Cp775 false sun.nio.cs
|
||||
IBM850 IBM850 Cp850 false sun.nio.cs
|
||||
IBM852 IBM852 Cp852 false sun.nio.cs
|
||||
IBM855 IBM855 Cp855 false sun.nio.cs
|
||||
IBM857 IBM857 Cp857 false sun.nio.cs
|
||||
IBM858 IBM00858 Cp858 false sun.nio.cs
|
||||
IBM862 IBM862 Cp862 false sun.nio.cs
|
||||
IBM866 IBM866 Cp866 false sun.nio.cs
|
||||
IBM874 x-IBM874 Cp874 false sun.nio.cs
|
||||
ISO_8859_2 ISO-8859-2 ISO8859_2 true sun.nio.cs
|
||||
ISO_8859_4 ISO-8859-4 ISO8859_4 true sun.nio.cs
|
||||
ISO_8859_5 ISO-8859-5 ISO8859_5 true sun.nio.cs
|
||||
ISO_8859_7 ISO-8859-7 ISO8859_7 true sun.nio.cs
|
||||
ISO_8859_9 ISO-8859-9 ISO8859_9 true sun.nio.cs
|
||||
ISO_8859_13 ISO-8859-13 ISO8859_13 true sun.nio.cs
|
||||
ISO_8859_15 ISO-8859-15 ISO8859_15 true sun.nio.cs
|
||||
KOI8_R KOI8-R KOI8_R true sun.nio.cs
|
||||
KOI8_U KOI8-U KOI8_U true sun.nio.cs
|
||||
MS1250 windows-1250 Cp1250 true sun.nio.cs
|
||||
MS1251 windows-1251 Cp1251 true sun.nio.cs
|
||||
MS1252 windows-1252 Cp1252 true sun.nio.cs
|
||||
MS1253 windows-1253 Cp1253 true sun.nio.cs
|
||||
MS1254 windows-1254 Cp1254 true sun.nio.cs
|
||||
MS1257 windows-1257 Cp1257 true sun.nio.cs
|
||||
#
|
||||
############################### extsbcs #######################################
|
||||
#
|
||||
IBM037 IBM037 Cp037 false sun.nio.cs.ext
|
||||
IBM1006 x-IBM1006 Cp1006 false sun.nio.cs.ext
|
||||
IBM1025 x-IBM1025 Cp1025 false sun.nio.cs.ext
|
||||
IBM1026 IBM1026 Cp1026 false sun.nio.cs.ext
|
||||
IBM1046 x-IBM1046 Cp1046 false sun.nio.cs.ext
|
||||
IBM1047 IBM1047 Cp1047 false sun.nio.cs.ext
|
||||
IBM1097 x-IBM1097 Cp1097 false sun.nio.cs.ext
|
||||
IBM1098 x-IBM1098 Cp1098 false sun.nio.cs.ext
|
||||
IBM1112 x-IBM1112 Cp1112 false sun.nio.cs.ext
|
||||
IBM1122 x-IBM1122 Cp1122 false sun.nio.cs.ext
|
||||
IBM1123 x-IBM1123 Cp1123 false sun.nio.cs.ext
|
||||
IBM1124 x-IBM1124 Cp1124 false sun.nio.cs.ext
|
||||
# map tables for 1140-1149 are updated manualy with the u+20ac entry
|
||||
IBM1140 IBM01140 Cp1140 false sun.nio.cs.ext
|
||||
IBM1141 IBM01141 Cp1141 false sun.nio.cs.ext
|
||||
IBM1142 IBM01142 Cp1142 false sun.nio.cs.ext
|
||||
IBM1143 IBM01143 Cp1143 false sun.nio.cs.ext
|
||||
IBM1144 IBM01144 Cp1144 false sun.nio.cs.ext
|
||||
IBM1145 IBM01145 Cp1145 false sun.nio.cs.ext
|
||||
IBM1146 IBM01146 Cp1146 false sun.nio.cs.ext
|
||||
IBM1147 IBM01147 Cp1147 false sun.nio.cs.ext
|
||||
IBM1148 IBM01148 Cp1148 false sun.nio.cs.ext
|
||||
IBM1149 IBM01149 Cp1149 false sun.nio.cs.ext
|
||||
IBM273 IBM273 Cp273 false sun.nio.cs.ext
|
||||
IBM277 IBM277 Cp277 false sun.nio.cs.ext
|
||||
IBM278 IBM278 Cp278 false sun.nio.cs.ext
|
||||
IBM280 IBM280 Cp280 false sun.nio.cs.ext
|
||||
IBM284 IBM284 Cp284 false sun.nio.cs.ext
|
||||
IBM285 IBM285 Cp285 false sun.nio.cs.ext
|
||||
IBM290 IBM290 Cp290 false sun.nio.cs.ext
|
||||
IBM297 IBM297 Cp297 false sun.nio.cs.ext
|
||||
IBM420 IBM420 Cp420 false sun.nio.cs.ext
|
||||
IBM424 IBM424 Cp424 false sun.nio.cs.ext
|
||||
IBM500 IBM500 Cp500 false sun.nio.cs.ext
|
||||
IBM833 x-IBM833 Cp833 false sun.nio.cs.ext
|
||||
IBM838 IBM-Thai Cp838 false sun.nio.cs.ext
|
||||
IBM856 x-IBM856 Cp856 false sun.nio.cs.ext
|
||||
IBM860 IBM860 Cp860 false sun.nio.cs.ext
|
||||
IBM861 IBM861 Cp861 false sun.nio.cs.ext
|
||||
IBM863 IBM863 Cp863 false sun.nio.cs.ext
|
||||
IBM864 IBM864 Cp864 false sun.nio.cs.ext
|
||||
IBM865 IBM865 Cp865 false sun.nio.cs.ext
|
||||
IBM868 IBM868 Cp868 false sun.nio.cs.ext
|
||||
IBM869 IBM869 Cp869 false sun.nio.cs.ext
|
||||
IBM870 IBM870 Cp870 false sun.nio.cs.ext
|
||||
IBM871 IBM871 Cp871 false sun.nio.cs.ext
|
||||
IBM875 x-IBM875 Cp875 false sun.nio.cs.ext
|
||||
IBM918 IBM918 Cp918 false sun.nio.cs.ext
|
||||
IBM921 x-IBM921 Cp921 false sun.nio.cs.ext
|
||||
IBM922 x-IBM922 Cp922 false sun.nio.cs.ext
|
||||
# use name as hisname as well, cs did not support hisname prevously
|
||||
ISO_8859_11 x-iso-8859-11 x-iso-8859-11 true sun.nio.cs.ext
|
||||
ISO_8859_3 ISO-8859-3 ISO8859_3 true sun.nio.cs.ext
|
||||
ISO_8859_6 ISO-8859-6 ISO8859_6 true sun.nio.cs.ext
|
||||
ISO_8859_8 ISO-8859-8 ISO8859_8 true sun.nio.cs.ext
|
||||
JIS_X_0201 JIS_X0201 JIS_X0201 true sun.nio.cs.ext
|
||||
MS1255 windows-1255 Cp1255 true sun.nio.cs.ext
|
||||
MS1256 windows-1256 Cp1256 true sun.nio.cs.ext
|
||||
MS1258 windows-1258 Cp1258 true sun.nio.cs.ext
|
||||
MS874 x-windows-874 MS874 true sun.nio.cs.ext
|
||||
MacArabic x-MacArabic MacArabic false sun.nio.cs.ext
|
||||
MacCentralEurope x-MacCentralEurope MacCentralEurope false sun.nio.cs.ext
|
||||
MacCroatian x-MacCroatian MacCroatian false sun.nio.cs.ext
|
||||
MacCyrillic x-MacCyrillic MacCyrillic false sun.nio.cs.ext
|
||||
MacDingbat x-MacDingbat MacDingbat false sun.nio.cs.ext
|
||||
MacGreek x-MacGreek MacGreek false sun.nio.cs.ext
|
||||
MacHebrew x-MacHebrew MacHebrew false sun.nio.cs.ext
|
||||
MacIceland x-MacIceland MacIceland false sun.nio.cs.ext
|
||||
MacRoman x-MacRoman MacRoman false sun.nio.cs.ext
|
||||
MacRomania x-MacRomania MacRomania false sun.nio.cs.ext
|
||||
MacSymbol x-MacSymbol MacSymbol false sun.nio.cs.ext
|
||||
MacThai x-MacThai MacThai false sun.nio.cs.ext
|
||||
MacTurkish x-MacTurkish MacTurkish false sun.nio.cs.ext
|
||||
MacUkraine x-MacUkraine MacUkraine false sun.nio.cs.ext
|
||||
TIS_620 TIS-620 TIS620 true sun.nio.cs.ext
|
||||
#
|
||||
############################### dbcs #########################################
|
||||
#
|
||||
#clzName csName hisName dbtype pkg ascii b1min b1max b2min b2max
|
||||
#
|
||||
Big5 Big5 Big5 basic sun.nio.cs.ext true 0xa1 0xf9 0x40 0xfe
|
||||
Johab x-Johab x-Johab basic sun.nio.cs.ext true 0x84 0xf9 0x31 0xfe
|
||||
EUC_CN GB2312 EUC_CN basic sun.nio.cs.ext true 0xa1 0xf7 0xa1 0xfe
|
||||
EUC_KR EUC-KR EUC_KR basic sun.nio.cs.ext true 0xa1 0xfd 0xa1 0xfe
|
||||
MS932 windows-31j MS932 basic sun.nio.cs.ext true 0x81 0xfc 0x40 0xfc
|
||||
MS936 x-mswin-936 MS936 basic sun.nio.cs.ext true 0x81 0xfe 0x40 0xfe
|
||||
MS949 x-windows-949 MS949 basic sun.nio.cs.ext true 0x81 0xfe 0x41 0xfe
|
||||
MS950 x-windows-950 MS950 basic sun.nio.cs.ext true 0x81 0xfe 0x40 0xfe
|
||||
GBK GBK GBK basic sun.nio.cs.ext true 0x81 0xfe 0x40 0xfe
|
||||
SJIS Shift_JIS SJIS basic sun.nio.cs.ext true 0x81 0xfc 0x40 0xfc
|
||||
PCK x-PCK PCK basic sun.nio.cs.ext true 0x81 0xfc 0x40 0xfc
|
||||
IBM1364 x-IBM1364 Cp1364 ebcdic sun.nio.cs.ext false 0x40 0xde 0x40 0xfe
|
||||
IBM1381 x-IBM1381 Cp1381 basic sun.nio.cs.ext true 0x8c 0xf7 0xa1 0xfe
|
||||
IBM1383 x-IBM1383 Cp1383 euc_sim sun.nio.cs.ext true 0xa1 0xfe 0xa1 0xfe
|
||||
IBM300 x-IBM300 Cp300 dbcsonly sun.nio.cs.ext false 0x40 0x7f 0x40 0xfe
|
||||
IBM930 x-IBM930 Cp930 ebcdic sun.nio.cs.ext false 0x40 0x7f 0x40 0xfe
|
||||
IBM933 x-IBM933 Cp933 ebcdic sun.nio.cs.ext false 0x40 0xdd 0x40 0xfe
|
||||
IBM935 x-IBM935 Cp935 ebcdic sun.nio.cs.ext false 0x40 0x7f 0x40 0xfe
|
||||
IBM937 x-IBM937 Cp937 ebcdic sun.nio.cs.ext false 0x40 0xe2 0x40 0xfe
|
||||
IBM939 x-IBM939 Cp939 ebcdic sun.nio.cs.ext false 0x40 0x7f 0x40 0xfe
|
||||
IBM942 x-IBM942 Cp942 basic sun.nio.cs.ext false 0x81 0xfc 0x40 0xfc
|
||||
IBM943 x-IBM943 Cp943 basic sun.nio.cs.ext false 0x81 0xfc 0x40 0xfc
|
||||
IBM948 x-IBM948 Cp948 basic sun.nio.cs.ext true 0x81 0xfe 0x40 0xfc
|
||||
IBM949 x-IBM949 Cp949 basic sun.nio.cs.ext false 0x8f 0xfe 0xa1 0xfe
|
||||
IBM950 x-IBM950 Cp950 basic sun.nio.cs.ext true 0x81 0xfe 0x40 0xfe
|
||||
IBM970 x-IBM970 Cp970 euc_sim sun.nio.cs.ext true 0xa1 0xfe 0xa1 0xfe
|
||||
JIS_X_0208 x-JIS0208 JIS0208 dbcsonly sun.nio.cs.ext false 0x21 0x7e 0x21 0x7e
|
||||
JIS_X_0212 JIS_X0212-1990 JIS0212 dbcsonly sun.nio.cs.ext false 0x21 0x7e 0x21 0x7e
|
||||
JIS_X_0208_Solaris x-JIS0208_Solaris JIS0208_Solaris dbcsonly sun.nio.cs.ext false 0x21 0x9e 0x21 0x7e
|
||||
JIS_X_0208_MS5022X x-JIS0208_MS5022X JIS0208_MS5022X dbcsonly sun.nio.cs.ext false 0x21 0x7e 0x21 0x7e
|
||||
JIS_X_0208_MS932 x-JIS0208_MS932 JIS0208_MS932 dbcsonly sun.nio.cs.ext false 0x21 0x7e 0x21 0x7e
|
||||
JIS_X_0212_Solaris x-JIS0212_Solaris JIS0212_Solaris dbcsonly sun.nio.cs.ext false 0x21 0x7e 0x21 0x7e
|
||||
JIS_X_0212_MS5022X x-JIS0212_MS5022X JIS0212_MS5022X dbcsonly sun.nio.cs.ext false 0x21 0x7e 0x21 0x7e
|
||||
@ -1,28 +0,0 @@
|
||||
# clzName csName hisName containASCII pkg
|
||||
IBM437 IBM437 Cp437 false sun.nio.cs
|
||||
IBM737 x-IBM737 Cp737 false sun.nio.cs
|
||||
IBM775 IBM775 Cp775 false sun.nio.cs
|
||||
IBM850 IBM850 Cp850 false sun.nio.cs
|
||||
IBM852 IBM852 Cp852 false sun.nio.cs
|
||||
IBM855 IBM855 Cp855 false sun.nio.cs
|
||||
IBM857 IBM857 Cp857 false sun.nio.cs
|
||||
IBM858 IBM00858 Cp858 false sun.nio.cs
|
||||
IBM862 IBM862 Cp862 false sun.nio.cs
|
||||
IBM866 IBM866 Cp866 false sun.nio.cs
|
||||
IBM874 x-IBM874 Cp874 false sun.nio.cs
|
||||
ISO_8859_2 ISO-8859-2 ISO8859_2 true sun.nio.cs
|
||||
ISO_8859_4 ISO-8859-4 ISO8859_4 true sun.nio.cs
|
||||
ISO_8859_5 ISO-8859-5 ISO8859_5 true sun.nio.cs
|
||||
ISO_8859_7 ISO-8859-7 ISO8859_7 true sun.nio.cs
|
||||
ISO_8859_9 ISO-8859-9 ISO8859_9 true sun.nio.cs
|
||||
ISO_8859_13 ISO-8859-13 ISO8859_13 true sun.nio.cs
|
||||
ISO_8859_15 ISO-8859-15 ISO8859_15 true sun.nio.cs
|
||||
KOI8_R KOI8-R KOI8_R true sun.nio.cs
|
||||
KOI8_U KOI8-U KOI8_U true sun.nio.cs
|
||||
MS1250 windows-1250 Cp1250 true sun.nio.cs
|
||||
MS1251 windows-1251 Cp1251 true sun.nio.cs
|
||||
MS1252 windows-1252 Cp1252 true sun.nio.cs
|
||||
MS1253 windows-1253 Cp1253 true sun.nio.cs
|
||||
MS1254 windows-1254 Cp1254 true sun.nio.cs
|
||||
MS1257 windows-1257 Cp1257 true sun.nio.cs
|
||||
|
||||
@ -1,337 +0,0 @@
|
||||
#
|
||||
# Copyright (c) 2000, 2014, 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.
|
||||
#
|
||||
|
||||
# Standard charsets provided by StandardCharsets provider.
|
||||
#
|
||||
# Note that these "standard" charsets listed here are not
|
||||
# necessary to be the "Standard charsets" defined in the
|
||||
# specification of java.nio.charset.Charset. Instead these
|
||||
# are the charsets that this implementation believes should
|
||||
# be packaged into the charsets provider class "StandardCharsets"
|
||||
# which is initialized at startup time by java.nio.charset.Charset,
|
||||
# compared to the charsets packaged in "ExtendedCharsets" provider,
|
||||
# which is lazy initialized.
|
||||
|
||||
charset US-ASCII US_ASCII
|
||||
|
||||
# IANA aliases
|
||||
alias iso-ir-6
|
||||
alias ANSI_X3.4-1986
|
||||
alias ISO_646.irv:1991
|
||||
alias ASCII
|
||||
alias ISO646-US
|
||||
alias us
|
||||
alias IBM367
|
||||
alias cp367
|
||||
alias csASCII
|
||||
alias default
|
||||
|
||||
# Other aliases
|
||||
alias 646 # Solaris POSIX locale
|
||||
alias iso_646.irv:1983
|
||||
alias ANSI_X3.4-1968 # Linux POSIX locale (RedHat)
|
||||
alias ascii7
|
||||
|
||||
charset UTF-8 UTF_8
|
||||
alias UTF8 # JDK historical
|
||||
alias unicode-1-1-utf-8
|
||||
|
||||
charset CESU-8 CESU_8
|
||||
alias CESU8
|
||||
alias csCESU-8
|
||||
|
||||
charset UTF-16 UTF_16
|
||||
alias UTF_16 # JDK historical
|
||||
alias utf16
|
||||
alias unicode
|
||||
alias UnicodeBig
|
||||
|
||||
charset UTF-16BE UTF_16BE
|
||||
alias UTF_16BE
|
||||
alias ISO-10646-UCS-2
|
||||
alias X-UTF-16BE
|
||||
alias UnicodeBigUnmarked
|
||||
|
||||
charset UTF-16LE UTF_16LE
|
||||
alias UTF_16LE
|
||||
alias X-UTF-16LE
|
||||
alias UnicodeLittleUnmarked
|
||||
|
||||
charset x-UTF-16LE-BOM UTF_16LE_BOM
|
||||
alias UnicodeLittle
|
||||
|
||||
charset UTF-32 UTF_32
|
||||
alias UTF_32
|
||||
alias UTF32
|
||||
|
||||
charset UTF-32LE UTF_32LE
|
||||
alias UTF_32LE
|
||||
alias X-UTF-32LE
|
||||
|
||||
charset UTF-32BE UTF_32BE
|
||||
alias UTF_32BE
|
||||
alias X-UTF-32BE
|
||||
|
||||
charset X-UTF-32LE-BOM UTF_32LE_BOM
|
||||
alias UTF_32LE_BOM
|
||||
alias UTF-32LE-BOM
|
||||
|
||||
charset X-UTF-32BE-BOM UTF_32BE_BOM
|
||||
alias UTF_32BE_BOM
|
||||
alias UTF-32BE-BOM
|
||||
|
||||
charset ISO-8859-1 ISO_8859_1
|
||||
|
||||
# IANA aliases
|
||||
alias iso-ir-100
|
||||
alias ISO_8859-1
|
||||
alias latin1
|
||||
alias l1
|
||||
alias IBM819
|
||||
alias cp819
|
||||
alias csISOLatin1
|
||||
|
||||
# Other aliases
|
||||
alias 819
|
||||
alias IBM-819
|
||||
alias ISO8859_1
|
||||
alias ISO_8859-1:1987
|
||||
alias ISO_8859_1
|
||||
alias 8859_1
|
||||
alias ISO8859-1
|
||||
|
||||
charset ISO-8859-2 ISO_8859_2
|
||||
alias iso8859_2 # JDK historical
|
||||
alias 8859_2
|
||||
alias iso-ir-101
|
||||
alias ISO_8859-2
|
||||
alias ISO_8859-2:1987
|
||||
alias ISO8859-2
|
||||
alias latin2
|
||||
alias l2
|
||||
alias ibm912
|
||||
alias ibm-912
|
||||
alias cp912
|
||||
alias 912
|
||||
alias csISOLatin2
|
||||
|
||||
charset ISO-8859-4 ISO_8859_4
|
||||
alias iso8859_4 # JDK historical
|
||||
alias iso8859-4
|
||||
alias 8859_4
|
||||
alias iso-ir-110
|
||||
alias ISO_8859-4
|
||||
alias ISO_8859-4:1988
|
||||
alias latin4
|
||||
alias l4
|
||||
alias ibm914
|
||||
alias ibm-914
|
||||
alias cp914
|
||||
alias 914
|
||||
alias csISOLatin4
|
||||
|
||||
charset ISO-8859-5 ISO_8859_5
|
||||
alias iso8859_5 # JDK historical
|
||||
alias 8859_5
|
||||
alias iso-ir-144
|
||||
alias ISO_8859-5
|
||||
alias ISO_8859-5:1988
|
||||
alias ISO8859-5
|
||||
alias cyrillic
|
||||
alias ibm915
|
||||
alias ibm-915
|
||||
alias cp915
|
||||
alias 915
|
||||
alias csISOLatinCyrillic
|
||||
|
||||
charset ISO-8859-7 ISO_8859_7
|
||||
alias iso8859_7 # JDK historical
|
||||
alias 8859_7
|
||||
alias iso-ir-126
|
||||
alias ISO_8859-7
|
||||
alias ISO_8859-7:1987
|
||||
alias ELOT_928
|
||||
alias ECMA-118
|
||||
alias greek
|
||||
alias greek8
|
||||
alias csISOLatinGreek
|
||||
alias sun_eu_greek # Solaris 7/8 compatibility
|
||||
alias ibm813
|
||||
alias ibm-813
|
||||
alias 813
|
||||
alias cp813
|
||||
alias iso8859-7 # Solaris 9 compatibility
|
||||
|
||||
charset ISO-8859-9 ISO_8859_9
|
||||
alias iso8859_9 # JDK historical
|
||||
alias 8859_9
|
||||
alias iso-ir-148
|
||||
alias ISO_8859-9
|
||||
alias ISO_8859-9:1989
|
||||
alias ISO8859-9
|
||||
alias latin5
|
||||
alias l5
|
||||
alias ibm920
|
||||
alias ibm-920
|
||||
alias 920
|
||||
alias cp920
|
||||
alias csISOLatin5
|
||||
|
||||
charset ISO-8859-13 ISO_8859_13
|
||||
alias iso8859_13 # JDK historical
|
||||
alias 8859_13
|
||||
alias iso_8859-13
|
||||
alias ISO8859-13
|
||||
|
||||
charset ISO-8859-15 ISO_8859_15
|
||||
|
||||
# IANA alias
|
||||
alias ISO_8859-15
|
||||
|
||||
# Other aliases
|
||||
alias 8859_15
|
||||
alias ISO-8859-15
|
||||
alias ISO8859_15
|
||||
alias ISO8859-15
|
||||
alias IBM923
|
||||
alias IBM-923
|
||||
alias cp923
|
||||
alias 923
|
||||
alias LATIN0
|
||||
alias LATIN9
|
||||
alias L9
|
||||
alias csISOlatin0
|
||||
alias csISOlatin9
|
||||
alias ISO8859_15_FDIS
|
||||
|
||||
charset KOI8-R KOI8_R
|
||||
alias koi8_r # JDK historical
|
||||
alias koi8
|
||||
alias cskoi8r
|
||||
|
||||
charset KOI8-U KOI8_U
|
||||
alias koi8_u
|
||||
|
||||
charset windows-1250 MS1250
|
||||
alias cp1250 # JDK historical
|
||||
alias cp5346 # Euro IBM CCSID
|
||||
|
||||
charset windows-1251 MS1251
|
||||
alias cp1251 # JDK historical
|
||||
alias cp5347 # Euro IBM CCSID
|
||||
alias ansi-1251 # Solaris compatibility
|
||||
|
||||
charset windows-1252 MS1252
|
||||
alias cp1252 # JDK historical
|
||||
alias cp5348 # Euro IBM CCSID
|
||||
|
||||
charset windows-1253 MS1253
|
||||
alias cp1253 # JDK historical
|
||||
alias cp5349 # Euro IBM CCSID
|
||||
|
||||
charset windows-1254 MS1254
|
||||
alias cp1254 # JDK historical
|
||||
alias cp5350 # Euro IBM CCSID
|
||||
|
||||
charset windows-1257 MS1257
|
||||
alias cp1257 # JDK historical
|
||||
alias cp5353 # Euro IBM CCSID
|
||||
|
||||
|
||||
charset IBM437 IBM437
|
||||
alias cp437 #JDK historical
|
||||
alias ibm437
|
||||
alias ibm-437
|
||||
alias 437
|
||||
alias cspc8codepage437
|
||||
alias windows-437
|
||||
|
||||
charset x-IBM737 IBM737
|
||||
alias cp737 #JDK historical
|
||||
alias ibm737
|
||||
alias ibm-737
|
||||
alias 737
|
||||
|
||||
charset IBM775 IBM775
|
||||
alias cp775 #JDK historical
|
||||
alias ibm775
|
||||
alias ibm-775
|
||||
alias 775
|
||||
|
||||
charset IBM850 IBM850
|
||||
alias cp850 #JDK historical
|
||||
alias ibm-850
|
||||
alias ibm850
|
||||
alias 850
|
||||
alias cspc850multilingual
|
||||
|
||||
charset IBM852 IBM852
|
||||
alias cp852 #JDK historical
|
||||
alias ibm852
|
||||
alias ibm-852
|
||||
alias 852
|
||||
alias csPCp852
|
||||
|
||||
charset IBM855 IBM855
|
||||
alias cp855 #JDK historical
|
||||
alias ibm-855
|
||||
alias ibm855
|
||||
alias 855
|
||||
alias cspcp855
|
||||
|
||||
charset IBM857 IBM857
|
||||
alias cp857 #JDK historical
|
||||
alias ibm857
|
||||
alias ibm-857
|
||||
alias 857
|
||||
alias csIBM857
|
||||
|
||||
charset IBM00858 IBM858
|
||||
alias cp858 #JDK historical
|
||||
alias ccsid00858
|
||||
alias cp00858
|
||||
alias 858
|
||||
alias PC-Multilingual-850+euro
|
||||
|
||||
charset IBM862 IBM862
|
||||
alias cp862 #JDK historical
|
||||
alias ibm862
|
||||
alias ibm-862
|
||||
alias 862
|
||||
alias csIBM862
|
||||
alias cspc862latinhebrew
|
||||
|
||||
charset IBM866 IBM866
|
||||
alias cp866 #JDK historical
|
||||
alias ibm866
|
||||
alias ibm-866
|
||||
alias 866
|
||||
alias csIBM866
|
||||
|
||||
charset x-IBM874 IBM874
|
||||
alias cp874 #JDK historical
|
||||
alias ibm874
|
||||
alias ibm-874
|
||||
alias 874
|
||||
19
jdk/make/data/charsetmapping/stdcs-linux
Normal file
19
jdk/make/data/charsetmapping/stdcs-linux
Normal file
@ -0,0 +1,19 @@
|
||||
#
|
||||
# generate these charsets into sun.nio.cs
|
||||
#
|
||||
Big5
|
||||
Big5_Solaris
|
||||
Big5_HKSCS
|
||||
EUC_CN
|
||||
EUC_KR
|
||||
EUC_JP
|
||||
EUC_JP_LINUX
|
||||
EUC_JP_Open
|
||||
GBK
|
||||
Johab
|
||||
PCK
|
||||
JIS_X_0201
|
||||
JIS_X_0208
|
||||
JIS_X_0212
|
||||
JIS_X_0208_Solaris
|
||||
JIS_X_0212_Solaris
|
||||
23
jdk/make/data/charsetmapping/stdcs-solaris
Normal file
23
jdk/make/data/charsetmapping/stdcs-solaris
Normal file
@ -0,0 +1,23 @@
|
||||
#
|
||||
# generate these charsets into sun.nio.cs
|
||||
#
|
||||
Big5
|
||||
Big5_Solaris
|
||||
Big5_HKSCS # always together with Big5
|
||||
EUC_CN
|
||||
EUC_KR
|
||||
EUC_JP
|
||||
EUC_JP_LINUX
|
||||
EUC_JP_Open
|
||||
GBK
|
||||
ISO_8859_11
|
||||
ISO_8859_3
|
||||
ISO_8859_6
|
||||
ISO_8859_8
|
||||
Johab
|
||||
PCK
|
||||
JIS_X_0201
|
||||
JIS_X_0208
|
||||
JIS_X_0212
|
||||
JIS_X_0208_Solaris
|
||||
JIS_X_0212_Solaris
|
||||
16
jdk/make/data/charsetmapping/stdcs-windows
Normal file
16
jdk/make/data/charsetmapping/stdcs-windows
Normal file
@ -0,0 +1,16 @@
|
||||
#
|
||||
# generate these charsets into sun.nio.cs
|
||||
#
|
||||
GBK
|
||||
Johab
|
||||
MS1255
|
||||
MS1256
|
||||
MS1258
|
||||
MS874
|
||||
MS932
|
||||
JIS_X_0201 # JIS_X_0201 is used by MS932 in its contains() method
|
||||
SJIS # SJIS must go together with MS932 to support sun.nio.cs.map
|
||||
MS936
|
||||
MS949
|
||||
MS950
|
||||
MS950_HKSCS_XP
|
||||
@ -30,23 +30,26 @@ include GensrcCommon.gmk
|
||||
# Generate files using the charsetmapping tool
|
||||
#
|
||||
CHARSET_DATA_DIR := $(JDK_TOPDIR)/make/data/charsetmapping
|
||||
|
||||
CHARSET_GENSRC_JAVA_DIR_CS := $(SUPPORT_OUTPUTDIR)/gensrc/jdk.charsets/sun/nio/cs/ext
|
||||
CHARSET_DONE_CS := $(CHARSET_GENSRC_JAVA_DIR_CS)/_the.charsetmapping
|
||||
CHARSET_COPYRIGHT_HEADER := $(JDK_TOPDIR)/make/src/classes/build/tools/charsetmapping
|
||||
CHARSET_TEMPLATES := \
|
||||
$(CHARSET_DATA_DIR)/SingleByte-X.java.template \
|
||||
$(CHARSET_DATA_DIR)/DoubleByte-X.java.template
|
||||
CHARSET_EXTENDED_JAVA_TEMPLATES := \
|
||||
$(JDK_TOPDIR)/src/jdk.charsets/share/classes/sun/nio/cs/ext/ExtendedCharsets.java.template
|
||||
CHARSET_EXTENDED_JAVA_DIR := $(JDK_TOPDIR)/src/jdk.charsets/share/classes/sun/nio/cs/ext
|
||||
CHARSET_EXTENDED := extcs
|
||||
CHARSET_STANDARD_OS := stdcs-$(OPENJDK_TARGET_OS)
|
||||
|
||||
$(CHARSET_DONE_CS)-extsbcs: $(CHARSET_DATA_DIR)/extsbcs \
|
||||
$(CHARSET_TEMPLATES) $(BUILD_TOOLS_JDK)
|
||||
$(CHARSET_DONE_CS)-extcs: $(CHARSET_DATA_DIR)/charsets \
|
||||
$(CHARSET_TEMPLATES) $(CHARSET_EXTENDED_DATA) $(BUILD_TOOLS_JDK)
|
||||
$(MKDIR) -p $(@D)
|
||||
$(TOOL_CHARSETMAPPING) $(CHARSET_DATA_DIR) $(CHARSET_GENSRC_JAVA_DIR_CS) extsbcs
|
||||
$(TOUCH) '$@'
|
||||
|
||||
$(CHARSET_DONE_CS)-dbcs: $(CHARSET_DATA_DIR)/dbcs \
|
||||
$(CHARSET_TEMPLATES) $(BUILD_TOOLS_JDK)
|
||||
$(MKDIR) -p $(@D)
|
||||
$(TOOL_CHARSETMAPPING) $(CHARSET_DATA_DIR) $(CHARSET_GENSRC_JAVA_DIR_CS) dbcs
|
||||
$(TOOL_CHARSETMAPPING) $(CHARSET_DATA_DIR) $(CHARSET_GENSRC_JAVA_DIR_CS) \
|
||||
extcs charsets $(CHARSET_STANDARD_OS) \
|
||||
$(CHARSET_EXTENDED_JAVA_TEMPLATES) \
|
||||
$(CHARSET_EXTENDED_JAVA_DIR)
|
||||
$(TOUCH) '$@'
|
||||
|
||||
$(CHARSET_DONE_CS)-hkscs: $(CHARSET_COPYRIGHT_HEADER)/HKSCS.java \
|
||||
@ -67,8 +70,7 @@ $(CHARSET_GENSRC_JAVA_DIR_CS)/sjis0213.dat: $(CHARSET_DATA_DIR)/sjis0213.map \
|
||||
$(TOOL_CHARSETMAPPING) '$<' '$@' sjis0213
|
||||
|
||||
GENSRC_JDK_CHARSETS += \
|
||||
$(CHARSET_DONE_CS)-extsbcs \
|
||||
$(CHARSET_DONE_CS)-dbcs \
|
||||
$(CHARSET_DONE_CS)-extcs \
|
||||
$(CHARSET_DONE_CS)-hkscs \
|
||||
$(CHARSET_DONE_CS)-euctw \
|
||||
$(CHARSET_GENSRC_JAVA_DIR_CS)/sjis0213.dat \
|
||||
|
||||
@ -25,112 +25,27 @@
|
||||
|
||||
################################################################################
|
||||
#
|
||||
# Generate files using the charsetmapping tool
|
||||
# Generate StandardCharsets.java and individul sun.nio.cs charset class using
|
||||
# the charsetmapping tool
|
||||
#
|
||||
CHARSET_DATA_DIR := $(JDK_TOPDIR)/make/data/charsetmapping
|
||||
CHARSET_EXTSRC_DIR := $(JDK_TOPDIR)/src/jdk.charsets/share/classes/sun/nio/cs/ext
|
||||
CHARSET_GENSRC_JAVA_DIR_BASE := $(SUPPORT_OUTPUTDIR)/gensrc/java.base/sun/nio/cs
|
||||
CHARSET_DONE_BASE := $(CHARSET_GENSRC_JAVA_DIR_BASE)/_the.charsetmapping
|
||||
CHARSET_TEMPLATES := \
|
||||
$(CHARSET_DATA_DIR)/SingleByte-X.java.template \
|
||||
$(CHARSET_DATA_DIR)/DoubleByte-X.java.template
|
||||
CHARSET_STANDARD_JAVA_TEMPLATES := \
|
||||
$(JDK_TOPDIR)/src/java.base/share/classes/sun/nio/cs/StandardCharsets.java.template
|
||||
CHARSET_STANDARD_OS := stdcs-$(OPENJDK_TARGET_OS)
|
||||
|
||||
$(CHARSET_DONE_BASE)-sbcs: $(CHARSET_DATA_DIR)/sbcs \
|
||||
$(CHARSET_DONE_BASE)-stdcs: $(CHARSET_DATA_DIR)/charsets \
|
||||
$(CHARSET_TEMPLATES) $(BUILD_TOOLS_JDK)
|
||||
$(MKDIR) -p $(@D)
|
||||
$(TOOL_CHARSETMAPPING) $(CHARSET_DATA_DIR) $(CHARSET_GENSRC_JAVA_DIR_BASE) sbcs
|
||||
$(TOOL_CHARSETMAPPING) $(CHARSET_DATA_DIR) $(CHARSET_GENSRC_JAVA_DIR_BASE) \
|
||||
stdcs charsets $(CHARSET_STANDARD_OS) \
|
||||
$(CHARSET_STANDARD_JAVA_TEMPLATES) $(CHARSET_EXTSRC_DIR) \
|
||||
$(TOUCH) '$@'
|
||||
|
||||
GENSRC_JAVA_BASE += $(CHARSET_DONE_BASE)-sbcs
|
||||
GENSRC_JAVA_BASE += $(CHARSET_DONE_BASE)-stdcs
|
||||
|
||||
################################################################################
|
||||
#
|
||||
# Generate the sun/nio/cs/StandardCharsets.java file
|
||||
#
|
||||
CHARSET_STANDARD_GENSRC_DIR := $(SUPPORT_OUTPUTDIR)/gensrc/java.base/_standardcharsets
|
||||
CHARSET_STANDARD_DATA := $(CHARSET_DATA_DIR)/standard-charsets
|
||||
CHARSET_STANDARD_JAVA := sun/nio/cs/StandardCharsets.java
|
||||
|
||||
CHARSET_ALIASES_TABLES_AWK := ' \
|
||||
BEGIN { n = 1; m = 1; } \
|
||||
/^[ \t]*charset / { \
|
||||
csn = $$2; cln = $$3; \
|
||||
lcsn = tolower(csn); \
|
||||
lcsns[n++] = lcsn; \
|
||||
csns[lcsn] = csn; \
|
||||
classMap[lcsn] = cln; \
|
||||
if (n > 2) \
|
||||
printf " };\n\n"; \
|
||||
printf " static final String[] aliases_%s = new String[] {\n", cln; \
|
||||
} \
|
||||
/^[ \t]*alias / { \
|
||||
acsns[m++] = tolower($$2); \
|
||||
aliasMap[tolower($$2)] = lcsn; \
|
||||
printf " \"%s\",\n", $$2; \
|
||||
} \
|
||||
END { \
|
||||
printf " };\n\n"; \
|
||||
} '
|
||||
|
||||
CHARSET_ALIASES_MAP_AWK := ' \
|
||||
/^[ \t]*charset / { \
|
||||
csn = $$2; \
|
||||
lcsn = tolower(csn); \
|
||||
} \
|
||||
/^[ \t]*alias / { \
|
||||
an = tolower($$2); \
|
||||
printf "%-20s \"%s\"\n", an, lcsn; \
|
||||
} '
|
||||
|
||||
CHARSET_CLASSES_MAP_AWK := ' \
|
||||
/^[ \t]*charset / { \
|
||||
csn = $$2; cln = $$3; \
|
||||
lcsn = tolower(csn); \
|
||||
printf "%-20s \"%s\"\n", lcsn, cln; \
|
||||
} '
|
||||
|
||||
# This target should be referenced using the order-only operator (|)
|
||||
$(CHARSET_STANDARD_GENSRC_DIR):
|
||||
$(MKDIR) -p '$@'
|
||||
|
||||
$(CHARSET_STANDARD_GENSRC_DIR)/aliases-tables.java.snippet: $(CHARSET_STANDARD_DATA) \
|
||||
| $(CHARSET_STANDARD_GENSRC_DIR)
|
||||
$(NAWK) < '$<' > '$@' $(CHARSET_ALIASES_TABLES_AWK)
|
||||
|
||||
$(CHARSET_STANDARD_GENSRC_DIR)/aliases-map: $(CHARSET_STANDARD_DATA) \
|
||||
| $(CHARSET_STANDARD_GENSRC_DIR)
|
||||
$(NAWK) < '$<' > '$@' $(CHARSET_ALIASES_MAP_AWK)
|
||||
|
||||
$(CHARSET_STANDARD_GENSRC_DIR)/classes-map: $(CHARSET_STANDARD_DATA) \
|
||||
| $(CHARSET_STANDARD_GENSRC_DIR)
|
||||
$(NAWK) < '$<' > '$@' $(CHARSET_CLASSES_MAP_AWK)
|
||||
|
||||
$(CHARSET_STANDARD_GENSRC_DIR)/aliases-map.java.snippet: $(CHARSET_STANDARD_GENSRC_DIR)/aliases-map \
|
||||
$(BUILD_TOOLS_JDK) | $(CHARSET_STANDARD_GENSRC_DIR)
|
||||
$(TOOL_HASHER) -i Aliases < '$<' > '$@'
|
||||
|
||||
$(CHARSET_STANDARD_GENSRC_DIR)/classes-map.java.snippet: $(CHARSET_STANDARD_GENSRC_DIR)/classes-map \
|
||||
$(BUILD_TOOLS_JDK) | $(CHARSET_STANDARD_GENSRC_DIR)
|
||||
$(TOOL_HASHER) -i Classes < '$<' > '$@'
|
||||
|
||||
$(CHARSET_STANDARD_GENSRC_DIR)/cache-map.java.snippet: $(CHARSET_STANDARD_GENSRC_DIR)/classes-map \
|
||||
$(BUILD_TOOLS_JDK) | $(CHARSET_STANDARD_GENSRC_DIR)
|
||||
$(TOOL_HASHER) -i -e Cache -t Charset < '$<' > '$@'
|
||||
|
||||
$(eval $(call SetupTextFileProcessing, BUILD_CHARSET_STANDARD, \
|
||||
SOURCE_FILES := $(JDK_TOPDIR)/src/java.base/share/classes/$(CHARSET_STANDARD_JAVA).template, \
|
||||
OUTPUT_FILE := $(SUPPORT_OUTPUTDIR)/gensrc/java.base/$(CHARSET_STANDARD_JAVA), \
|
||||
INCLUDES := \
|
||||
_INCLUDE_ALIASES_TABLES_ => $(CHARSET_STANDARD_GENSRC_DIR)/aliases-tables.java.snippet ; \
|
||||
_INCLUDE_ALIASES_MAP_ => $(CHARSET_STANDARD_GENSRC_DIR)/aliases-map.java.snippet ; \
|
||||
_INCLUDE_CLASSES_MAP_ => $(CHARSET_STANDARD_GENSRC_DIR)/classes-map.java.snippet ; \
|
||||
_INCLUDE_CACHE_MAP_ => $(CHARSET_STANDARD_GENSRC_DIR)/cache-map.java.snippet ; , \
|
||||
))
|
||||
|
||||
# Processing of template depends on the snippets being generated first
|
||||
$(BUILD_CHARSET_STANDARD): \
|
||||
$(CHARSET_STANDARD_GENSRC_DIR)/aliases-tables.java.snippet \
|
||||
$(CHARSET_STANDARD_GENSRC_DIR)/aliases-map.java.snippet \
|
||||
$(CHARSET_STANDARD_GENSRC_DIR)/classes-map.java.snippet \
|
||||
$(CHARSET_STANDARD_GENSRC_DIR)/cache-map.java.snippet
|
||||
|
||||
GENSRC_JAVA_BASE += $(BUILD_CHARSET_STANDARD)
|
||||
|
||||
42
jdk/make/src/classes/build/tools/charsetmapping/Charset.java
Normal file
42
jdk/make/src/classes/build/tools/charsetmapping/Charset.java
Normal file
@ -0,0 +1,42 @@
|
||||
/*
|
||||
* Copyright (c) 2015, 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 build.tools.charsetmapping;
|
||||
|
||||
class Charset {
|
||||
String pkgName;
|
||||
String clzName;
|
||||
String csName;
|
||||
String hisName;
|
||||
String type;
|
||||
boolean isASCII;
|
||||
int b1Min;
|
||||
int b1Max;
|
||||
int b2Min;
|
||||
int b2Max;
|
||||
String[] aliases;
|
||||
boolean isGenSrc = false;
|
||||
boolean isInternal = false;
|
||||
}
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2010, 2015, 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
|
||||
@ -24,71 +24,32 @@
|
||||
*/
|
||||
|
||||
package build.tools.charsetmapping;
|
||||
|
||||
import java.io.*;
|
||||
import java.util.Arrays;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Scanner;
|
||||
import java.util.Formatter;
|
||||
import java.util.regex.*;
|
||||
import java.nio.charset.*;
|
||||
import java.util.regex.Pattern;
|
||||
import static build.tools.charsetmapping.Utils.*;
|
||||
|
||||
public class DBCS {
|
||||
// pattern used by this class to read in mapping table
|
||||
static Pattern mPattern = Pattern.compile("(?:0x)?(\\p{XDigit}++)\\s++(?:0x)?(\\p{XDigit}++)(?:\\s++#.*)?");
|
||||
|
||||
public static void genClass(String args[]) throws Exception {
|
||||
|
||||
Scanner s = new Scanner(new File(args[0], args[2]));
|
||||
while (s.hasNextLine()) {
|
||||
String line = s.nextLine();
|
||||
if (line.startsWith("#") || line.length() == 0)
|
||||
continue;
|
||||
String[] fields = line.split("\\s+");
|
||||
if (fields.length < 10) {
|
||||
System.err.println("Misconfiged sbcs line <" + line + ">?");
|
||||
continue;
|
||||
}
|
||||
String clzName = fields[0];
|
||||
String csName = fields[1];
|
||||
String hisName = ("null".equals(fields[2]))?null:fields[2];
|
||||
String type = fields[3].toUpperCase();
|
||||
if ("BASIC".equals(type))
|
||||
type = "";
|
||||
else
|
||||
type = "_" + type;
|
||||
String pkgName = fields[4];
|
||||
boolean isASCII = Boolean.valueOf(fields[5]);
|
||||
int b1Min = toInteger(fields[6]);
|
||||
int b1Max = toInteger(fields[7]);
|
||||
int b2Min = toInteger(fields[8]);
|
||||
int b2Max = toInteger(fields[9]);
|
||||
System.out.printf("%s,%s,%s,%b,%s%n", clzName, csName, hisName, isASCII, pkgName);
|
||||
genClass0(args[0], args[1], "DoubleByte-X.java.template",
|
||||
clzName, csName, hisName, pkgName,
|
||||
isASCII, type,
|
||||
b1Min, b1Max, b2Min, b2Max);
|
||||
}
|
||||
}
|
||||
|
||||
static int toInteger(String s) {
|
||||
if (s.startsWith("0x") || s.startsWith("0X"))
|
||||
return Integer.valueOf(s.substring(2), 16);
|
||||
else
|
||||
return Integer.valueOf(s);
|
||||
}
|
||||
|
||||
private static void genClass0(String srcDir, String dstDir, String template,
|
||||
String clzName,
|
||||
String csName,
|
||||
String hisName,
|
||||
String pkgName,
|
||||
boolean isASCII,
|
||||
String type,
|
||||
int b1Min, int b1Max,
|
||||
int b2Min, int b2Max)
|
||||
public static void genClass(String type, Charset cs,
|
||||
String srcDir, String dstDir, String template)
|
||||
throws Exception
|
||||
{
|
||||
String clzName = cs.clzName;
|
||||
String csName = cs.csName;
|
||||
String hisName = cs.hisName;
|
||||
String pkgName = cs.pkgName;
|
||||
boolean isASCII = cs.isASCII;
|
||||
int b1Min = cs.b1Min;
|
||||
int b1Max = cs.b1Max;
|
||||
int b2Min = cs.b2Min;
|
||||
int b2Max = cs.b2Max;
|
||||
|
||||
StringBuilder b2cSB = new StringBuilder();
|
||||
StringBuilder b2cNRSB = new StringBuilder();
|
||||
|
||||
@ -42,38 +42,51 @@ public class HKSCS {
|
||||
private static Pattern hkscs =
|
||||
Pattern.compile("(?:0x)?+(\\p{XDigit}++)\\s++(?:0x|U\\+)?+(\\p{XDigit}++)?\\s*+(?:0x|U\\+)?(\\p{XDigit}++)?\\s*+.*");
|
||||
|
||||
static void genClass(String args[]) throws Exception {
|
||||
|
||||
static void genClass2008(String srcDir, String dstDir, String pkgName)
|
||||
throws Exception
|
||||
{
|
||||
// hkscs2008
|
||||
genClass0(new FileInputStream(new File(args[0], "HKSCS2008.map")),
|
||||
new FileInputStream(new File(args[0], "HKSCS2008.c2b")),
|
||||
new PrintStream(new File(args[1], "HKSCSMapping.java"),
|
||||
genClass0(new FileInputStream(new File(srcDir, "HKSCS2008.map")),
|
||||
new FileInputStream(new File(srcDir, "HKSCS2008.c2b")),
|
||||
new PrintStream(new File(dstDir, "HKSCSMapping.java"),
|
||||
"ISO-8859-1"),
|
||||
pkgName,
|
||||
"HKSCSMapping",
|
||||
getCopyright(new File(args[3])));
|
||||
true,
|
||||
"");
|
||||
}
|
||||
|
||||
|
||||
// xp2001
|
||||
genClass0(new FileInputStream(new File(args[0], "HKSCS_XP.map")),
|
||||
static void genClassXP(String srcDir, String dstDir, String pkgName)
|
||||
throws Exception
|
||||
{
|
||||
genClass0(new FileInputStream(new File(srcDir, "HKSCS_XP.map")),
|
||||
null,
|
||||
new PrintStream(new File(args[1], "HKSCS_XPMapping.java"),
|
||||
new PrintStream(new File(dstDir, "HKSCS_XPMapping.java"),
|
||||
"ISO-8859-1"),
|
||||
pkgName,
|
||||
"HKSCS_XPMapping",
|
||||
getCopyright(new File(args[3])));
|
||||
false,
|
||||
"");
|
||||
}
|
||||
|
||||
static void genClass2001(String args[]) throws Exception {
|
||||
// hkscs2001
|
||||
genClass0(new FileInputStream(new File(args[0], "HKSCS2001.map")),
|
||||
new FileInputStream(new File(args[0], "HKSCS2001.c2b")),
|
||||
new PrintStream(new File(args[1], "HKSCS2001Mapping.java"),
|
||||
"ISO-8859-1"),
|
||||
"sun.nio.cs.ext",
|
||||
"HKSCS2001Mapping",
|
||||
false,
|
||||
getCopyright(new File(args[3])));
|
||||
}
|
||||
|
||||
static void genClass0(InputStream isB2C,
|
||||
InputStream isC2B,
|
||||
PrintStream ps,
|
||||
String pkgName,
|
||||
String clzName,
|
||||
boolean isPublic,
|
||||
String copyright)
|
||||
throws Exception
|
||||
{
|
||||
@ -132,8 +145,8 @@ public class HKSCS {
|
||||
|
||||
out.format(copyright);
|
||||
out.format("%n// -- This file was mechanically generated: Do not edit! -- //%n");
|
||||
out.format("package sun.nio.cs.ext;%n%n");
|
||||
out.format("class %s {%n%n", clzName);
|
||||
out.format("package %s;%n%n", pkgName);
|
||||
out.format("%sclass %s {%n%n", isPublic ? "public " : "", clzName);
|
||||
|
||||
/* hardcoded in sun.nio.cs.ext.HKSCS.java
|
||||
out.format(" final static int b1Min = 0x%x;%n", b1Min);
|
||||
@ -143,7 +156,8 @@ public class HKSCS {
|
||||
*/
|
||||
|
||||
// bmp tables
|
||||
out.format("%n static final String[] b2cBmpStr = new String[] {%n");
|
||||
out.format("%n %sstatic final String[] b2cBmpStr = new String[] {%n",
|
||||
isPublic ? "public " : "");
|
||||
for (int i = 0; i < 0x100; i++) {
|
||||
if (b2cBmp[i])
|
||||
out.format(bmp, i, b2Min, b2Max, ",");
|
||||
@ -153,7 +167,8 @@ public class HKSCS {
|
||||
out.format(" };%n");
|
||||
|
||||
// supp tables
|
||||
out.format("%n static final String[] b2cSuppStr =");
|
||||
out.format("%n %sstatic final String[] b2cSuppStr =",
|
||||
isPublic ? "public " : "");
|
||||
if (hasSupp) {
|
||||
out.format(" new String[] {%n");
|
||||
for (int i = 0; i < 0x100; i++) {
|
||||
@ -168,7 +183,8 @@ public class HKSCS {
|
||||
}
|
||||
|
||||
// private area tables
|
||||
out.format("%n final static String pua =");
|
||||
out.format("%n %sfinal static String pua =",
|
||||
isPublic ? "public " : "");
|
||||
if (hasPua) {
|
||||
out.format("%n");
|
||||
out.format(pua, 0, pua.length, ";");
|
||||
|
||||
265
jdk/make/src/classes/build/tools/charsetmapping/Hasher.java
Normal file
265
jdk/make/src/classes/build/tools/charsetmapping/Hasher.java
Normal file
@ -0,0 +1,265 @@
|
||||
/*
|
||||
* Copyright (c) 2004, 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 build.tools.charsetmapping;
|
||||
|
||||
import java.io.*;
|
||||
import java.util.*;
|
||||
|
||||
|
||||
/**
|
||||
* Reads a map in the form of a sequence of key/value-expression pairs from the
|
||||
* standard input, attempts to construct a hash map that fits within the given
|
||||
* table-size and chain-depth constraints, and, if successful, writes source
|
||||
* code to the standard output for a subclass of sun.util.PreHashedMap that
|
||||
* implements the map.
|
||||
*
|
||||
* @see sun.util.PreHashedMap
|
||||
*
|
||||
* @author Mark Reinhold
|
||||
*/
|
||||
|
||||
public class Hasher {
|
||||
|
||||
private PrintStream err = System.err;
|
||||
|
||||
boolean verbose = false;
|
||||
List<String> keys = new ArrayList<>(); // Key strings
|
||||
List<String> values = new ArrayList<>(); // Value expressions
|
||||
String pkg = null; // Package prefix for generated class
|
||||
String cln = null; // Name of generated class
|
||||
String vtype = null; // Value type
|
||||
int maxBits = 11; // lg table size
|
||||
int maxDepth = 3; // Max chain depth
|
||||
boolean inner = false; // Generating an inner class?
|
||||
boolean empty = false; // Generating an empty table?
|
||||
|
||||
Object[] ht; // Hash table itself
|
||||
int nb; // Number of bits (lg table size)
|
||||
int md; // Maximum chain depth
|
||||
int mask; // Hash-code mask
|
||||
int shift; // Hash-code shift size
|
||||
|
||||
int hash(String w) {
|
||||
return (w.hashCode() >> shift) & mask;
|
||||
}
|
||||
|
||||
// Build a hash table of size 2^nb, shifting the hash code by s bits
|
||||
//
|
||||
void build(int nb, int s) {
|
||||
|
||||
this.nb = nb;
|
||||
this.shift = s;
|
||||
int n = 1 << nb;
|
||||
this.mask = n - 1;
|
||||
ht = new Object[n];
|
||||
int nw = keys.size();
|
||||
|
||||
for (int i = 0; i < nw; i++) {
|
||||
String w = keys.get(i);
|
||||
String v = values.get(i);
|
||||
int h = hash(w);
|
||||
if (ht[h] == null)
|
||||
ht[h] = new Object[] { w, v };
|
||||
else
|
||||
ht[h] = new Object[] { w, v, ht[h] };
|
||||
}
|
||||
|
||||
this.md = 0;
|
||||
for (int i = 0; i < n; i++) {
|
||||
int d = 1;
|
||||
for (Object[] a = (Object[])ht[i];
|
||||
a != null && a.length > 2;
|
||||
a = (Object[])a[2], d++);
|
||||
this.md = Math.max(md, d);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Hasher build() {
|
||||
// Iterate through acceptable table sizes
|
||||
for (int nb = 2; nb < maxBits; nb++) {
|
||||
// Iterate through possible shift sizes
|
||||
for (int s = 0; s < (32 - nb); s++) {
|
||||
build(nb, s);
|
||||
if (verbose)
|
||||
err.println("nb=" + nb + " s=" + s + " md=" + md);
|
||||
if (md <= maxDepth) {
|
||||
// Success
|
||||
if (verbose) {
|
||||
if (cln != null)
|
||||
err.print(cln + ": ");
|
||||
err.println("Table size " + (1 << nb) + " (" + nb + " bits)"
|
||||
+ ", shift " + shift
|
||||
+ ", max chain depth " + md);
|
||||
}
|
||||
return this;
|
||||
}
|
||||
}
|
||||
}
|
||||
throw new RuntimeException("Cannot find a suitable size"
|
||||
+ " within given constraints");
|
||||
}
|
||||
|
||||
// Look for the given key in the hash table
|
||||
//
|
||||
String get(String k) {
|
||||
int h = hash(k);
|
||||
Object[] a = (Object[])ht[h];
|
||||
for (;;) {
|
||||
if (a[0].equals(k))
|
||||
return (String)a[1];
|
||||
if (a.length < 3)
|
||||
return null;
|
||||
a = (Object[])a[2];
|
||||
}
|
||||
}
|
||||
|
||||
// Test that all input keys can be found in the table
|
||||
//
|
||||
Hasher test() {
|
||||
if (verbose)
|
||||
err.println();
|
||||
for (int i = 0, n = keys.size(); i < n; i++) {
|
||||
String w = keys.get(i);
|
||||
String v = get(w);
|
||||
if (verbose)
|
||||
err.println(hash(w) + "\t" + w);
|
||||
if (!v.equals(values.get(i)))
|
||||
throw new Error("Incorrect value: " + w + " --> "
|
||||
+ v + ", should be " + values.get(i));
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
String ind = ""; // Indent prefix
|
||||
|
||||
// Generate code for a single table entry
|
||||
//
|
||||
void genEntry(Object[] a, int depth, PrintStream out) {
|
||||
Object v = empty ? null : a[1];
|
||||
out.print("new Object[] { \"" + a[0] + "\", " + v);
|
||||
if (a.length < 3) {
|
||||
out.print(" }");
|
||||
return;
|
||||
}
|
||||
out.println(",");
|
||||
out.print(ind + " ");
|
||||
for (int i = 0; i < depth; i++)
|
||||
out.print(" ");
|
||||
genEntry((Object[])a[2], depth + 1, out);
|
||||
out.print(" }");
|
||||
}
|
||||
|
||||
// Generate a PreHashedMap subclass from the computed hash table
|
||||
//
|
||||
Hasher generate(PrintStream out) throws IOException {
|
||||
if (cln == null)
|
||||
return this;
|
||||
|
||||
if (inner)
|
||||
ind = " ";
|
||||
|
||||
if (!inner && pkg != null) {
|
||||
out.println();
|
||||
out.println("package " + pkg + ";");
|
||||
out.println();
|
||||
}
|
||||
|
||||
if (inner) {
|
||||
out.println(ind + "private static final class " + cln);
|
||||
} else {
|
||||
out.println();
|
||||
out.println("public final class " + cln);
|
||||
}
|
||||
out.println(ind + " extends sun.util.PreHashedMap<" + vtype +">");
|
||||
out.println(ind + "{");
|
||||
|
||||
out.println();
|
||||
out.println(ind + " private static final int ROWS = "
|
||||
+ ht.length + ";");
|
||||
out.println(ind + " private static final int SIZE = "
|
||||
+ keys.size() + ";");
|
||||
out.println(ind + " private static final int SHIFT = "
|
||||
+ shift + ";");
|
||||
out.println(ind + " private static final int MASK = 0x"
|
||||
+ Integer.toHexString(mask) + ";");
|
||||
out.println();
|
||||
|
||||
out.println(ind + " " + (inner ? "private " : "public ")
|
||||
+ cln + "() {");
|
||||
out.println(ind + " super(ROWS, SIZE, SHIFT, MASK);");
|
||||
out.println(ind + " }");
|
||||
out.println();
|
||||
|
||||
out.println(ind + " protected void init(Object[] ht) {");
|
||||
for (int i = 0; i < ht.length; i++) {
|
||||
if (ht[i] == null)
|
||||
continue;
|
||||
Object[] a = (Object[])ht[i];
|
||||
out.print(ind + " ht[" + i + "] = ");
|
||||
genEntry(a, 0, out);
|
||||
out.println(";");
|
||||
}
|
||||
out.println(ind + " }");
|
||||
out.println();
|
||||
|
||||
out.println(ind + "}");
|
||||
if (inner)
|
||||
out.println();
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
private Hasher(List<String> keys, List<String> values,
|
||||
String pkg, String cln, String vtype,
|
||||
int maxBits, int maxDepth,
|
||||
boolean inner, boolean empty,
|
||||
boolean verbose) {
|
||||
this.keys = keys;
|
||||
this.values = values;
|
||||
this.pkg = pkg;
|
||||
this.cln = cln;
|
||||
this.vtype = vtype;
|
||||
this.maxBits = maxBits;
|
||||
this.maxDepth = maxDepth;
|
||||
this.inner = inner;
|
||||
this.empty = empty;
|
||||
this.verbose = verbose;
|
||||
}
|
||||
|
||||
public static void genClass(PrintStream out,
|
||||
List<String> keys, List<String> values,
|
||||
String pkg, String cln, String vtype,
|
||||
int maxBits, int maxDepth,
|
||||
boolean inner, boolean empty, boolean verbose)
|
||||
throws IOException {
|
||||
new Hasher(keys, values, pkg, cln, vtype,
|
||||
maxBits, maxDepth, inner, empty, verbose)
|
||||
.build()
|
||||
.test()
|
||||
.generate(out);
|
||||
}
|
||||
}
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2009, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2009, 2015, 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
|
||||
@ -26,25 +26,193 @@
|
||||
package build.tools.charsetmapping;
|
||||
|
||||
import java.io.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Scanner;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.Locale;
|
||||
|
||||
public class Main {
|
||||
|
||||
public static void main(String args[]) throws Exception {
|
||||
public static void main(String args[]) throws Throwable {
|
||||
int SRC_DIR = 0;
|
||||
int DST_DIR = 1;
|
||||
int TYPE = 2;
|
||||
int CHARSETS = 3;
|
||||
int OS = 4;
|
||||
int TEMPLATE = 5;
|
||||
int EXT_SRC = 6;
|
||||
|
||||
if (args.length < 3 ) {
|
||||
System.out.println("Usage: java -jar charsetmapping.jar src dst mType [copyrightSrc]");
|
||||
System.out.println("Usage: java -jar charsetmapping.jar src dst spiType charsets os [template]");
|
||||
System.exit(1);
|
||||
}
|
||||
if ("sbcs".equals(args[2]) || "extsbcs".equals(args[2])) {
|
||||
SBCS.genClass(args);
|
||||
} else if ("dbcs".equals(args[2])) {
|
||||
DBCS.genClass(args);
|
||||
} else if ("euctw".equals(args[2])) {
|
||||
boolean isStandard = "stdcs".equals(args[TYPE]);
|
||||
boolean isExtended = "extcs".equals(args[TYPE]);
|
||||
if (isStandard || isExtended) {
|
||||
LinkedHashMap<String, Charset> charsets = getCharsets(
|
||||
new File(args[SRC_DIR], args[CHARSETS]));
|
||||
String[] osStdcs = getOSStdCSList(new File(args[SRC_DIR], args[OS]));
|
||||
boolean hasBig5_HKSCS = false;
|
||||
boolean hasMS950_HKSCS_XP = false;
|
||||
for (String name : osStdcs) {
|
||||
Charset cs = charsets.get(name);
|
||||
if (cs != null) {
|
||||
cs.pkgName = "sun.nio.cs";
|
||||
}
|
||||
if (name.equals("Big5_HKSCS")) {
|
||||
hasBig5_HKSCS = true;
|
||||
} else if (name.equals("MS950_HKSCS_XP")) {
|
||||
hasMS950_HKSCS_XP = true;
|
||||
}
|
||||
}
|
||||
for (Charset cs : charsets.values()) {
|
||||
if (isStandard && cs.pkgName.equals("sun.nio.cs.ext") ||
|
||||
isExtended && cs.pkgName.equals("sun.nio.cs")) {
|
||||
continue;
|
||||
}
|
||||
verbose(cs);
|
||||
switch (cs.type) {
|
||||
case "template":
|
||||
SRC.genClass(cs, args[EXT_SRC], args[DST_DIR]);
|
||||
break;
|
||||
case "sbcs":
|
||||
SBCS.genClass(cs, args[SRC_DIR], args[DST_DIR],
|
||||
"SingleByte-X.java.template");
|
||||
break;
|
||||
case "source":
|
||||
break; // source file, do nothing
|
||||
default: // dbcs
|
||||
DBCS.genClass("dbcs".equals(cs.type) ?
|
||||
"" : "_" + cs.type.toUpperCase(Locale.ENGLISH),
|
||||
cs, args[SRC_DIR], args[DST_DIR],
|
||||
"DoubleByte-X.java.template");
|
||||
}
|
||||
}
|
||||
// provider StandardCharsets.java / ExtendedCharsets.java
|
||||
SPI.genClass(args[TYPE], charsets, args[SRC_DIR], args[DST_DIR], args[TEMPLATE]);
|
||||
|
||||
// HKSCSMapping2008/XP.java goes together with Big5/MS950XP_HKSCS
|
||||
if (isStandard && hasBig5_HKSCS || isExtended && !hasBig5_HKSCS) {
|
||||
HKSCS.genClass2008(args[SRC_DIR], args[DST_DIR],
|
||||
isStandard ? "sun.nio.cs" : "sun.nio.cs.ext");
|
||||
}
|
||||
if (isStandard && hasMS950_HKSCS_XP || isExtended && !hasMS950_HKSCS_XP) {
|
||||
HKSCS.genClassXP(args[SRC_DIR], args[DST_DIR],
|
||||
isStandard ? "sun.nio.cs" : "sun.nio.cs.ext");
|
||||
}
|
||||
} else if ("euctw".equals(args[TYPE])) {
|
||||
EUC_TW.genClass(args);
|
||||
} else if ("sjis0213".equals(args[2])) {
|
||||
} else if ("sjis0213".equals(args[TYPE])) {
|
||||
JIS0213.genClass(args);
|
||||
} else if ("hkscs".equals(args[2])) {
|
||||
HKSCS.genClass(args);
|
||||
} else if ("hkscs".equals(args[TYPE])) {
|
||||
HKSCS.genClass2001(args);
|
||||
}
|
||||
}
|
||||
|
||||
private static LinkedHashMap<String, Charset> getCharsets(File cslist)
|
||||
throws Throwable
|
||||
{
|
||||
LinkedHashMap<String, Charset> charsets = new LinkedHashMap<>();
|
||||
try (Scanner s = new Scanner(cslist)) {
|
||||
Charset cs = null;
|
||||
ArrayList<String> names = new ArrayList<>();
|
||||
while (s.hasNextLine()) {
|
||||
String line = s.nextLine();
|
||||
if (line.startsWith("#") || line.length() == 0) {
|
||||
continue;
|
||||
}
|
||||
String[] tokens = line.split("\\s+");
|
||||
if (tokens.length < 2) {
|
||||
continue;
|
||||
}
|
||||
if ("charset".equals(tokens[0])) {
|
||||
if (cs != null) {
|
||||
cs.aliases = names.toArray(new String[names.size()]);
|
||||
charsets.put(cs.clzName, cs);
|
||||
cs = null;
|
||||
names.clear();
|
||||
}
|
||||
if (tokens.length < 3) {
|
||||
throw new RuntimeException("Error: incorrect charset line [" + line + "]");
|
||||
}
|
||||
if ((cs = charsets.get(tokens[2])) != null) {
|
||||
throw new RuntimeException("Error: deplicate charset line [" + line + "]");
|
||||
}
|
||||
cs = new Charset();
|
||||
cs.csName = tokens[1];
|
||||
cs.clzName = tokens[2];
|
||||
} else {
|
||||
String key = tokens[1]; // leading empty str
|
||||
switch (key) {
|
||||
case "alias":
|
||||
if (tokens.length < 3) {
|
||||
throw new RuntimeException("Error: incorrect alias line [" + line + "]");
|
||||
} else if (names != null) {
|
||||
names.add(tokens[2]); // ALIAS_NAME
|
||||
}
|
||||
break;
|
||||
case "package":
|
||||
cs.pkgName = tokens[2];
|
||||
break;
|
||||
case "type":
|
||||
cs.type = tokens[2];
|
||||
break;
|
||||
case "hisname":
|
||||
cs.hisName = tokens[2];
|
||||
break;
|
||||
case "ascii":
|
||||
cs.isASCII = Boolean.parseBoolean(tokens[2]);
|
||||
break;
|
||||
case "minmax":
|
||||
cs.b1Min = toInteger(tokens[2]);
|
||||
cs.b1Max = toInteger(tokens[3]);
|
||||
cs.b2Min = toInteger(tokens[4]);
|
||||
cs.b2Max = toInteger(tokens[5]);
|
||||
break;
|
||||
case "internal":
|
||||
cs.isInternal = Boolean.parseBoolean(tokens[2]);
|
||||
break;
|
||||
default: // ignore
|
||||
}
|
||||
}
|
||||
}
|
||||
if (cs != null) {
|
||||
cs.aliases = names.toArray(new String[names.size()]);
|
||||
charsets.put(cs.clzName, cs);
|
||||
}
|
||||
}
|
||||
return charsets;
|
||||
}
|
||||
|
||||
private static String[] getOSStdCSList(File stdcsos) throws Throwable
|
||||
{
|
||||
ArrayList<String> names = new ArrayList<>();
|
||||
if (stdcsos.exists()) {
|
||||
try (Scanner s = new Scanner(stdcsos)) {
|
||||
while (s.hasNextLine()) {
|
||||
String line = s.nextLine();
|
||||
int i = line.indexOf('#');
|
||||
if (i != -1) {
|
||||
line = line.substring(0, i);
|
||||
}
|
||||
line = line.trim();
|
||||
if (line.length() != 0) {
|
||||
names.add(line);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return names.toArray(new String[names.size()]);
|
||||
}
|
||||
|
||||
static void verbose(Charset cs) {
|
||||
System.err.printf("%s, %s, %s, %s, %s %b%n",
|
||||
cs.clzName, cs.csName, cs.hisName, cs.pkgName, cs.type, cs.isASCII);
|
||||
}
|
||||
|
||||
static int toInteger(String s) {
|
||||
return (s.startsWith("0x") || s.startsWith("0X"))
|
||||
? Integer.valueOf(s.substring(2), 16)
|
||||
: Integer.valueOf(s);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2008, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2008, 2015, 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
|
||||
@ -30,93 +30,23 @@ import java.util.Arrays;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Scanner;
|
||||
import java.util.Formatter;
|
||||
import java.util.regex.*;
|
||||
import java.nio.charset.*;
|
||||
import java.util.regex.Pattern;
|
||||
import static build.tools.charsetmapping.Utils.*;
|
||||
|
||||
public class SBCS {
|
||||
|
||||
public static void genClass(String args[]) throws Exception {
|
||||
|
||||
Scanner s = new Scanner(new File(args[0], args[2]));
|
||||
while (s.hasNextLine()) {
|
||||
String line = s.nextLine();
|
||||
if (line.startsWith("#") || line.length() == 0)
|
||||
continue;
|
||||
String[] fields = line.split("\\s+");
|
||||
if (fields.length < 5) {
|
||||
System.err.println("Misconfiged sbcs line <" + line + ">?");
|
||||
continue;
|
||||
}
|
||||
String clzName = fields[0];
|
||||
String csName = fields[1];
|
||||
String hisName = fields[2];
|
||||
boolean isASCII = Boolean.valueOf(fields[3]);
|
||||
String pkgName = fields[4];
|
||||
System.out.printf("%s,%s,%s,%b,%s%n", clzName, csName, hisName, isASCII, pkgName);
|
||||
|
||||
genClass0(args[0], args[1], "SingleByte-X.java.template",
|
||||
clzName, csName, hisName, pkgName, isASCII);
|
||||
}
|
||||
}
|
||||
|
||||
private static void toString(char[] sb, int off, int end,
|
||||
Formatter out, String closure,
|
||||
boolean comment) {
|
||||
while (off < end) {
|
||||
out.format(" \"");
|
||||
for (int j = 0; j < 8; j++) {
|
||||
if (off == end)
|
||||
break;
|
||||
char c = sb[off++];
|
||||
switch (c) {
|
||||
case '\b':
|
||||
out.format("\\b"); break;
|
||||
case '\t':
|
||||
out.format("\\t"); break;
|
||||
case '\n':
|
||||
out.format("\\n"); break;
|
||||
case '\f':
|
||||
out.format("\\f"); break;
|
||||
case '\r':
|
||||
out.format("\\r"); break;
|
||||
case '\"':
|
||||
out.format("\\\""); break;
|
||||
case '\'':
|
||||
out.format("\\'"); break;
|
||||
case '\\':
|
||||
out.format("\\\\"); break;
|
||||
default:
|
||||
out.format("\\u%04X", c & 0xffff);
|
||||
}
|
||||
}
|
||||
if (comment) {
|
||||
if (off == end)
|
||||
out.format("\" %s // 0x%02x - 0x%02x%n",
|
||||
closure, off-8, off-1);
|
||||
else
|
||||
out.format("\" + // 0x%02x - 0x%02x%n",
|
||||
off-8, off-1);
|
||||
} else {
|
||||
if (off == end)
|
||||
out.format("\"%s%n", closure);
|
||||
else
|
||||
out.format("\" +%n");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static Pattern sbmap = Pattern.compile("0x(\\p{XDigit}++)\\s++(?:U\\+|0x)?(\\p{XDigit}++)(?:\\s++#.*)?");
|
||||
|
||||
private static void genClass0(String srcDir, String dstDir,
|
||||
String template,
|
||||
String clzName,
|
||||
String csName,
|
||||
String hisName,
|
||||
String pkgName,
|
||||
boolean isASCII)
|
||||
public static void genClass(Charset cs,
|
||||
String srcDir, String dstDir, String template)
|
||||
throws Exception
|
||||
{
|
||||
String clzName = cs.clzName;
|
||||
String csName = cs.csName;
|
||||
String hisName = cs.hisName;
|
||||
String pkgName = cs.pkgName;
|
||||
boolean isASCII = cs.isASCII;
|
||||
|
||||
StringBuilder b2cSB = new StringBuilder();
|
||||
StringBuilder b2cNRSB = new StringBuilder();
|
||||
StringBuilder c2bNRSB = new StringBuilder();
|
||||
@ -266,4 +196,50 @@ public class SBCS {
|
||||
}
|
||||
out.close();
|
||||
}
|
||||
|
||||
private static void toString(char[] sb, int off, int end,
|
||||
Formatter out, String closure, boolean comment)
|
||||
{
|
||||
while (off < end) {
|
||||
out.format(" \"");
|
||||
for (int j = 0; j < 8; j++) {
|
||||
if (off == end)
|
||||
break;
|
||||
char c = sb[off++];
|
||||
switch (c) {
|
||||
case '\b':
|
||||
out.format("\\b"); break;
|
||||
case '\t':
|
||||
out.format("\\t"); break;
|
||||
case '\n':
|
||||
out.format("\\n"); break;
|
||||
case '\f':
|
||||
out.format("\\f"); break;
|
||||
case '\r':
|
||||
out.format("\\r"); break;
|
||||
case '\"':
|
||||
out.format("\\\""); break;
|
||||
case '\'':
|
||||
out.format("\\'"); break;
|
||||
case '\\':
|
||||
out.format("\\\\"); break;
|
||||
default:
|
||||
out.format("\\u%04X", c & 0xffff);
|
||||
}
|
||||
}
|
||||
if (comment) {
|
||||
if (off == end)
|
||||
out.format("\" %s // 0x%02x - 0x%02x%n",
|
||||
closure, off-8, off-1);
|
||||
else
|
||||
out.format("\" + // 0x%02x - 0x%02x%n",
|
||||
off-8, off-1);
|
||||
} else {
|
||||
if (off == end)
|
||||
out.format("\"%s%n", closure);
|
||||
else
|
||||
out.format("\" +%n");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
141
jdk/make/src/classes/build/tools/charsetmapping/SPI.java
Normal file
141
jdk/make/src/classes/build/tools/charsetmapping/SPI.java
Normal file
@ -0,0 +1,141 @@
|
||||
/*
|
||||
* Copyright (c) 2015, 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 build.tools.charsetmapping;
|
||||
|
||||
import java.io.*;
|
||||
import java.util.Locale;
|
||||
import java.util.ArrayList;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.Scanner;
|
||||
|
||||
public class SPI {
|
||||
|
||||
public static void genClass(String type, LinkedHashMap<String, Charset> charsets,
|
||||
String srcDir, String dstDir, String template)
|
||||
throws Exception
|
||||
{
|
||||
try (Scanner s = new Scanner(new File(template));
|
||||
PrintStream out = new PrintStream(new FileOutputStream(
|
||||
new File(dstDir, new File(
|
||||
template.replace(".template", "")).getName()))); ) {
|
||||
if (type.startsWith("extcs")) { // ExtendedCharsets.java
|
||||
while (s.hasNextLine()) {
|
||||
String line = s.nextLine();
|
||||
if (line.indexOf("_CHARSETS_DEF_LIST_") == -1) {
|
||||
out.println(line);
|
||||
} else {
|
||||
charsets.values()
|
||||
.stream()
|
||||
.filter(cs -> cs.pkgName.equals("sun.nio.cs.ext") &&
|
||||
!cs.isInternal)
|
||||
.forEach( cs -> {
|
||||
out.printf(" charset(\"%s\", \"%s\",%n", cs.csName, cs.clzName);
|
||||
out.printf(" new String[] {%n");
|
||||
for (String alias : cs.aliases) {
|
||||
out.printf(" \"%s\",%n", alias);
|
||||
}
|
||||
out.printf(" });%n%n");
|
||||
});
|
||||
}
|
||||
}
|
||||
} else if (type.startsWith("stdcs")) { // StandardCharsets.java
|
||||
ArrayList<String> aliasKeys = new ArrayList<>();
|
||||
ArrayList<String> aliasValues = new ArrayList<>();
|
||||
ArrayList<String> clzKeys = new ArrayList<>();
|
||||
ArrayList<String> clzValues = new ArrayList<>();
|
||||
charsets.values()
|
||||
.stream()
|
||||
.filter(cs -> cs.pkgName.equals("sun.nio.cs") &&
|
||||
!cs.isInternal)
|
||||
.forEach( cs -> {
|
||||
String csname = cs.csName.toLowerCase(Locale.ENGLISH);
|
||||
clzKeys.add(csname);
|
||||
clzValues.add("\"" + cs.clzName + "\"");
|
||||
if (cs.aliases != null) {
|
||||
csname = "\"" + csname + "\"";
|
||||
for (String alias : cs.aliases) {
|
||||
aliasKeys.add(alias.toLowerCase(Locale.ENGLISH));
|
||||
aliasValues.add(csname);
|
||||
}
|
||||
}
|
||||
});
|
||||
while (s.hasNextLine()) {
|
||||
String line = s.nextLine();
|
||||
if (line.indexOf("_INCLUDE_ALIASES_TABLES_") != -1) {
|
||||
charsets.values()
|
||||
.stream()
|
||||
.filter(cs -> cs.pkgName.equals("sun.nio.cs"))
|
||||
.forEach( cs -> {
|
||||
if (cs.aliases == null || cs.aliases.length == 0) {
|
||||
out.printf(" static final String[] aliases_%s = null;%n%n",
|
||||
cs.clzName);
|
||||
} else {
|
||||
// non-final for SJIS and MS932 to support sun.nio.cs.map
|
||||
if (cs.clzName.equals("SJIS") || cs.clzName.equals("MS932")) {
|
||||
out.printf(" static String[] aliases_%s = new String[] {%n",
|
||||
cs.clzName);
|
||||
} else {
|
||||
out.printf(" static final String[] aliases_%s = new String[] {%n",
|
||||
cs.clzName);
|
||||
}
|
||||
for (String alias : cs.aliases) {
|
||||
out.printf(" \"%s\",%n", alias);
|
||||
}
|
||||
out.printf(" };%n%n");
|
||||
}
|
||||
});
|
||||
Charset cs = charsets.get("SJIS");
|
||||
if (cs == null || cs.pkgName.equals("sun.nio.cs.ext")) {
|
||||
// StandardCharsets.java has explicit reference
|
||||
// to aliases_SJIS/MS932. If we don't have these
|
||||
// two in std, just put a pair of dummy fields to
|
||||
// make the compiler happy.
|
||||
out.printf(" static String[] aliases_SJIS = null;%n%n");
|
||||
out.printf(" static String[] aliases_MS932 = null;%n%n");
|
||||
}
|
||||
} else if (line.indexOf("_INCLUDE_ALIASES_MAP_") != -1) {
|
||||
Hasher.genClass(out, aliasKeys, aliasValues,
|
||||
null, "Aliases", "String",
|
||||
11, 3, true, false, false);
|
||||
} else if (line.indexOf("_INCLUDE_CLASSES_MAP_") != -1) {
|
||||
Hasher.genClass(out, clzKeys, clzValues,
|
||||
null, "Classes", "String",
|
||||
11, 3, true, false, false);
|
||||
} else if (line.indexOf("_INCLUDE_CACHE_MAP_") != -1) {
|
||||
Hasher.genClass(out, clzKeys, clzValues,
|
||||
null, "Cache", "Charset",
|
||||
11, 3, true, true, false);
|
||||
} else {
|
||||
out.println(line);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
throw new RuntimeException("Unknown type:" + type);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
64
jdk/make/src/classes/build/tools/charsetmapping/SRC.java
Normal file
64
jdk/make/src/classes/build/tools/charsetmapping/SRC.java
Normal file
@ -0,0 +1,64 @@
|
||||
/*
|
||||
* Copyright (c) 2015, 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 build.tools.charsetmapping;
|
||||
|
||||
import java.io.*;
|
||||
import java.util.Scanner;
|
||||
|
||||
public class SRC {
|
||||
|
||||
public static void genClass(Charset cs, String srcDir, String dstDir)
|
||||
throws Exception
|
||||
{
|
||||
String clzName = cs.clzName;
|
||||
String csName = cs.csName;
|
||||
String pkgName = cs.pkgName;
|
||||
|
||||
try (Scanner s = new Scanner(new File(srcDir, clzName + ".java.template"));
|
||||
PrintStream out = new PrintStream(new FileOutputStream(
|
||||
new File(dstDir, clzName + ".java")));) {
|
||||
while (s.hasNextLine()) {
|
||||
String line = s.nextLine();
|
||||
if (line.indexOf("$") < 0) {
|
||||
out.println(line);
|
||||
continue;
|
||||
}
|
||||
if (line.indexOf("$PACKAGE$") != -1) {
|
||||
out.println(line.replace("$PACKAGE$", pkgName));
|
||||
} else if (line.indexOf("$ALIASES$") != -1) {
|
||||
if ("sun.nio.cs".equals(pkgName))
|
||||
out.println(line.replace("$ALIASES$",
|
||||
"StandardCharsets.aliases_" + clzName));
|
||||
else
|
||||
out.println(line.replace("$ALIASES$",
|
||||
"ExtendedCharsets.aliasesFor(\"" + csName + "\")"));
|
||||
} else {
|
||||
out.println(line);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -111,6 +111,12 @@ public class AbstractCharsetProvider
|
||||
}
|
||||
}
|
||||
|
||||
protected boolean hasCharset(String name) {
|
||||
synchronized (this) {
|
||||
return classMap.containsKey(name);
|
||||
}
|
||||
}
|
||||
|
||||
/* Late initialization hook, needed by some providers
|
||||
*/
|
||||
protected void init() { }
|
||||
|
||||
@ -23,7 +23,7 @@
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package sun.nio.cs.ext;
|
||||
package sun.nio.cs;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
import java.nio.CharBuffer;
|
||||
@ -34,7 +34,7 @@ import java.nio.charset.CoderResult;
|
||||
* when normal inheritance cannot be used.
|
||||
* Used by autodecting decoders.
|
||||
*/
|
||||
interface DelegatableDecoder {
|
||||
public interface DelegatableDecoder {
|
||||
CoderResult decodeLoop(ByteBuffer src, CharBuffer dst);
|
||||
void implReset();
|
||||
CoderResult implFlush(CharBuffer out);
|
||||
@ -23,7 +23,7 @@
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package sun.nio.cs.ext;
|
||||
package sun.nio.cs;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
import java.nio.CharBuffer;
|
||||
@ -130,9 +130,9 @@ public class DoubleByte {
|
||||
return CoderResult.unmappableForLength(2);
|
||||
}
|
||||
|
||||
Decoder(Charset cs, float avgcpb, float maxcpb,
|
||||
char[][] b2c, char[] b2cSB,
|
||||
int b2Min, int b2Max) {
|
||||
public 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;
|
||||
@ -140,7 +140,7 @@ public class DoubleByte {
|
||||
this.b2Max = b2Max;
|
||||
}
|
||||
|
||||
Decoder(Charset cs, char[][] b2c, char[] b2cSB, int b2Min, int b2Max) {
|
||||
public Decoder(Charset cs, char[][] b2c, char[] b2cSB, int b2Min, int b2Max) {
|
||||
this(cs, 0.5f, 1.0f, b2c, b2cSB, b2Min, b2Max);
|
||||
}
|
||||
|
||||
@ -273,7 +273,7 @@ public class DoubleByte {
|
||||
private static final int SI = 0x0f;
|
||||
private int currentState;
|
||||
|
||||
Decoder_EBCDIC(Charset cs,
|
||||
public Decoder_EBCDIC(Charset cs,
|
||||
char[][] b2c, char[] b2cSB, int b2Min, int b2Max) {
|
||||
super(cs, b2c, b2cSB, b2Min, b2Max);
|
||||
}
|
||||
@ -451,7 +451,7 @@ public class DoubleByte {
|
||||
b2cSB_UNMAPPABLE = new char[0x100];
|
||||
Arrays.fill(b2cSB_UNMAPPABLE, UNMAPPABLE_DECODING);
|
||||
}
|
||||
Decoder_DBCSONLY(Charset cs, char[][] b2c, char[] b2cSB, int b2Min, int b2Max) {
|
||||
public Decoder_DBCSONLY(Charset cs, char[][] b2c, char[] b2cSB, int b2Min, int b2Max) {
|
||||
super(cs, 0.5f, 1.0f, b2c, b2cSB_UNMAPPABLE, b2Min, b2Max);
|
||||
}
|
||||
}
|
||||
@ -463,7 +463,7 @@ public class DoubleByte {
|
||||
private final int SS2 = 0x8E;
|
||||
private final int SS3 = 0x8F;
|
||||
|
||||
Decoder_EUC_SIM(Charset cs,
|
||||
public Decoder_EUC_SIM(Charset cs,
|
||||
char[][] b2c, char[] b2cSB, int b2Min, int b2Max) {
|
||||
super(cs, b2c, b2cSB, b2Min, b2Max);
|
||||
}
|
||||
@ -511,18 +511,18 @@ public class DoubleByte {
|
||||
public static class Encoder extends CharsetEncoder
|
||||
implements ArrayEncoder
|
||||
{
|
||||
final int MAX_SINGLEBYTE = 0xff;
|
||||
protected final int MAX_SINGLEBYTE = 0xff;
|
||||
private final char[] c2b;
|
||||
private final char[] c2bIndex;
|
||||
Surrogate.Parser sgp;
|
||||
protected Surrogate.Parser sgp;
|
||||
|
||||
protected Encoder(Charset cs, char[] c2b, char[] c2bIndex) {
|
||||
public 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) {
|
||||
public Encoder(Charset cs, float avg, float max, byte[] repl, char[] c2b, char[] c2bIndex) {
|
||||
super(cs, avg, max, repl);
|
||||
this.c2b = c2b;
|
||||
this.c2bIndex = c2bIndex;
|
||||
@ -532,7 +532,7 @@ public class DoubleByte {
|
||||
return encodeChar(c) != UNMAPPABLE_ENCODING;
|
||||
}
|
||||
|
||||
Surrogate.Parser sgp() {
|
||||
protected Surrogate.Parser sgp() {
|
||||
if (sgp == null)
|
||||
sgp = new Surrogate.Parser();
|
||||
return sgp;
|
||||
@ -657,7 +657,7 @@ public class DoubleByte {
|
||||
}
|
||||
|
||||
// init the c2b and c2bIndex tables from b2c.
|
||||
static void initC2B(String[] b2c, String b2cSB, String b2cNR, String c2bNR,
|
||||
public static void initC2B(String[] b2c, String b2cSB, String b2cNR, String c2bNR,
|
||||
int b2Min, int b2Max,
|
||||
char[] c2b, char[] c2bIndex)
|
||||
{
|
||||
@ -741,7 +741,7 @@ public class DoubleByte {
|
||||
}
|
||||
|
||||
public static class Encoder_DBCSONLY extends Encoder {
|
||||
Encoder_DBCSONLY(Charset cs, byte[] repl,
|
||||
public Encoder_DBCSONLY(Charset cs, byte[] repl,
|
||||
char[] c2b, char[] c2bIndex) {
|
||||
super(cs, 2.0f, 2.0f, repl, c2b, c2bIndex);
|
||||
}
|
||||
@ -764,7 +764,7 @@ public class DoubleByte {
|
||||
|
||||
protected int currentState = SBCS;
|
||||
|
||||
Encoder_EBCDIC(Charset cs, char[] c2b, char[] c2bIndex) {
|
||||
public Encoder_EBCDIC(Charset cs, char[] c2b, char[] c2bIndex) {
|
||||
super(cs, 4.0f, 5.0f, new byte[] {(byte)0x6f}, c2b, c2bIndex);
|
||||
}
|
||||
|
||||
@ -921,7 +921,7 @@ public class DoubleByte {
|
||||
|
||||
// EUC_SIMPLE
|
||||
public static class Encoder_EUC_SIM extends Encoder {
|
||||
Encoder_EUC_SIM(Charset cs, char[] c2b, char[] c2bIndex) {
|
||||
public Encoder_EUC_SIM(Charset cs, char[] c2b, char[] c2bIndex) {
|
||||
super(cs, c2b, c2bIndex);
|
||||
}
|
||||
}
|
||||
@ -23,7 +23,7 @@
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package sun.nio.cs.ext;
|
||||
package sun.nio.cs;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
import java.nio.CharBuffer;
|
||||
@ -32,6 +32,7 @@ import java.nio.charset.CharsetDecoder;
|
||||
import java.nio.charset.CharsetEncoder;
|
||||
import java.nio.charset.CoderResult;
|
||||
import java.util.Arrays;
|
||||
import sun.nio.cs.DoubleByte;
|
||||
import sun.nio.cs.Surrogate;
|
||||
import static sun.nio.cs.CharsetMapping.*;
|
||||
|
||||
@ -216,7 +217,7 @@ public class HKSCS {
|
||||
return decodeBufferLoop(src, dst);
|
||||
}
|
||||
|
||||
static void initb2c(char[][]b2c, String[] b2cStr)
|
||||
public static void initb2c(char[][]b2c, String[] b2cStr)
|
||||
{
|
||||
for (int i = 0; i < b2cStr.length; i++) {
|
||||
if (b2cStr[i] == null)
|
||||
@ -395,7 +396,7 @@ public class HKSCS {
|
||||
Arrays.fill(C2B_UNMAPPABLE, (char)UNMAPPABLE_ENCODING);
|
||||
}
|
||||
|
||||
static void initc2b(char[][] c2b, String[] b2cStr, String pua) {
|
||||
public static void initc2b(char[][] c2b, String[] b2cStr, String pua) {
|
||||
// init c2b/c2bSupp from b2cStr and supp
|
||||
int b2Min = 0x40;
|
||||
Arrays.fill(c2b, C2B_UNMAPPABLE);
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved.
|
||||
*
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
@ -29,20 +29,188 @@
|
||||
|
||||
package sun.nio.cs;
|
||||
|
||||
import java.nio.charset.*;
|
||||
import java.nio.charset.Charset;
|
||||
import java.nio.charset.spi.CharsetProvider;
|
||||
import java.util.Iterator;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.security.AccessController;
|
||||
import java.security.PrivilegedAction;
|
||||
|
||||
|
||||
public class StandardCharsets
|
||||
extends FastCharsetProvider
|
||||
{
|
||||
public class StandardCharsets extends CharsetProvider {
|
||||
|
||||
_INCLUDE_ALIASES_TABLES_
|
||||
_INCLUDE_ALIASES_MAP_
|
||||
_INCLUDE_CLASSES_MAP_
|
||||
_INCLUDE_CACHE_MAP_
|
||||
|
||||
// Maps canonical names to class names
|
||||
private Map<String,String> classMap;
|
||||
// Maps alias names to canonical names
|
||||
private Map<String,String> aliasMap;
|
||||
// Maps canonical names to cached instances
|
||||
private Map<String,Charset> cache;
|
||||
|
||||
private String packagePrefix = "sun.nio.cs";
|
||||
|
||||
public StandardCharsets() {
|
||||
super("sun.nio.cs", new Aliases(), new Classes(), new Cache());
|
||||
this.aliasMap = new Aliases();
|
||||
this.classMap = new Classes();
|
||||
this.cache = new Cache();
|
||||
}
|
||||
|
||||
private String canonicalize(String csn) {
|
||||
String acn = aliasMap.get(csn);
|
||||
return (acn != null) ? acn : csn;
|
||||
}
|
||||
|
||||
// Private ASCII-only version, optimized for interpretation during startup
|
||||
//
|
||||
private static String toLower(String s) {
|
||||
int n = s.length();
|
||||
boolean allLower = true;
|
||||
for (int i = 0; i < n; i++) {
|
||||
int c = s.charAt(i);
|
||||
if (((c - 'A') | ('Z' - c)) >= 0) {
|
||||
allLower = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (allLower)
|
||||
return s;
|
||||
char[] ca = new char[n];
|
||||
for (int i = 0; i < n; i++) {
|
||||
int c = s.charAt(i);
|
||||
if (((c - 'A') | ('Z' - c)) >= 0)
|
||||
ca[i] = (char)(c + 0x20);
|
||||
else
|
||||
ca[i] = (char)c;
|
||||
}
|
||||
return new String(ca);
|
||||
}
|
||||
|
||||
private Charset lookup(String charsetName) {
|
||||
init();
|
||||
String csn = canonicalize(toLower(charsetName));
|
||||
|
||||
// Check cache first
|
||||
Charset cs = cache.get(csn);
|
||||
if (cs != null)
|
||||
return cs;
|
||||
|
||||
// Do we even support this charset?
|
||||
String cln = classMap.get(csn);
|
||||
if (cln == null)
|
||||
return null;
|
||||
|
||||
if (cln.equals("US_ASCII")) {
|
||||
cs = new US_ASCII();
|
||||
cache.put(csn, cs);
|
||||
return cs;
|
||||
}
|
||||
|
||||
// Instantiate the charset and cache it
|
||||
try {
|
||||
Class<?> c = Class.forName(packagePrefix + "." + cln,
|
||||
true,
|
||||
this.getClass().getClassLoader());
|
||||
cs = (Charset)c.newInstance();
|
||||
cache.put(csn, cs);
|
||||
return cs;
|
||||
} catch (ClassNotFoundException |
|
||||
IllegalAccessException |
|
||||
InstantiationException x) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public final Charset charsetForName(String charsetName) {
|
||||
synchronized (this) {
|
||||
return lookup(canonicalize(charsetName));
|
||||
}
|
||||
}
|
||||
|
||||
public final Iterator<Charset> charsets() {
|
||||
synchronized (this) {
|
||||
init();
|
||||
}
|
||||
return new Iterator<Charset>() {
|
||||
|
||||
Iterator<String> i = classMap.keySet().iterator();
|
||||
|
||||
public boolean hasNext() {
|
||||
return i.hasNext();
|
||||
}
|
||||
|
||||
public Charset next() {
|
||||
String csn = i.next();
|
||||
return lookup(csn);
|
||||
}
|
||||
|
||||
public void remove() {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
};
|
||||
}
|
||||
|
||||
private boolean initialized = false;
|
||||
|
||||
/* provider the sun.nio.cs.map property fir sjis/ms932 mapping hack
|
||||
*/
|
||||
private void init() {
|
||||
if (initialized)
|
||||
return;
|
||||
if (!sun.misc.VM.isBooted())
|
||||
return;
|
||||
initialized = true;
|
||||
|
||||
String map = getProperty("sun.nio.cs.map");
|
||||
if (map != null) {
|
||||
String[] maps = map.split(",");
|
||||
for (int i = 0; i < maps.length; i++) {
|
||||
if (maps[i].equalsIgnoreCase("Windows-31J/Shift_JIS")) {
|
||||
// if we dont have both sjis and ms932, do nothing
|
||||
if (classMap.get("shift_jis") == null ||
|
||||
classMap.get("windows-31j") == null) {
|
||||
break;
|
||||
}
|
||||
aliases_MS932 = new String[] {
|
||||
"MS932", // JDK historical
|
||||
"windows-932",
|
||||
"csWindows31J",
|
||||
"shift-jis",
|
||||
"ms_kanji",
|
||||
"x-sjis",
|
||||
"csShiftJIS",
|
||||
// This alias takes precedence over the actual
|
||||
// Shift_JIS charset itself since aliases are always
|
||||
// resolved first, before looking up canonical names.
|
||||
"shift_jis"
|
||||
};
|
||||
aliases_SJIS = new String[] { "sjis" };
|
||||
|
||||
for (String alias : aliases_MS932) {
|
||||
aliasMap.put(toLower(alias), "windows-31j");
|
||||
}
|
||||
cache.put("shift_jis", null);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static String getProperty(String key) {
|
||||
// this method may be called during initialization of
|
||||
// system class loader and thus not using lambda
|
||||
return AccessController.doPrivileged(
|
||||
new PrivilegedAction<String>() {
|
||||
@Override
|
||||
public String run() {
|
||||
return System.getProperty(key);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -34,11 +34,21 @@ import java.nio.charset.CharsetDecoder;
|
||||
ExtendedCharsets class, because if we want to have a public HKSCS,
|
||||
it probably should be HKSCS_2001 not HKSCS.
|
||||
*/
|
||||
public class HKSCS extends sun.nio.cs.ext.MS950_HKSCS_XP {
|
||||
public class HKSCS extends Charset {
|
||||
private static Charset cs = Charset.forName("x-MS950-HKSCS-XP");
|
||||
|
||||
public HKSCS () {
|
||||
super();
|
||||
super("HKSCS", null);
|
||||
}
|
||||
public boolean contains(Charset cs) {
|
||||
return (cs instanceof HKSCS);
|
||||
}
|
||||
|
||||
public CharsetDecoder newDecoder() {
|
||||
return cs.newDecoder();
|
||||
}
|
||||
|
||||
public CharsetEncoder newEncoder() {
|
||||
return cs.newEncoder();
|
||||
}
|
||||
}
|
||||
|
||||
@ -28,6 +28,7 @@ package sun.awt.motif;
|
||||
import java.nio.CharBuffer;
|
||||
import java.nio.ByteBuffer;
|
||||
import java.nio.charset.*;
|
||||
import sun.nio.cs.*;
|
||||
import sun.nio.cs.ext.*;
|
||||
import static sun.nio.cs.CharsetMapping.*;
|
||||
|
||||
|
||||
@ -26,6 +26,7 @@
|
||||
package sun.awt.motif;
|
||||
|
||||
import java.nio.charset.*;
|
||||
import sun.nio.cs.*;
|
||||
import sun.nio.cs.ext.*;
|
||||
import static sun.nio.cs.CharsetMapping.*;
|
||||
|
||||
|
||||
@ -29,7 +29,7 @@ import java.nio.ByteBuffer;
|
||||
import java.nio.CharBuffer;
|
||||
import java.nio.charset.*;
|
||||
import sun.nio.cs.*;
|
||||
import sun.nio.cs.ext.JIS_X_0201;
|
||||
import sun.nio.cs.ext.*;
|
||||
import static sun.nio.cs.CharsetMapping.*;
|
||||
|
||||
public class X11JIS0201 extends Charset {
|
||||
|
||||
@ -28,7 +28,8 @@ package sun.awt.motif;
|
||||
import java.nio.charset.Charset;
|
||||
import java.nio.charset.CharsetEncoder;
|
||||
import java.nio.charset.CharsetDecoder;
|
||||
import sun.nio.cs.ext.JIS_X_0208;
|
||||
import sun.nio.cs.*;
|
||||
import sun.nio.cs.ext.*;
|
||||
|
||||
public class X11JIS0208 extends Charset {
|
||||
|
||||
|
||||
@ -28,7 +28,8 @@ package sun.awt.motif;
|
||||
import java.nio.charset.Charset;
|
||||
import java.nio.charset.CharsetEncoder;
|
||||
import java.nio.charset.CharsetDecoder;
|
||||
import sun.nio.cs.ext.JIS_X_0212;
|
||||
import sun.nio.cs.*;
|
||||
import sun.nio.cs.ext.*;
|
||||
|
||||
public class X11JIS0212 extends Charset {
|
||||
private static Charset jis0212 = new JIS_X_0212();
|
||||
|
||||
@ -28,6 +28,7 @@ package sun.awt.motif;
|
||||
import java.nio.CharBuffer;
|
||||
import java.nio.ByteBuffer;
|
||||
import java.nio.charset.*;
|
||||
import sun.nio.cs.*;
|
||||
import sun.nio.cs.ext.*;
|
||||
import static sun.nio.cs.CharsetMapping.*;
|
||||
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
|
||||
* 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
|
||||
@ -23,18 +23,20 @@
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package sun.nio.cs.ext;
|
||||
package $PACKAGE$;
|
||||
|
||||
import java.nio.charset.Charset;
|
||||
import java.nio.charset.CharsetDecoder;
|
||||
import java.nio.charset.CharsetEncoder;
|
||||
import sun.nio.cs.DoubleByte;
|
||||
import sun.nio.cs.HKSCS;
|
||||
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"));
|
||||
super("Big5-HKSCS", $ALIASES$);
|
||||
}
|
||||
|
||||
public String historicalName() {
|
||||
@ -28,7 +28,9 @@ package sun.nio.cs.ext;
|
||||
import java.nio.charset.Charset;
|
||||
import java.nio.charset.CharsetDecoder;
|
||||
import java.nio.charset.CharsetEncoder;
|
||||
import sun.nio.cs.DoubleByte;
|
||||
import sun.nio.cs.HistoricallyNamedCharset;
|
||||
import sun.nio.cs.*;
|
||||
|
||||
public class Big5_HKSCS_2001 extends Charset
|
||||
{
|
||||
|
||||
@ -23,11 +23,12 @@
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package sun.nio.cs.ext;
|
||||
package $PACKAGE$;
|
||||
|
||||
import java.nio.charset.Charset;
|
||||
import java.nio.charset.CharsetDecoder;
|
||||
import java.nio.charset.CharsetEncoder;
|
||||
import sun.nio.cs.DoubleByte;
|
||||
import sun.nio.cs.HistoricallyNamedCharset;
|
||||
import java.util.Arrays;
|
||||
import static sun.nio.cs.CharsetMapping.*;
|
||||
@ -35,7 +36,7 @@ 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"));
|
||||
super("x-Big5-Solaris", $ALIASES$);
|
||||
}
|
||||
|
||||
public String historicalName() {
|
||||
@ -23,7 +23,7 @@
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package sun.nio.cs.ext;
|
||||
package $PACKAGE$;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
import java.nio.CharBuffer;
|
||||
@ -32,8 +32,11 @@ import java.nio.charset.CharsetDecoder;
|
||||
import java.nio.charset.CharsetEncoder;
|
||||
import java.nio.charset.CoderResult;
|
||||
import sun.nio.cs.HistoricallyNamedCharset;
|
||||
import sun.nio.cs.DelegatableDecoder;
|
||||
import sun.nio.cs.DoubleByte;
|
||||
import sun.nio.cs.Surrogate;
|
||||
import sun.nio.cs.SingleByte;
|
||||
import sun.nio.cs.*;
|
||||
import static sun.nio.cs.CharsetMapping.*;
|
||||
|
||||
public class EUC_JP
|
||||
@ -41,7 +44,7 @@ public class EUC_JP
|
||||
implements HistoricallyNamedCharset
|
||||
{
|
||||
public EUC_JP() {
|
||||
super("EUC-JP", ExtendedCharsets.aliasesFor("EUC-JP"));
|
||||
super("EUC-JP", $ALIASES$);
|
||||
}
|
||||
|
||||
public String historicalName() {
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2002, 2012, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2002, 2015, 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
|
||||
@ -23,7 +23,7 @@
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package sun.nio.cs.ext;
|
||||
package $PACKAGE$;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
import java.nio.CharBuffer;
|
||||
@ -32,13 +32,14 @@ import java.nio.charset.CharsetDecoder;
|
||||
import java.nio.charset.CharsetEncoder;
|
||||
import java.nio.charset.CoderResult;
|
||||
import sun.nio.cs.HistoricallyNamedCharset;
|
||||
import sun.nio.cs.*;
|
||||
|
||||
public class EUC_JP_LINUX
|
||||
extends Charset
|
||||
implements HistoricallyNamedCharset
|
||||
{
|
||||
public EUC_JP_LINUX() {
|
||||
super("x-euc-jp-linux", ExtendedCharsets.aliasesFor("x-euc-jp-linux"));
|
||||
super("x-euc-jp-linux", $ALIASES$);
|
||||
}
|
||||
|
||||
public String historicalName() {
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2003, 2015, 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
|
||||
@ -23,7 +23,7 @@
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package sun.nio.cs.ext;
|
||||
package $PACKAGE$;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
import java.nio.CharBuffer;
|
||||
@ -31,7 +31,9 @@ import java.nio.charset.Charset;
|
||||
import java.nio.charset.CharsetDecoder;
|
||||
import java.nio.charset.CharsetEncoder;
|
||||
import java.nio.charset.CoderResult;
|
||||
import sun.nio.cs.DoubleByte;
|
||||
import sun.nio.cs.HistoricallyNamedCharset;
|
||||
import sun.nio.cs.*;
|
||||
import static sun.nio.cs.CharsetMapping.*;
|
||||
|
||||
public class EUC_JP_Open
|
||||
@ -39,7 +41,7 @@ public class EUC_JP_Open
|
||||
implements HistoricallyNamedCharset
|
||||
{
|
||||
public EUC_JP_Open() {
|
||||
super("x-eucJP-Open", ExtendedCharsets.aliasesFor("x-eucJP-Open"));
|
||||
super("x-eucJP-Open", $ALIASES$);
|
||||
}
|
||||
|
||||
public String historicalName() {
|
||||
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,256 @@
|
||||
/*
|
||||
* Copyright (c) 2000, 2015, 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.
|
||||
*
|
||||
*/
|
||||
|
||||
// -- This file was mechanically generated: Do not edit! -- //
|
||||
|
||||
package sun.nio.cs.ext;
|
||||
|
||||
import java.lang.ref.SoftReference;
|
||||
import java.nio.charset.Charset;
|
||||
import java.nio.charset.spi.CharsetProvider;
|
||||
import sun.nio.cs.AbstractCharsetProvider;
|
||||
import java.security.AccessController;
|
||||
import java.security.PrivilegedAction;
|
||||
import sun.nio.cs.AbstractCharsetProvider;
|
||||
|
||||
/**
|
||||
* Provider for extended charsets.
|
||||
*/
|
||||
|
||||
public class ExtendedCharsets extends AbstractCharsetProvider {
|
||||
|
||||
static volatile ExtendedCharsets instance = null;
|
||||
|
||||
public ExtendedCharsets() {
|
||||
|
||||
super("sun.nio.cs.ext"); // identify provider pkg name.
|
||||
|
||||
_CHARSETS_DEF_LIST_
|
||||
|
||||
instance = this;
|
||||
|
||||
}
|
||||
|
||||
private boolean initialized = false;
|
||||
|
||||
// If the sun.nio.cs.map property is defined on the command line we won't
|
||||
// see it in the system-properties table until after the charset subsystem
|
||||
// has been initialized. We therefore delay the effect of this property
|
||||
// until after the JRE has completely booted.
|
||||
//
|
||||
// At the moment following values for this property are supported, property
|
||||
// value string is case insensitive.
|
||||
//
|
||||
// (1)"Windows-31J/Shift_JIS"
|
||||
// In 1.4.1 we added a correct implementation of the Shift_JIS charset
|
||||
// but in previous releases this charset name had been treated as an alias
|
||||
// for Windows-31J, aka MS932. Users who have existing code that depends
|
||||
// upon this alias can restore the previous behavior by defining this
|
||||
// property to have this value.
|
||||
//
|
||||
// (2)"x-windows-50221/ISO-2022-JP"
|
||||
// "x-windows-50220/ISO-2022-JP"
|
||||
// "x-windows-iso2022jp/ISO-2022-JP"
|
||||
// The charset ISO-2022-JP is a "standard based" implementation by default,
|
||||
// which supports ASCII, JIS_X_0201 and JIS_X_0208 mappings based encoding
|
||||
// and decoding only.
|
||||
// There are three Microsoft iso-2022-jp variants, namely x-windows-50220,
|
||||
// x-windows-50221 and x-windows-iso2022jp which behaves "slightly" differently
|
||||
// compared to the "standard based" implementation. See ISO2022_JP.java for
|
||||
// detailed description. Users who prefer the behavior of MS iso-2022-jp
|
||||
// variants should use these names explicitly instead of using "ISO-2022-JP"
|
||||
// and its aliases. However for those who need the ISO-2022-JP charset behaves
|
||||
// exactly the same as MS variants do, above properties can be defined to
|
||||
// switch.
|
||||
//
|
||||
// If we need to define other charset-alias mappings in the future then
|
||||
// this property could be further extended, the general idea being that its
|
||||
// value should be of the form
|
||||
//
|
||||
// new-charset-1/old-charset-1,new-charset-2/old-charset-2,...
|
||||
//
|
||||
// where each charset named to the left of a slash is intended to replace
|
||||
// (most) uses of the charset named to the right of the slash.
|
||||
//
|
||||
protected void init() {
|
||||
if (initialized)
|
||||
return;
|
||||
if (!sun.misc.VM.isBooted())
|
||||
return;
|
||||
|
||||
String map = getProperty("sun.nio.cs.map");
|
||||
boolean sjisIsMS932 = false;
|
||||
boolean iso2022jpIsMS50221 = false;
|
||||
boolean iso2022jpIsMS50220 = false;
|
||||
boolean iso2022jpIsMSISO2022JP = false;
|
||||
if (map != null) {
|
||||
String[] maps = map.split(",");
|
||||
for (int i = 0; i < maps.length; i++) {
|
||||
if (maps[i].equalsIgnoreCase("Windows-31J/Shift_JIS")) {
|
||||
sjisIsMS932 = true;
|
||||
} else if (maps[i].equalsIgnoreCase("x-windows-50221/ISO-2022-JP")) {
|
||||
iso2022jpIsMS50221 = true;
|
||||
} else if (maps[i].equalsIgnoreCase("x-windows-50220/ISO-2022-JP")) {
|
||||
iso2022jpIsMS50220 = true;
|
||||
} else if (maps[i].equalsIgnoreCase("x-windows-iso2022jp/ISO-2022-JP")) {
|
||||
iso2022jpIsMSISO2022JP = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (sjisIsMS932 && hasCharset("Shift_JIS")) {
|
||||
deleteCharset("Shift_JIS",
|
||||
new String[] {
|
||||
// IANA aliases
|
||||
"sjis", // historical
|
||||
"shift_jis",
|
||||
"shift-jis",
|
||||
"ms_kanji",
|
||||
"x-sjis",
|
||||
"csShiftJIS"
|
||||
});
|
||||
deleteCharset("windows-31j",
|
||||
new String[] {
|
||||
"MS932", // JDK historical
|
||||
"windows-932",
|
||||
"csWindows31J"
|
||||
});
|
||||
charset("Shift_JIS", "SJIS",
|
||||
new String[] {
|
||||
// IANA aliases
|
||||
"sjis" // JDK historical
|
||||
});
|
||||
charset("windows-31j", "MS932",
|
||||
new String[] {
|
||||
"MS932", // JDK historical
|
||||
"windows-932",
|
||||
"csWindows31J",
|
||||
"shift-jis",
|
||||
"ms_kanji",
|
||||
"x-sjis",
|
||||
"csShiftJIS",
|
||||
// This alias takes precedence over the actual
|
||||
// Shift_JIS charset itself since aliases are always
|
||||
// resolved first, before looking up canonical names.
|
||||
"shift_jis"
|
||||
});
|
||||
}
|
||||
if (iso2022jpIsMS50221 ||
|
||||
iso2022jpIsMS50220 ||
|
||||
iso2022jpIsMSISO2022JP) {
|
||||
deleteCharset("ISO-2022-JP",
|
||||
new String[] {
|
||||
"iso2022jp",
|
||||
"jis",
|
||||
"csISO2022JP",
|
||||
"jis_encoding",
|
||||
"csjisencoding"
|
||||
});
|
||||
if (iso2022jpIsMS50221) {
|
||||
deleteCharset("x-windows-50221",
|
||||
new String[] {
|
||||
"cp50221",
|
||||
"ms50221"
|
||||
});
|
||||
charset("x-windows-50221", "MS50221",
|
||||
new String[] {
|
||||
"cp50221",
|
||||
"ms50221",
|
||||
"iso-2022-jp",
|
||||
"iso2022jp",
|
||||
"jis",
|
||||
"csISO2022JP",
|
||||
"jis_encoding",
|
||||
"csjisencoding"
|
||||
});
|
||||
} else if (iso2022jpIsMS50220) {
|
||||
deleteCharset("x-windows-50220",
|
||||
new String[] {
|
||||
"cp50220",
|
||||
"ms50220"
|
||||
});
|
||||
charset("x-windows-50220", "MS50220",
|
||||
new String[] {
|
||||
"cp50220",
|
||||
"ms50220",
|
||||
"iso-2022-jp",
|
||||
"iso2022jp",
|
||||
"jis",
|
||||
"csISO2022JP",
|
||||
"jis_encoding",
|
||||
"csjisencoding"
|
||||
});
|
||||
} else {
|
||||
deleteCharset("x-windows-iso2022jp",
|
||||
new String[] {
|
||||
"windows-iso2022jp"
|
||||
});
|
||||
charset("x-windows-iso2022jp", "MSISO2022JP",
|
||||
new String[] {
|
||||
"windows-iso2022jp",
|
||||
"iso-2022-jp",
|
||||
"iso2022jp",
|
||||
"jis",
|
||||
"csISO2022JP",
|
||||
"jis_encoding",
|
||||
"csjisencoding"
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
String osName = getProperty("os.name");
|
||||
if ("SunOS".equals(osName) || "Linux".equals(osName) || "AIX".equals(osName)
|
||||
|| osName.contains("OS X")) {
|
||||
charset("x-COMPOUND_TEXT", "COMPOUND_TEXT",
|
||||
new String[] {
|
||||
"COMPOUND_TEXT", // JDK historical
|
||||
"x11-compound_text",
|
||||
"x-compound-text"
|
||||
});
|
||||
}
|
||||
initialized = true;
|
||||
}
|
||||
|
||||
private static String getProperty(String key) {
|
||||
// this method may be called during initialization of
|
||||
// system class loader and thus not using lambda
|
||||
return AccessController.doPrivileged(
|
||||
new PrivilegedAction<String>() {
|
||||
@Override
|
||||
public String run() {
|
||||
return System.getProperty(key);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public static String[] aliasesFor(String charsetName) {
|
||||
if (instance == null)
|
||||
return null;
|
||||
return instance.aliases(charsetName);
|
||||
}
|
||||
|
||||
}
|
||||
@ -34,6 +34,7 @@ import java.nio.charset.Charset;
|
||||
import java.nio.charset.CharsetDecoder;
|
||||
import java.nio.charset.CharsetEncoder;
|
||||
import java.nio.charset.CoderResult;
|
||||
import sun.nio.cs.DoubleByte;
|
||||
import static sun.nio.cs.CharsetMapping.*;
|
||||
|
||||
// EBCDIC DBCS-only Korean
|
||||
|
||||
@ -29,6 +29,7 @@ import java.nio.charset.Charset;
|
||||
import java.nio.charset.CharsetDecoder;
|
||||
import java.nio.charset.CharsetEncoder;
|
||||
import java.util.Arrays;
|
||||
import sun.nio.cs.DoubleByte;
|
||||
import sun.nio.cs.HistoricallyNamedCharset;
|
||||
import static sun.nio.cs.CharsetMapping.*;
|
||||
|
||||
|
||||
@ -29,6 +29,7 @@ import java.nio.charset.Charset;
|
||||
import java.nio.charset.CharsetDecoder;
|
||||
import java.nio.charset.CharsetEncoder;
|
||||
import java.util.Arrays;
|
||||
import sun.nio.cs.DoubleByte;
|
||||
import sun.nio.cs.HistoricallyNamedCharset;
|
||||
|
||||
public class IBM943C extends Charset implements HistoricallyNamedCharset
|
||||
|
||||
@ -29,6 +29,7 @@ import java.nio.charset.Charset;
|
||||
import java.nio.charset.CharsetDecoder;
|
||||
import java.nio.charset.CharsetEncoder;
|
||||
import java.util.Arrays;
|
||||
import sun.nio.cs.DoubleByte;
|
||||
import sun.nio.cs.HistoricallyNamedCharset;
|
||||
|
||||
public class IBM949C extends Charset implements HistoricallyNamedCharset
|
||||
|
||||
@ -35,8 +35,10 @@ import java.nio.charset.CharsetDecoder;
|
||||
import java.nio.charset.CharsetEncoder;
|
||||
import java.nio.charset.CoderResult;
|
||||
import java.nio.charset.CharacterCodingException;
|
||||
import sun.nio.cs.DoubleByte;
|
||||
import sun.nio.cs.HistoricallyNamedCharset;
|
||||
import sun.nio.cs.US_ASCII;
|
||||
import sun.nio.cs.*;
|
||||
|
||||
public class ISO2022_CN
|
||||
extends Charset
|
||||
|
||||
@ -34,6 +34,7 @@ import java.nio.CharBuffer;
|
||||
import java.nio.charset.CharsetDecoder;
|
||||
import java.nio.charset.CharsetEncoder;
|
||||
import java.nio.charset.CoderResult;
|
||||
import sun.nio.cs.*;
|
||||
import sun.nio.cs.HistoricallyNamedCharset;
|
||||
|
||||
public class ISO2022_CN_GB extends ISO2022 implements HistoricallyNamedCharset
|
||||
|
||||
@ -32,9 +32,12 @@ import java.nio.charset.CharsetDecoder;
|
||||
import java.nio.charset.CharsetEncoder;
|
||||
import java.nio.charset.CoderResult;
|
||||
import java.nio.charset.CodingErrorAction;
|
||||
import sun.nio.cs.DelegatableDecoder;
|
||||
import sun.nio.cs.DoubleByte;
|
||||
import sun.nio.cs.HistoricallyNamedCharset;
|
||||
import sun.nio.cs.Surrogate;
|
||||
import sun.nio.cs.US_ASCII;
|
||||
import sun.nio.cs.*;
|
||||
import static sun.nio.cs.CharsetMapping.*;
|
||||
|
||||
/*
|
||||
|
||||
@ -28,6 +28,8 @@ package sun.nio.cs.ext;
|
||||
import java.nio.charset.Charset;
|
||||
import java.nio.charset.CharsetDecoder;
|
||||
import java.nio.charset.CharsetEncoder;
|
||||
import sun.nio.cs.DoubleByte;
|
||||
import sun.nio.cs.*;
|
||||
|
||||
public class ISO2022_JP_2 extends ISO2022_JP
|
||||
{
|
||||
|
||||
@ -35,7 +35,7 @@ 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;
|
||||
import sun.nio.cs.*;
|
||||
|
||||
public class ISO2022_KR extends ISO2022
|
||||
implements HistoricallyNamedCharset
|
||||
|
||||
@ -33,9 +33,11 @@ import java.nio.charset.CharsetEncoder;
|
||||
import java.nio.charset.CoderResult;
|
||||
import java.nio.charset.CharacterCodingException;
|
||||
import java.nio.charset.MalformedInputException;
|
||||
import sun.nio.cs.DelegatableDecoder;
|
||||
import sun.nio.cs.HistoricallyNamedCharset;
|
||||
import java.security.AccessController;
|
||||
import java.security.PrivilegedAction;
|
||||
import sun.nio.cs.*;
|
||||
import static java.lang.Character.UnicodeBlock;
|
||||
|
||||
|
||||
|
||||
@ -28,6 +28,8 @@ package sun.nio.cs.ext;
|
||||
import java.nio.charset.Charset;
|
||||
import java.nio.charset.CharsetDecoder;
|
||||
import java.nio.charset.CharsetEncoder;
|
||||
import sun.nio.cs.DoubleByte;
|
||||
import sun.nio.cs.*;
|
||||
|
||||
public class MS50220 extends ISO2022_JP
|
||||
{
|
||||
|
||||
@ -26,6 +26,7 @@
|
||||
package sun.nio.cs.ext;
|
||||
|
||||
import java.nio.charset.Charset;
|
||||
import sun.nio.cs.*;
|
||||
|
||||
public class MS50221 extends MS50220
|
||||
{
|
||||
|
||||
@ -28,6 +28,8 @@ package sun.nio.cs.ext;
|
||||
import java.nio.charset.Charset;
|
||||
import java.nio.charset.CharsetEncoder;
|
||||
import java.nio.charset.CharsetDecoder;
|
||||
import sun.nio.cs.DoubleByte;
|
||||
import sun.nio.cs.*;
|
||||
import static sun.nio.cs.CharsetMapping.*;
|
||||
|
||||
public class MS932_0213 extends Charset {
|
||||
|
||||
@ -29,6 +29,7 @@ import java.nio.charset.Charset;
|
||||
import java.nio.charset.CharsetDecoder;
|
||||
import java.nio.charset.CharsetEncoder;
|
||||
import sun.nio.cs.HistoricallyNamedCharset;
|
||||
import sun.nio.cs.*;
|
||||
import static sun.nio.cs.CharsetMapping.*;
|
||||
|
||||
public class MS950_HKSCS extends Charset implements HistoricallyNamedCharset
|
||||
|
||||
@ -23,18 +23,20 @@
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package sun.nio.cs.ext;
|
||||
package $PACKAGE$;
|
||||
|
||||
import java.nio.charset.Charset;
|
||||
import java.nio.charset.CharsetDecoder;
|
||||
import java.nio.charset.CharsetEncoder;
|
||||
import sun.nio.cs.DoubleByte;
|
||||
import sun.nio.cs.HKSCS;
|
||||
import sun.nio.cs.HistoricallyNamedCharset;
|
||||
import static sun.nio.cs.CharsetMapping.*;
|
||||
|
||||
public class MS950_HKSCS_XP extends Charset
|
||||
{
|
||||
public MS950_HKSCS_XP() {
|
||||
super("x-MS950-HKSCS-XP", ExtendedCharsets.aliasesFor("x-MS950-HKSCS-XP"));
|
||||
super("x-MS950-HKSCS-XP", $ALIASES$);
|
||||
}
|
||||
|
||||
public boolean contains(Charset cs) {
|
||||
@ -28,6 +28,7 @@ package sun.nio.cs.ext;
|
||||
import java.nio.charset.Charset;
|
||||
import java.nio.charset.CharsetDecoder;
|
||||
import java.nio.charset.CharsetEncoder;
|
||||
import sun.nio.cs.DoubleByte;
|
||||
|
||||
public class MSISO2022JP extends ISO2022_JP
|
||||
{
|
||||
|
||||
@ -35,6 +35,7 @@ import java.security.AccessController;
|
||||
import java.security.PrivilegedAction;
|
||||
import java.util.Arrays;
|
||||
import sun.nio.cs.CharsetMapping;
|
||||
import sun.nio.cs.*;
|
||||
|
||||
/*
|
||||
* 5 types of entry in SJIS_X_0213/Unicode mapping table
|
||||
|
||||
@ -65,11 +65,17 @@ public class NIOCharsetAvailabilityTest {
|
||||
charsets.remove(Class.forName("sun.nio.cs.ext.ISO2022"));
|
||||
charsets.remove(Class.forName("sun.nio.cs.ext.ISO2022_CN_GB"));
|
||||
charsets.remove(Class.forName("sun.nio.cs.ext.ISO2022_CN_CNS"));
|
||||
charsets.remove(Class.forName("sun.nio.cs.ext.JIS_X_0208_Solaris"));
|
||||
charsets.remove(Class.forName("sun.nio.cs.ext.JIS_X_0208_MS932"));
|
||||
charsets.remove(Class.forName("sun.nio.cs.ext.JIS_X_0212_MS5022X"));
|
||||
charsets.remove(Class.forName("sun.nio.cs.ext.JIS_X_0212_Solaris"));
|
||||
charsets.remove(Class.forName("sun.nio.cs.ext.JIS_X_0208_MS5022X"));
|
||||
try {
|
||||
charsets.remove(Class.forName("sun.nio.cs.ext.JIS_X_0208_Solaris"));
|
||||
charsets.remove(Class.forName("sun.nio.cs.ext.JIS_X_0212_Solaris"));
|
||||
} catch (ClassNotFoundException x) {
|
||||
// these two might be moved into stdcs
|
||||
charsets.remove(Class.forName("sun.nio.cs.JIS_X_0208_Solaris"));
|
||||
charsets.remove(Class.forName("sun.nio.cs.JIS_X_0212_Solaris"));
|
||||
}
|
||||
|
||||
// report the charsets that are implemented but not available
|
||||
iter = charsets.iterator();
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user