Charset用于创建解码器和编码器以及检索与 charset 关联的各种名称的方法。
以下是获得系统的获得系统的从charSet名称到charset对象的映射
public class CharsetTest {
/** Creates a new instance of CharsetTest */
public CharsetTest() {
}
public String getAllCharSet(){
StringBuffer buf = new StringBuffer();
SortedMap charsets = Charset.availableCharsets();//构造从规范 charset 名称到 charset 对象的有序映射
Set names = charsets.keySet();
int mainCounter = 0;
Iterator nameTte =names.iterator();
while(nameTte.hasNext()){
String name = (String)nameTte.next();
Charset charset = (Charset)charsets.get(name);
buf.append(++mainCounter).append(";").append(charset).append("\n");
Set aliases = charset.aliases();
int subCounter =1;
Iterator aliasIte =aliases.iterator();
while(aliasIte.hasNext()){
buf.append("\t").append(mainCounter).append(".");
buf.append(subCounter++).append(";");
buf.append(aliasIte.next()).append("\n");
}
buf.append("\n");
}
return buf.toString();
}
public static void main(String[] args) {
CharsetTest ct = new CharsetTest();
System.out.println(ct.getAllCharSet());
}
}
输出结果:
init:
deps-jar:
compile-single:
run-single:
1;Big5
1.1;csBig5
2;Big5-HKSCS
2.1;big5-hkscs:unicode3.0
2.2;Big5_HKSCS
2.3;big5-hkscs
2.4;big5hkscs
2.5;big5hk
3;EUC-JP
3.1;eucjis
3.2;Extended_UNIX_Code_Packed_Format_for_Japanese
3.3;x-eucjp
3.4;eucjp
3.5;csEUCPkdFmtjapanese
3.6;euc_jp
3.7;x-euc-jp
4;EUC-KR
4.1;5601
4.2;ksc5601-1987
4.3;ksc5601_1987
4.4;euckr
4.5;ksc5601
4.6;ksc_5601
4.7;ks_c_5601-1987
4.8;euc_kr
4.9;csEUCKR
5;GB18030
5.1;gb18030-2000
6;GB2312
6.1;euc-cn
6.2;x-EUC-CN
6.3;gb2312-1980
6.4;gb2312
6.5;gb2312-80
6.6;euccn
6.7;EUC_CN
7;GBK
7.1;CP936
7.2;windows-936
8;IBM-Thai
8.1;838
8.2;cp838
8.3;ibm838
8.4;ibm-838
9;IBM00858
9.1;cp858
9.2;ccsid00858
9.3;858
9.4;cp00858
10;IBM01140
10.1;ccsid01140
10.2;cp01140
10.3;1140
10.4;cp1140
11;IBM01141
11.1;cp1141
11.2;ccsid01141
11.3;cp01141
11.4;1141
12;IBM01142
12.1;cp01142
12.2;cp1142
12.3;1142
12.4;ccsid01142
13;IBM01143
13.1;cp01143
13.2;1143
13.3;ccsid01143
13.4;cp1143
14;IBM01144
14.1;cp01144
14.2;cp1144
14.3;ccsid01144
14.4;1144
15;IBM01145
15.1;cp1145
15.2;cp01145
15.3;ccsid01145
15.4;1145
16;IBM01146
16.1;ccsid01146
16.2;cp01146
16.3;cp1146
16.4;1146
17;IBM01147
17.1;ccsid01147
17.2;cp1147
17.3;1147
17.4;cp01147
18;IBM01148
18.1;cp1148
18.2;ccsid01148
18.3;1148
18.4;cp01148
19;IBM01149
19.1;cp1149
19.2;cp01149
19.3;ccsid01149
19.4;1149
20;IBM037
20.1;cs-ebcdic-cp-nl
20.2;037
20.3;cp037
20.4;ebcdic-cp-nl
20.5;ibm-37
20.6;ebcdic-cp-wt
20.7;cs-ebcdic-cp-us
20.8;ebcdic-cp-ca
20.9;cs-ebcdic-cp-wt
20.10;csIBM037
20.11;ibm-037
20.12;cs-ebcdic-cp-ca
20.13;cpibm37
20.14;ibm037
20.15;ebcdic-cp-us
21;IBM1026
21.1;cp1026
21.2;ibm-1026
21.3;1026
21.4;ibm1026
22;IBM1047
22.1;cp1047
22.2;1047
22.3;ibm-1047
23;IBM273
23.1;ibm-273
23.2;ibm273
23.3;cp273
23.4;273
24;IBM277
24.1;cp277
24.2;277
24.3;ibm-277
24.4;ibm277
25;IBM278
25.1;cp278
25.2;ebcdic-cp-se
25.3;278
25.4;ibm278
25.5;ebcdic-sv
25.6;ibm-278
25.7;csIBM278
26;IBM280
26.1;280
26.2;ibm-280
26.3;cp280
26.4;ibm280
27;IBM284
27.1;cpibm284
27.2;csIBM284
27.3;ibm284
27.4;cp284
27.5;284
27.6;ibm-284
28;IBM285
28.1;ibm285
28.2;ebcdic-cp-gb
28.3;cpibm285
28.4;cp285
28.5;csIBM285
28.6;ebcdic-gb
28.7;285
28.8;ibm-285
29;IBM297
29.1;cp297
29.2;ibm297
29.3;297
29.4;cpibm297
29.5;ebcdic-cp-fr
29.6;ibm-297
29.7;csIBM297
30;IBM420
30.1;ibm420
30.2;cp420
30.3;420
30.4;ibm-420
30.5;csIBM420
30.6;ebcdic-cp-ar1
31;IBM424
31.1;csIBM424
31.2;ibm-424
31.3;ibm424
31.4;cp424
31.5;ebcdic-cp-he
31.6;424
32;IBM437
32.1;ibm-437
32.2;windows-437
32.3;cspc8codepage437
32.4;437
32.5;ibm437
32.6;cp437
33;IBM500
33.1;ibm-500
33.2;ebcdic-cp-bh
33.3;cp500
33.4;csIBM500
33.5;ibm500
33.6;ebcdic-cp-ch
33.7;500
34;IBM775
34.1;ibm-775
34.2;cp775
34.3;ibm775
34.4;775
35;IBM850
35.1;ibm-850
35.2;cp850
35.3;850
35.4;cspc850multilingual
35.5;ibm850
36;IBM852
36.1;ibm852
36.2;csPCp852
36.3;852
36.4;ibm-852
36.5;cp852
37;IBM855
37.1;cspcp855
37.2;855
37.3;ibm855
37.4;ibm-855
37.5;cp855
38;IBM857
38.1;csIBM857
38.2;857
38.3;ibm-857
38.4;cp857
38.5;ibm857
39;IBM860
39.1;860
39.2;cp860
39.3;ibm-860
39.4;csIBM860
39.5;ibm860
40;IBM861
40.1;861
40.2;cp-is
40.3;ibm-861
40.4;cp861
40.5;csIBM861
40.6;ibm861
41;IBM862
41.1;ibm-862
41.2;ibm862
41.3;csIBM862
41.4;cp862
41.5;cspc862latinhebrew
41.6;862
42;IBM863
42.1;ibm863
42.2;csIBM863
42.3;cp863
42.4;863
42.5;ibm-863
43;IBM864
43.1;csIBM864
43.2;ibm864
43.3;864
43.4;cp864
43.5;ibm-864
44;IBM865
44.1;csIBM865
44.2;ibm865
44.3;865
44.4;ibm-865
44.5;cp865
45;IBM866
45.1;866
45.2;ibm-866
45.3;ibm866
45.4;csIBM866
45.5;cp866
46;IBM868
46.1;868
46.2;ibm-868
46.3;cp868
46.4;csIBM868
46.5;cp-ar
46.6;ibm868
47;IBM869
47.1;869
47.2;ibm-869
47.3;cp869
47.4;csIBM869
47.5;cp-gr
47.6;ibm869
48;IBM870
48.1;ibm-870
48.2;ebcdic-cp-roece
48.3;ebcdic-cp-yu
48.4;ibm870
48.5;csIBM870
48.6;cp870
48.7;870
49;IBM871
49.1;ibm-871
49.2;871
49.3;ebcdic-cp-is
49.4;cp871
49.5;csIBM871
49.6;ibm871
50;IBM918
50.1;cp918
50.2;ebcdic-cp-ar2
50.3;ibm-918
50.4;918
51;ISO-2022-CN
51.1;ISO2022CN
51.2;csISO2022CN
52;ISO-2022-JP
52.1;jis_encoding
52.2;csjisencoding
52.3;jis
52.4;iso2022jp
52.5;csISO2022JP
53;ISO-2022-JP-2
53.1;csISO2022JP2
53.2;iso2022jp2
54;ISO-2022-KR
54.1;csISO2022KR
54.2;ISO2022KR
55;ISO-8859-1
55.1;csISOLatin1
55.2;IBM-819
55.3;iso-ir-100
55.4;8859_1
55.5;ISO_8859-1
55.6;l1
55.7;ISO8859-1
55.8;ISO_8859_1
55.9;cp819
55.10;ISO8859_1
55.11;latin1
55.12;ISO_8859-1:1987
55.13;819
55.14;IBM819
56;ISO-8859-13
56.1;8859_13
56.2;iso8859_13
56.3;iso_8859-13
56.4;ISO8859-13
57;ISO-8859-15
57.1;IBM923
57.2;8859_15
57.3;ISO_8859-15
57.4;ISO-8859-15
57.5;L9
57.6;ISO8859-15
57.7;ISO8859_15_FDIS
57.8;923
57.9;LATIN0
57.10;csISOlatin9
57.11;LATIN9
57.12;csISOlatin0
57.13;IBM-923
57.14;ISO8859_15
57.15;cp923
58;ISO-8859-2
58.1;iso-ir-101
58.2;csISOLatin2
58.3;ibm-912
58.4;8859_2
58.5;l2
58.6;ISO_8859-2
58.7;ibm912
58.8;912
58.9;ISO8859-2
58.10;latin2
58.11;iso8859_2
58.12;ISO_8859-2:1987
58.13;cp912
59;ISO-8859-3
59.1;ibm-913
59.2;csISOLatin3
59.3;iso-ir-109
59.4;l3
59.5;8859_3
59.6;ibm913
59.7;ISO_8859-3
59.8;ISO8859-3
59.9;913
59.10;latin3
59.11;iso8859_3
59.12;ISO_8859-3:1988
59.13;cp913
60;ISO-8859-4
60.1;iso-ir-110
60.2;iso8859-4
60.3;ibm914
60.4;ibm-914
60.5;l4
60.6;csISOLatin4
60.7;914
60.8;8859_4
60.9;latin4
60.10;ISO_8859-4
60.11;ISO_8859-4:1988
60.12;iso8859_4
60.13;cp914
61;ISO-8859-5
61.1;cp915
61.2;ISO8859-5
61.3;ibm915
61.4;ISO_8859-5:1988
61.5;ibm-915
61.6;8859_5
61.7;915
61.8;cyrillic
61.9;iso8859_5
61.10;ISO_8859-5
61.11;iso-ir-144
61.12;csISOLatinCyrillic
62;ISO-8859-6
62.1;arabic
62.2;ibm1089
62.3;iso8859_6
62.4;iso-ir-127
62.5;8859_6
62.6;cp1089
62.7;ECMA-114
62.8;ISO_8859-6
62.9;csISOLatinArabic
62.10;ibm-1089
62.11;1089
62.12;ISO8859-6
62.13;ASMO-708
62.14;ISO_8859-6:1987
63;ISO-8859-7
63.1;iso8859-7
63.2;sun_eu_greek
63.3;csISOLatinGreek
63.4;813
63.5;ISO_8859-7
63.6;ISO_8859-7:1987
63.7;ibm-813
63.8;greek
63.9;greek8
63.10;iso8859_7
63.11;ECMA-118
63.12;iso-ir-126
63.13;8859_7
63.14;cp813
63.15;ibm813
63.16;ELOT_928
64;ISO-8859-8
64.1;ibm916
64.2;cp916
64.3;csISOLatinHebrew
64.4;ISO_8859-8
64.5;ISO8859-8
64.6;ibm-916
64.7;iso8859_8
64.8;hebrew
64.9;916
64.10;iso-ir-138
64.11;ISO_8859-8:1988
64.12;8859_8
65;ISO-8859-9
65.1;ISO_8859-9
65.2;920
65.3;iso8859_9
65.4;csISOLatin5
65.5;l5
65.6;8859_9
65.7;latin5
65.8;ibm920
65.9;iso-ir-148
65.10;ISO_8859-9:1989
65.11;ISO8859-9
65.12;cp920
65.13;ibm-920
66;JIS_X0201
66.1;JIS0201
66.2;JIS_X0201
66.3;X0201
66.4;csHalfWidthKatakana
67;JIS_X0212-1990
67.1;csISO159JISX02121990
67.2;x0212
67.3;jis_x0212-1990
67.4;iso-ir-159
67.5;JIS0212
68;KOI8-R
68.1;cskoi8r
68.2;koi8_r
68.3;koi8
69;KOI8-U
69.1;koi8_u
70;Shift_JIS
70.1;x-sjis
70.2;shift_jis
70.3;sjis
70.4;ms_kanji
70.5;shift-jis
70.6;csShiftJIS
71;TIS-620
71.1;tis620.2533
71.2;tis620
72;US-ASCII
72.1;cp367
72.2;ascii7
72.3;ISO646-US
72.4;646
72.5;csASCII
72.6;us
72.7;iso_646.irv:1983
72.8;ISO_646.irv:1991
72.9;IBM367
72.10;ASCII
72.11;default
72.12;ANSI_X3.4-1986
72.13;ANSI_X3.4-1968
72.14;iso-ir-6
73;UTF-16
73.1;utf16
73.2;UTF_16
73.3;UnicodeBig
73.4;unicode
74;UTF-16BE
74.1;X-UTF-16BE
74.2;UTF_16BE
74.3;ISO-10646-UCS-2
74.4;UnicodeBigUnmarked
75;UTF-16LE
75.1;UnicodeLittleUnmarked
75.2;UTF_16LE
75.3;X-UTF-16LE
76;UTF-32
76.1;UTF_32
76.2;UTF32
77;UTF-32BE
77.1;X-UTF-32BE
77.2;UTF_32BE
78;UTF-32LE
78.1;X-UTF-32LE
78.2;UTF_32LE
79;UTF-8
79.1;UTF8
79.2;unicode-1-1-utf-8
80;windows-1250
80.1;cp1250
80.2;cp5346
81;windows-1251
81.1;ansi-1251
81.2;cp5347
81.3;cp1251
82;windows-1252
82.1;cp1252
82.2;cp5348
83;windows-1253
83.1;cp1253
83.2;cp5349
84;windows-1254
84.1;cp1254
84.2;cp5350
85;windows-1255
85.1;cp1255
86;windows-1256
86.1;cp1256
87;windows-1257
87.1;cp1257
87.2;cp5353
88;windows-1258
88.1;cp1258
89;windows-31j
89.1;csWindows31J
89.2;windows-932
89.3;MS932
90;x-Big5-Solaris
90.1;Big5_Solaris
91;x-euc-jp-linux
91.1;euc-jp-linux
91.2;euc_jp_linux
92;x-EUC-TW
92.1;euc_tw
92.2;EUC-TW
92.3;cns11643
92.4;euctw
93;x-eucJP-Open
93.1;EUC_JP_Solaris
93.2;eucJP-open
94;x-IBM1006
94.1;cp1006
94.2;ibm-1006
94.3;ibm1006
94.4;1006
95;x-IBM1025
95.1;cp1025
95.2;ibm-1025
95.3;1025
95.4;ibm1025
96;x-IBM1046
96.1;ibm-1046
96.2;cp1046
96.3;ibm1046
96.4;1046
97;x-IBM1097
97.1;cp1097
97.2;1097
97.3;ibm-1097
97.4;ibm1097
98;x-IBM1098
98.1;ibm-1098
98.2;cp1098
98.3;ibm1098
98.4;1098
99;x-IBM1112
99.1;ibm-1112
99.2;1112
99.3;ibm1112
99.4;cp1112
100;x-IBM1122
100.1;cp1122
100.2;ibm-1122
100.3;1122
100.4;ibm1122
101;x-IBM1123
101.1;cp1123
101.2;ibm-1123
101.3;1123
101.4;ibm1123
102;x-IBM1124
102.1;cp1124
102.2;ibm-1124
102.3;1124
102.4;ibm1124
103;x-IBM1381
103.1;ibm1381
103.2;cp1381
103.3;ibm-1381
103.4;1381
104;x-IBM1383
104.1;cp1383
104.2;1383
104.3;ibm1383
104.4;ibm-1383
105;x-IBM33722
105.1;ibm33722
105.2;33722
105.3;ibm-33722_vascii_vpua
105.4;ibm-5050
105.5;ibm-33722
105.6;cp33722
106;x-IBM737
106.1;cp737
106.2;ibm-737
106.3;737
106.4;ibm737
107;x-IBM834
107.1;ibm834
107.2;ibm-834
107.3;cp834
108;x-IBM856
108.1;856
108.2;cp856
108.3;ibm-856
108.4;ibm856
109;x-IBM874
109.1;cp874
109.2;ibm874
109.3;874
109.4;ibm-874
110;x-IBM875
110.1;ibm875
110.2;875
110.3;cp875
110.4;ibm-875
111;x-IBM921
111.1;cp921
111.2;ibm921
111.3;ibm-921
111.4;921
112;x-IBM922
112.1;ibm922
112.2;ibm-922
112.3;cp922
112.4;922
113;x-IBM930
113.1;cp930
113.2;ibm930
113.3;ibm-930
113.4;930
114;x-IBM933
114.1;cp933
114.2;933
114.3;ibm933
114.4;ibm-933
115;x-IBM935
115.1;ibm935
115.2;cp935
115.3;935
115.4;ibm-935
116;x-IBM937
116.1;ibm-937
116.2;cp937
116.3;937
116.4;ibm937
117;x-IBM939
117.1;ibm-939
117.2;ibm939
117.3;cp939
117.4;939
118;x-IBM942
118.1;ibm-942
118.2;ibm942
118.3;cp942
118.4;942
119;x-IBM942C
119.1;942C
119.2;ibm942C
119.3;cp942C
119.4;ibm-942C
120;x-IBM943
120.1;943
120.2;ibm-943
120.3;cp943
120.4;ibm943
121;x-IBM943C
121.1;ibm-943C
121.2;943C
121.3;cp943C
121.4;ibm943C
122;x-IBM948
122.1;ibm948
122.2;ibm-948
122.3;cp948
122.4;948
123;x-IBM949
123.1;ibm949
123.2;ibm-949
123.3;949
123.4;cp949
124;x-IBM949C
124.1;cp949C
124.2;949C
124.3;ibm-949C
124.4;ibm949C
125;x-IBM950
125.1;950
125.2;ibm950
125.3;cp950
125.4;ibm-950
126;x-IBM964
126.1;964
126.2;cp964
126.3;ibm-964
126.4;ibm964
127;x-IBM970
127.1;970
127.2;ibm-970
127.3;ibm970
127.4;cp970
127.5;ibm-eucKR
128;x-ISCII91
128.1;iso-ir-153
128.2;ST_SEV_358-88
128.3;ISCII91
128.4;iscii
128.5;csISO153GOST1976874
129;x-ISO-2022-CN-CNS
129.1;ISO-2022-CN-CNS
129.2;ISO2022CN_CNS
130;x-ISO-2022-CN-GB
130.1;ISO-2022-CN-GB
130.2;ISO2022CN_GB
131;x-iso-8859-11
131.1;iso-8859-11
131.2;iso8859_11
132;x-JIS0208
132.1;JIS_X0208-1983
132.2;x0208
132.3;JIS0208
132.4;JIS_C6226-1983
132.5;iso-ir-87
132.6;csISO87JISX0208
133;x-JISAutoDetect
133.1;JISAutoDetect
134;x-Johab
134.1;ksc5601_1992
134.2;ms1361
134.3;ksc5601-1992
134.4;johab
135;x-MacArabic
135.1;MacArabic
136;x-MacCentralEurope
136.1;MacCentralEurope
137;x-MacCroatian
137.1;MacCroatian
138;x-MacCyrillic
138.1;MacCyrillic
139;x-MacDingbat
139.1;MacDingbat
140;x-MacGreek
140.1;MacGreek
141;x-MacHebrew
141.1;MacHebrew
142;x-MacIceland
142.1;MacIceland
143;x-MacRoman
143.1;MacRoman
144;x-MacRomania
144.1;MacRomania
145;x-MacSymbol
145.1;MacSymbol
146;x-MacThai
146.1;MacThai
147;x-MacTurkish
147.1;MacTurkish
148;x-MacUkraine
148.1;MacUkraine
149;x-MS950-HKSCS
149.1;MS950_HKSCS
150;x-mswin-936
150.1;ms936
150.2;ms_936
151;x-PCK
151.1;pck
152;x-UTF-16LE-BOM
152.1;UnicodeLittle
153;X-UTF-32BE-BOM
153.1;UTF_32BE_BOM
153.2;UTF-32BE-BOM
154;X-UTF-32LE-BOM
154.1;UTF_32LE_BOM
154.2;UTF-32LE-BOM
155;x-windows-50220
155.1;cp50220
155.2;ms50220
156;x-windows-50221
156.1;ms50221
156.2;cp50221
157;x-windows-874
157.1;ms-874
157.2;ms874
157.3;windows-874
158;x-windows-949
158.1;windows-949
158.2;ms_949
158.3;windows949
158.4;ms949
159;x-windows-950
159.1;ms950
159.2;windows-950
160;x-windows-iso2022jp
160.1;windows-iso2022jp
生成成功(总时间:1 秒)
ibm-874
110;x-IBM875
110.1;ibm875
110.2;875
110.3;cp875
110.4;ibm-875
111;x-IBM921
111.1;cp921
111.2;ibm921
111.3;ibm-921
111.4;921
112;x-IBM922
112.1;ibm922
112.2;ibm-922
112.3;cp922
112.4;922
113;x-IBM930
113.1;cp930
113.2;ibm930
113.3;ibm-930
113.4;930
114;x-IBM933
114.1;cp933
114.2;933
114.3;ibm933
114.4;ibm-933
115;x-IBM935
115.1;ibm935
115.2;cp935
115.3;935
115.4;ibm-935
116;x-IBM937
116.1;ibm-937
116.2;cp937
116.3;937
116.4;ibm937
117;x-IBM939
117.1;ibm-939
117.2;ibm939
117.3;cp939
117.4;939
118;x-IBM942
118.1;ibm-942
118.2;ibm942
118.3;cp942
1