src/jdk.charsets/share/classes/sun/nio/cs/ext/ExtendedCharsets.java.template

Print this page


   1 /*
   2  * Copyright (c) 2002, 2013, Oracle and/or its affiliates. All rights reserved.

   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.  Oracle designates this
   8  * particular file as subject to the "Classpath" exception as provided
   9  * by Oracle in the LICENSE file that accompanied this code.
  10  *
  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any
  23  * questions.

  24  */
  25 


  26 package sun.nio.cs.ext;
  27 
  28 import java.lang.ref.SoftReference;
  29 import java.nio.charset.Charset;
  30 import java.nio.charset.spi.CharsetProvider;
  31 import sun.nio.cs.AbstractCharsetProvider;
  32 import java.security.AccessController;
  33 import java.security.PrivilegedAction;

  34 
  35 /**
  36  * Provider for extended charsets.
  37  */
  38 
  39 public class ExtendedCharsets
  40     extends AbstractCharsetProvider
  41 {
  42 
  43     static volatile ExtendedCharsets instance = null;
  44 
  45     public ExtendedCharsets() {
  46 
  47         super("sun.nio.cs.ext");  // identify provider pkg name.
  48 
  49         // Traditional Chinese
  50 
  51         charset("Big5", "Big5",
  52                 new String[] {
  53                     // IANA aliases
  54                     "csBig5"
  55                 });
  56 
  57         charset("x-MS950-HKSCS-XP", "MS950_HKSCS_XP",
  58                 new String[] {
  59                     "MS950_HKSCS_XP"  // JDK historical;
  60                 });
  61 
  62         charset("x-MS950-HKSCS", "MS950_HKSCS",
  63                 new String[] {
  64                     // IANA aliases
  65                     "MS950_HKSCS"     // JDK historical;
  66                 });
  67 
  68         charset("x-windows-950", "MS950",
  69                 new String[] {
  70                     "ms950",    // JDK historical
  71                     "windows-950"
  72                 });
  73 
  74         charset("x-windows-874", "MS874",
  75                 new String[] {
  76                     "ms874",  // JDK historical
  77                     "ms-874",
  78                     "windows-874" });
  79 
  80         charset("x-EUC-TW", "EUC_TW",
  81                 new String[] {
  82                     "euc_tw", // JDK historical
  83                     "euctw",
  84                     "cns11643",
  85                     "EUC-TW"
  86                 });
  87 
  88         charset("Big5-HKSCS", "Big5_HKSCS",
  89                 new String[] {
  90                     "Big5_HKSCS", // JDK historical
  91                     "big5hk",
  92                     "big5-hkscs",
  93                     "big5hkscs"   // Linux alias
  94                 });
  95 
  96         charset("x-Big5-HKSCS-2001", "Big5_HKSCS_2001",
  97                 new String[] {
  98                     "Big5_HKSCS_2001",
  99                     "big5hk-2001",
 100                     "big5-hkscs-2001",
 101                     "big5-hkscs:unicode3.0",
 102                     "big5hkscs-2001",
 103                 });
 104 
 105         charset("x-Big5-Solaris", "Big5_Solaris",
 106                 new String[] {
 107                     "Big5_Solaris", // JDK historical
 108                 });
 109 
 110         // Simplified Chinese
 111         charset("GBK", "GBK",
 112                 new String[] {
 113                     "windows-936",
 114                     "CP936"
 115                 });
 116 
 117         charset("GB18030", "GB18030",
 118                 new String[] {
 119                     "gb18030-2000"
 120                 });
 121 
 122         charset("GB2312", "EUC_CN",
 123                 new String[] {
 124                     // IANA aliases
 125                     "gb2312",
 126                     "gb2312-80",
 127                     "gb2312-1980",
 128                     "euc-cn",
 129                     "euccn",
 130                     "x-EUC-CN", // 1.4 compatibility
 131                     "EUC_CN" //JDK historical
 132                 });
 133 
 134         charset("x-mswin-936", "MS936",
 135                 new String[] {
 136                     "ms936", // historical
 137                     // IANA aliases
 138                     "ms_936"
 139                 });
 140 
 141         // The definition of this charset may be overridden by the init method,
 142         // below, if the sun.nio.cs.map property is defined.
 143         //
 144         charset("Shift_JIS", "SJIS",
 145                 new String[] {
 146                     // IANA aliases
 147                     "sjis", // historical
 148                     "shift_jis",
 149                     "shift-jis",
 150                     "ms_kanji",
 151                     "x-sjis",
 152                     "csShiftJIS"
 153                 });
 154 
 155         // The definition of this charset may be overridden by the init method,
 156         // below, if the sun.nio.cs.map property is defined.
 157         //
 158         charset("windows-31j", "MS932",
 159                 new String[] {
 160                     "MS932", // JDK historical
 161                     "windows-932",
 162                     "csWindows31J"
 163                 });
 164 
 165         charset("JIS_X0201", "JIS_X_0201",
 166                 new String[] {
 167                     "JIS0201", // JDK historical
 168                     // IANA aliases
 169                     "JIS_X0201",
 170                     "X0201",
 171                     "csHalfWidthKatakana"
 172                 });
 173 
 174         charset("x-JIS0208", "JIS_X_0208",
 175                 new String[] {
 176                     "JIS0208", // JDK historical
 177                     // IANA aliases
 178                     "JIS_C6226-1983",
 179                     "iso-ir-87",
 180                     "x0208",
 181                     "JIS_X0208-1983",
 182                     "csISO87JISX0208"
 183                 });
 184 
 185         charset("JIS_X0212-1990", "JIS_X_0212",
 186                 new String[] {
 187                     "JIS0212", // JDK historical
 188                     // IANA aliases
 189                     "jis_x0212-1990",
 190                     "x0212",
 191                     "iso-ir-159",
 192                     "csISO159JISX02121990"
 193                 });
 194 
 195         charset("x-SJIS_0213", "SJIS_0213",
 196                 new String[] {
 197                     "sjis-0213",
 198                     "sjis_0213",
 199                     "sjis:2004",
 200                     "sjis_0213:2004",
 201                     "shift_jis_0213:2004",
 202                     "shift_jis:2004"
 203                 });
 204 
 205         charset("x-MS932_0213", "MS932_0213",
 206                 new String[] {
 207                     "MS932-0213",
 208                     "MS932_0213",
 209                     "MS932:2004",
 210                     "windows-932-0213",
 211                     "windows-932:2004"
 212                 });
 213 
 214         charset("EUC-JP", "EUC_JP",
 215                 new String[] {
 216                     "euc_jp", // JDK historical
 217                     // IANA aliases
 218                     "eucjis",
 219                     "eucjp",
 220                     "Extended_UNIX_Code_Packed_Format_for_Japanese",
 221                     "csEUCPkdFmtjapanese",
 222                     "x-euc-jp",
 223                     "x-eucjp"
 224                 });
 225 
 226         charset("x-euc-jp-linux", "EUC_JP_LINUX",
 227                 new String[] {
 228                     "euc_jp_linux", // JDK historical
 229                     "euc-jp-linux"
 230                 });
 231 
 232         charset("x-eucjp-open", "EUC_JP_Open",
 233                 new String[] {
 234                     "EUC_JP_Solaris",   // JDK historical
 235                     "eucJP-open"
 236                 });
 237 
 238         charset("x-PCK", "PCK",
 239                 new String[] {
 240                     // IANA aliases
 241                     "pck" // historical
 242                 });
 243 
 244         charset("ISO-2022-JP", "ISO2022_JP",
 245             new String[] {
 246             // IANA aliases
 247             "iso2022jp", // historical
 248             "jis",
 249             "csISO2022JP",
 250             "jis_encoding",
 251             "csjisencoding"
 252         });
 253 
 254         charset("ISO-2022-JP-2", "ISO2022_JP_2",
 255             new String[] {
 256             // IANA aliases
 257             "csISO2022JP2",
 258             "iso2022jp2"
 259         });
 260 
 261         charset("x-windows-50221", "MS50221",
 262             new String[] {
 263             "ms50221", // historical
 264             "cp50221",
 265         });
 266 
 267         charset("x-windows-50220", "MS50220",
 268             new String[] {
 269             "ms50220", // historical
 270             "cp50220",
 271         });
 272 
 273         charset("x-windows-iso2022jp", "MSISO2022JP",
 274             new String[] {
 275             "windows-iso2022jp", // historical
 276         });
 277 
 278         charset("x-JISAutoDetect", "JISAutoDetect",
 279                 new String[] {
 280                     "JISAutoDetect" // historical
 281                 });
 282 
 283         // Korean
 284         charset("EUC-KR", "EUC_KR",
 285                 new String[] {
 286                     "euc_kr", // JDK historical
 287                     // IANA aliases
 288                     "ksc5601",
 289                     "euckr",
 290                     "ks_c_5601-1987",
 291                     "ksc5601-1987",
 292                     "ksc5601_1987",
 293                     "ksc_5601",
 294                     "csEUCKR",
 295                     "5601"
 296                 });
 297 
 298         charset("x-windows-949", "MS949",
 299                 new String[] {
 300                     "ms949",    // JDK historical
 301                     "windows949",
 302                     "windows-949",
 303                     // IANA aliases
 304                     "ms_949"
 305                 });
 306 
 307         charset("x-Johab", "Johab",
 308                 new String[] {
 309                         "ksc5601-1992",
 310                         "ksc5601_1992",
 311                         "ms1361",
 312                         "johab" // JDK historical
 313                 });
 314 
 315         charset("ISO-2022-KR", "ISO2022_KR",
 316                 new String[] {
 317                         "ISO2022KR", // JDK historical
 318                         "csISO2022KR"
 319                 });
 320 
 321         charset("ISO-2022-CN", "ISO2022_CN",
 322                 new String[] {
 323                         "ISO2022CN", // JDK historical
 324                         "csISO2022CN"
 325                 });
 326 
 327         charset("x-ISO-2022-CN-CNS", "ISO2022_CN_CNS",
 328                 new String[] {
 329                         "ISO2022CN_CNS", // JDK historical
 330                         "ISO-2022-CN-CNS"
 331                 });
 332 
 333         charset("x-ISO-2022-CN-GB", "ISO2022_CN_GB",
 334                 new String[] {
 335                         "ISO2022CN_GB", // JDK historical
 336                         "ISO-2022-CN-GB"
 337                 });
 338 
 339         charset("x-ISCII91", "ISCII91",
 340                 new String[] {
 341                         "iscii",
 342                         "ST_SEV_358-88",
 343                         "iso-ir-153",
 344                         "csISO153GOST1976874",
 345                         "ISCII91" // JDK historical
 346                 });
 347 
 348         charset("ISO-8859-3", "ISO_8859_3",
 349                 new String[] {
 350                     "iso8859_3", // JDK historical
 351                     "8859_3",
 352                     "ISO_8859-3:1988",
 353                     "iso-ir-109",
 354                     "ISO_8859-3",
 355                     "ISO8859-3",
 356                     "latin3",
 357                     "l3",
 358                     "ibm913",
 359                     "ibm-913",
 360                     "cp913",
 361                     "913",
 362                     "csISOLatin3"
 363                 });
 364 
 365         charset("ISO-8859-6", "ISO_8859_6",
 366                 new String[] {
 367                     "iso8859_6", // JDK historical
 368                     "8859_6",
 369                     "iso-ir-127",
 370                     "ISO_8859-6",
 371                     "ISO_8859-6:1987",
 372                     "ISO8859-6",
 373                     "ECMA-114",
 374                     "ASMO-708",
 375                     "arabic",
 376                     "ibm1089",
 377                     "ibm-1089",
 378                     "cp1089",
 379                     "1089",
 380                     "csISOLatinArabic"
 381                 });
 382 
 383         charset("ISO-8859-8", "ISO_8859_8",
 384                 new String[] {
 385                     "iso8859_8", // JDK historical
 386                     "8859_8",
 387                     "iso-ir-138",
 388                     "ISO_8859-8",
 389                     "ISO_8859-8:1988",
 390                     "ISO8859-8",
 391                     "cp916",
 392                     "916",
 393                     "ibm916",
 394                     "ibm-916",
 395                     "hebrew",
 396                     "csISOLatinHebrew"
 397                 });
 398 
 399         charset("x-ISO-8859-11", "ISO_8859_11",
 400                 new String[] {
 401                     "iso-8859-11",
 402                     "iso8859_11"
 403                 });
 404 
 405         charset("TIS-620", "TIS_620",
 406                 new String[] {
 407                     "tis620", // JDK historical
 408                     "tis620.2533"
 409                 });
 410 
 411         // Various Microsoft Windows international codepages
 412 
 413         charset("windows-1255", "MS1255",
 414                 new String[] {
 415                     "cp1255" // JDK historical
 416                 });
 417 
 418         charset("windows-1256", "MS1256",
 419                 new String[] {
 420                     "cp1256" // JDK historical
 421                 });
 422 
 423         charset("windows-1258", "MS1258",
 424                 new String[] {
 425                     "cp1258" // JDK historical
 426                 });
 427 
 428         // IBM & PC/MSDOS encodings
 429 
 430         charset("x-IBM942", "IBM942",
 431                 new String[] {
 432                     "cp942", // JDK historical
 433                     "ibm942",
 434                     "ibm-942",
 435                     "942"
 436                 });
 437 
 438         charset("x-IBM942C", "IBM942C",
 439                 new String[] {
 440                     "cp942C", // JDK historical
 441                     "ibm942C",
 442                     "ibm-942C",
 443                     "942C"
 444                 });
 445 
 446         charset("x-IBM943", "IBM943",
 447                 new String[] {
 448                     "cp943", // JDK historical
 449                     "ibm943",
 450                     "ibm-943",
 451                     "943"
 452                 });
 453 
 454         charset("x-IBM943C", "IBM943C",
 455                 new String[] {
 456                     "cp943C", // JDK historical
 457                     "ibm943C",
 458                     "ibm-943C",
 459                     "943C"
 460                 });
 461 
 462         charset("x-IBM948", "IBM948",
 463                 new String[] {
 464                     "cp948", // JDK historical
 465                     "ibm948",
 466                     "ibm-948",
 467                     "948"
 468                 });
 469 
 470         charset("x-IBM950", "IBM950",
 471                 new String[] {
 472                     "cp950", // JDK historical
 473                     "ibm950",
 474                     "ibm-950",
 475                     "950"
 476                 });
 477 
 478         charset("x-IBM930", "IBM930",
 479                 new String[] {
 480                     "cp930", // JDK historical
 481                     "ibm930",
 482                     "ibm-930",
 483                     "930"
 484                 });
 485 
 486         charset("x-IBM935", "IBM935",
 487                 new String[] {
 488                     "cp935", // JDK historical
 489                     "ibm935",
 490                     "ibm-935",
 491                     "935"
 492                 });
 493 
 494         charset("x-IBM937", "IBM937",
 495                 new String[] {
 496                     "cp937", // JDK historical
 497                     "ibm937",
 498                     "ibm-937",
 499                     "937"
 500                 });
 501 
 502         charset("x-IBM856", "IBM856",
 503                 new String[] {
 504                     "cp856", // JDK historical
 505                     "ibm-856",
 506                     "ibm856",
 507                     "856"
 508                 });
 509 
 510         charset("IBM860", "IBM860",
 511                 new String[] {
 512                     "cp860", // JDK historical
 513                     "ibm860",
 514                     "ibm-860",
 515                     "860",
 516                     "csIBM860"
 517                 });
 518         charset("IBM861", "IBM861",
 519                 new String[] {
 520                     "cp861", // JDK historical
 521                     "ibm861",
 522                     "ibm-861",
 523                     "861",
 524                     "csIBM861",
 525                     "cp-is"
 526                 });
 527 
 528         charset("IBM863", "IBM863",
 529                 new String[] {
 530                     "cp863", // JDK historical
 531                     "ibm863",
 532                     "ibm-863",
 533                     "863",
 534                     "csIBM863"
 535                 });
 536 
 537         charset("IBM864", "IBM864",
 538                 new String[] {
 539                     "cp864", // JDK historical
 540                     "ibm864",
 541                     "ibm-864",
 542                     "864",
 543                     "csIBM864"
 544                 });
 545 
 546         charset("IBM865", "IBM865",
 547                 new String[] {
 548                     "cp865", // JDK historical
 549                     "ibm865",
 550                     "ibm-865",
 551                     "865",
 552                     "csIBM865"
 553                 });
 554 
 555         charset("IBM868", "IBM868",
 556                 new String[] {
 557                     "cp868", // JDK historical
 558                     "ibm868",
 559                     "ibm-868",
 560                     "868",
 561                     "cp-ar",
 562                     "csIBM868"
 563                 });
 564 
 565         charset("IBM869", "IBM869",
 566                 new String[] {
 567                     "cp869", // JDK historical
 568                     "ibm869",
 569                     "ibm-869",
 570                     "869",
 571                     "cp-gr",
 572                     "csIBM869"
 573                 });
 574 
 575         charset("x-IBM921", "IBM921",
 576                 new String[] {
 577                     "cp921", // JDK historical
 578                     "ibm921",
 579                     "ibm-921",
 580                     "921"
 581                 });
 582 
 583         charset("x-IBM1006", "IBM1006",
 584                 new String[] {
 585                     "cp1006", // JDK historical
 586                     "ibm1006",
 587                     "ibm-1006",
 588                     "1006"
 589                 });
 590 
 591         charset("x-IBM1046", "IBM1046",
 592                 new String[] {
 593                     "cp1046", // JDK historical
 594                     "ibm1046",
 595                     "ibm-1046",
 596                     "1046"
 597                 });
 598 
 599         charset("IBM1047", "IBM1047",
 600                 new String[] {
 601                     "cp1047", // JDK historical
 602                     "ibm-1047",
 603                     "1047"
 604                 });
 605 
 606         charset("x-IBM1098", "IBM1098",
 607                 new String[] {
 608                     "cp1098", // JDK historical
 609                     "ibm1098",
 610                     "ibm-1098",
 611                     "1098",
 612                 });
 613 
 614         charset("IBM037", "IBM037",
 615                 new String[] {
 616                     "cp037", // JDK historical
 617                     "ibm037",
 618                     "ebcdic-cp-us",
 619                     "ebcdic-cp-ca",
 620                     "ebcdic-cp-wt",
 621                     "ebcdic-cp-nl",
 622                     "csIBM037",
 623                     "cs-ebcdic-cp-us",
 624                     "cs-ebcdic-cp-ca",
 625                     "cs-ebcdic-cp-wt",
 626                     "cs-ebcdic-cp-nl",
 627                     "ibm-037",
 628                     "ibm-37",
 629                     "cpibm37",
 630                     "037"
 631                 });
 632 
 633         charset("x-IBM1025", "IBM1025",
 634                 new String[] {
 635                     "cp1025", // JDK historical
 636                     "ibm1025",
 637                     "ibm-1025",
 638                     "1025"
 639                 });
 640 
 641         charset("IBM1026", "IBM1026",
 642                 new String[] {
 643                     "cp1026", // JDK historical
 644                     "ibm1026",
 645                     "ibm-1026",
 646                     "1026"
 647                 });
 648 
 649         charset("x-IBM1112", "IBM1112",
 650                 new String[] {
 651                     "cp1112", // JDK historical
 652                     "ibm1112",
 653                     "ibm-1112",
 654                     "1112"
 655                 });
 656 
 657         charset("x-IBM1122", "IBM1122",
 658                 new String[] {
 659                     "cp1122", // JDK historical
 660                     "ibm1122",
 661                     "ibm-1122",
 662                     "1122"
 663                 });
 664 
 665         charset("x-IBM1123", "IBM1123",
 666                 new String[] {
 667                     "cp1123", // JDK historical
 668                     "ibm1123",
 669                     "ibm-1123",
 670                     "1123"
 671                 });
 672 
 673         charset("x-IBM1124", "IBM1124",
 674                 new String[] {
 675                     "cp1124", // JDK historical
 676                     "ibm1124",
 677                     "ibm-1124",
 678                     "1124"
 679                 });
 680 
 681         charset("x-IBM1364", "IBM1364",
 682                 new String[] {
 683                     "cp1364",
 684                     "ibm1364",
 685                     "ibm-1364",
 686                     "1364"
 687                 });
 688 
 689         charset("IBM273", "IBM273",
 690                 new String[] {
 691                     "cp273", // JDK historical
 692                     "ibm273",
 693                     "ibm-273",
 694                     "273"
 695                 });
 696 
 697         charset("IBM277", "IBM277",
 698                 new String[] {
 699                     "cp277", // JDK historical
 700                     "ibm277",
 701                     "ibm-277",
 702                     "277"
 703                 });
 704 
 705         charset("IBM278", "IBM278",
 706                 new String[] {
 707                     "cp278", // JDK historical
 708                     "ibm278",
 709                     "ibm-278",
 710                     "278",
 711                     "ebcdic-sv",
 712                     "ebcdic-cp-se",
 713                     "csIBM278"
 714                 });
 715 
 716         charset("IBM280", "IBM280",
 717                 new String[] {
 718                     "cp280", // JDK historical
 719                     "ibm280",
 720                     "ibm-280",
 721                     "280"
 722                 });
 723 
 724         charset("IBM284", "IBM284",
 725                 new String[] {
 726                     "cp284", // JDK historical
 727                     "ibm284",
 728                     "ibm-284",
 729                     "284",
 730                     "csIBM284",
 731                     "cpibm284"
 732                 });
 733 
 734         charset("IBM285", "IBM285",
 735                 new String[] {
 736                     "cp285", // JDK historical
 737                     "ibm285",
 738                     "ibm-285",
 739                     "285",
 740                     "ebcdic-cp-gb",
 741                     "ebcdic-gb",
 742                     "csIBM285",
 743                     "cpibm285"
 744                 });
 745 
 746         charset("IBM297", "IBM297",
 747                 new String[] {
 748                     "cp297", // JDK historical
 749                     "ibm297",
 750                     "ibm-297",
 751                     "297",
 752                     "ebcdic-cp-fr",
 753                     "cpibm297",
 754                     "csIBM297",
 755                 });
 756 
 757         charset("IBM420", "IBM420",
 758                 new String[] {
 759                     "cp420", // JDK historical
 760                     "ibm420",
 761                     "ibm-420",
 762                     "ebcdic-cp-ar1",
 763                     "420",
 764                     "csIBM420"
 765                 });
 766 
 767         charset("IBM424", "IBM424",
 768                 new String[] {
 769                     "cp424", // JDK historical
 770                     "ibm424",
 771                     "ibm-424",
 772                     "424",
 773                     "ebcdic-cp-he",
 774                     "csIBM424"
 775                 });
 776 
 777         charset("IBM500", "IBM500",
 778                 new String[] {
 779                     "cp500", // JDK historical
 780                     "ibm500",
 781                     "ibm-500",
 782                     "500",
 783                     "ebcdic-cp-ch",
 784                     "ebcdic-cp-bh",
 785                     "csIBM500"
 786                 });
 787 
 788         charset("x-IBM833", "IBM833",
 789                 new String[] {
 790                      "cp833",
 791                      "ibm833",
 792                      "ibm-833"
 793                  });
 794 
 795         //EBCDIC DBCS-only Korean
 796         charset("x-IBM834", "IBM834",
 797                 new String[] {
 798                     "cp834",
 799                     "ibm834",
 800                     "834",
 801                     "ibm-834"
 802         });
 803 
 804 
 805         charset("IBM-Thai", "IBM838",
 806                 new String[] {
 807                     "cp838", // JDK historical
 808                     "ibm838",
 809                     "ibm-838",
 810                     "838"
 811                 });
 812 
 813         charset("IBM870", "IBM870",
 814                 new String[] {
 815                     "cp870", // JDK historical
 816                     "ibm870",
 817                     "ibm-870",
 818                     "870",
 819                     "ebcdic-cp-roece",
 820                     "ebcdic-cp-yu",
 821                     "csIBM870"
 822                 });
 823 
 824         charset("IBM871", "IBM871",
 825                 new String[] {
 826                     "cp871", // JDK historical
 827                     "ibm871",
 828                     "ibm-871",
 829                     "871",
 830                     "ebcdic-cp-is",
 831                     "csIBM871"
 832                 });
 833 
 834         charset("x-IBM875", "IBM875",
 835                 new String[] {
 836                     "cp875", // JDK historical
 837                     "ibm875",
 838                     "ibm-875",
 839                     "875"
 840                 });
 841 
 842         charset("IBM918", "IBM918",
 843                 new String[] {
 844                     "cp918", // JDK historical
 845                     "ibm-918",
 846                     "918",
 847                     "ebcdic-cp-ar2"
 848                 });
 849 
 850         charset("x-IBM922", "IBM922",
 851                 new String[] {
 852                     "cp922", // JDK historical
 853                     "ibm922",
 854                     "ibm-922",
 855                     "922"
 856                 });
 857 
 858         charset("x-IBM1097", "IBM1097",
 859                 new String[] {
 860                     "cp1097", // JDK historical
 861                     "ibm1097",
 862                     "ibm-1097",
 863                     "1097"
 864                 });
 865 
 866         charset("x-IBM949", "IBM949",
 867                 new String[] {
 868                     "cp949", // JDK historical
 869                     "ibm949",
 870                     "ibm-949",
 871                     "949"
 872                 });
 873 
 874         charset("x-IBM949C", "IBM949C",
 875                 new String[] {
 876                     "cp949C", // JDK historical
 877                     "ibm949C",
 878                     "ibm-949C",
 879                     "949C"
 880                 });
 881 
 882         charset("x-IBM939", "IBM939",
 883                 new String[] {
 884                     "cp939", // JDK historical
 885                     "ibm939",
 886                     "ibm-939",
 887                     "939"
 888                 });
 889 
 890         charset("x-IBM933", "IBM933",
 891                 new String[] {
 892                     "cp933", // JDK historical
 893                     "ibm933",
 894                     "ibm-933",
 895                     "933"
 896                 });
 897 
 898         charset("x-IBM1381", "IBM1381",
 899                 new String[] {
 900                     "cp1381", // JDK historical
 901                     "ibm1381",
 902                     "ibm-1381",
 903                     "1381"
 904                 });
 905 
 906         charset("x-IBM1383", "IBM1383",
 907                 new String[] {
 908                     "cp1383", // JDK historical
 909                     "ibm1383",
 910                     "ibm-1383",
 911                     "1383"
 912                 });
 913 
 914         charset("x-IBM970", "IBM970",
 915                 new String[] {
 916                     "cp970", // JDK historical
 917                     "ibm970",
 918                     "ibm-970",
 919                     "ibm-eucKR",
 920                     "970"
 921                 });
 922 
 923         charset("x-IBM964", "IBM964",
 924                 new String[] {
 925                     "cp964", // JDK historical
 926                     "ibm964",
 927                     "ibm-964",
 928                     "964"
 929                 });
 930 
 931         charset("x-IBM33722", "IBM33722",
 932                 new String[] {
 933                     "cp33722", // JDK historical
 934                     "ibm33722",
 935                     "ibm-33722",
 936                     "ibm-5050", // from IBM alias list
 937                     "ibm-33722_vascii_vpua", // from IBM alias list
 938                     "33722"
 939                 });
 940 
 941         charset("IBM01140", "IBM1140",
 942                 new String[] {
 943                     "cp1140", // JDK historical
 944                     "ccsid01140",
 945                     "cp01140",
 946                     "1140",
 947                     "ebcdic-us-037+euro"
 948                 });
 949 
 950         charset("IBM01141", "IBM1141",
 951                 new String[] {
 952                     "cp1141", // JDK historical
 953                     "ccsid01141",
 954                     "cp01141",
 955                     "1141",
 956                     "ebcdic-de-273+euro"
 957                 });
 958 
 959         charset("IBM01142", "IBM1142",
 960                 new String[] {
 961                     "cp1142", // JDK historical
 962                     "ccsid01142",
 963                     "cp01142",
 964                     "1142",
 965                     "ebcdic-no-277+euro",
 966                     "ebcdic-dk-277+euro"
 967                 });
 968 
 969         charset("IBM01143", "IBM1143",
 970                 new String[] {
 971                     "cp1143", // JDK historical
 972                     "ccsid01143",
 973                     "cp01143",
 974                     "1143",
 975                     "ebcdic-fi-278+euro",
 976                     "ebcdic-se-278+euro"
 977                 });
 978 
 979         charset("IBM01144", "IBM1144",
 980                 new String[] {
 981                     "cp1144", // JDK historical
 982                     "ccsid01144",
 983                     "cp01144",
 984                     "1144",
 985                     "ebcdic-it-280+euro"
 986                 });
 987 
 988         charset("IBM01145", "IBM1145",
 989                 new String[] {
 990                     "cp1145", // JDK historical
 991                     "ccsid01145",
 992                     "cp01145",
 993                     "1145",
 994                     "ebcdic-es-284+euro"
 995                 });
 996 
 997         charset("IBM01146", "IBM1146",
 998                 new String[] {
 999                     "cp1146", // JDK historical
1000                     "ccsid01146",
1001                     "cp01146",
1002                     "1146",
1003                     "ebcdic-gb-285+euro"
1004                 });
1005 
1006         charset("IBM01147", "IBM1147",
1007                 new String[] {
1008                     "cp1147", // JDK historical
1009                     "ccsid01147",
1010                     "cp01147",
1011                     "1147",
1012                     "ebcdic-fr-277+euro"
1013                 });
1014 
1015         charset("IBM01148", "IBM1148",
1016                 new String[] {
1017                     "cp1148", // JDK historical
1018                     "ccsid01148",
1019                     "cp01148",
1020                     "1148",
1021                     "ebcdic-international-500+euro"
1022                 });
1023 
1024         charset("IBM01149", "IBM1149",
1025                 new String[] {
1026                     "cp1149", // JDK historical
1027                     "ccsid01149",
1028                     "cp01149",
1029                     "1149",
1030                     "ebcdic-s-871+euro"
1031                 });
1032 
1033         charset("IBM290", "IBM290",
1034                 new String[] {
1035                     "cp290",
1036                     "ibm290",
1037                     "ibm-290",
1038                     "csIBM290",
1039                     "EBCDIC-JP-kana",
1040                     "290"
1041                 });
1042 
1043         charset("x-IBM300", "IBM300",
1044                 new String[] {
1045                     "cp300",
1046                     "ibm300",
1047                     "ibm-300",
1048                     "300"
1049                 });
1050 
1051         // Macintosh MacOS/Apple char encodingd
1052 
1053 
1054         charset("x-MacRoman", "MacRoman",
1055                 new String[] {
1056                     "MacRoman" // JDK historical
1057                 });
1058 
1059         charset("x-MacCentralEurope", "MacCentralEurope",
1060                 new String[] {
1061                     "MacCentralEurope" // JDK historical
1062                 });
1063 
1064         charset("x-MacCroatian", "MacCroatian",
1065                 new String[] {
1066                     "MacCroatian" // JDK historical
1067                 });
1068 
1069 
1070         charset("x-MacGreek", "MacGreek",
1071                 new String[] {
1072                     "MacGreek" // JDK historical
1073                 });
1074 
1075         charset("x-MacCyrillic", "MacCyrillic",
1076                 new String[] {
1077                     "MacCyrillic" // JDK historical
1078                 });
1079 
1080         charset("x-MacUkraine", "MacUkraine",
1081                 new String[] {
1082                     "MacUkraine" // JDK historical
1083                 });
1084 
1085         charset("x-MacTurkish", "MacTurkish",
1086                 new String[] {
1087                     "MacTurkish" // JDK historical
1088                 });
1089 
1090         charset("x-MacArabic", "MacArabic",
1091                 new String[] {
1092                     "MacArabic" // JDK historical
1093                 });
1094 
1095         charset("x-MacHebrew", "MacHebrew",
1096                 new String[] {
1097                     "MacHebrew" // JDK historical
1098                 });
1099 
1100         charset("x-MacIceland", "MacIceland",
1101                 new String[] {
1102                     "MacIceland" // JDK historical
1103                 });
1104 
1105         charset("x-MacRomania", "MacRomania",
1106                 new String[] {
1107                     "MacRomania" // JDK historical
1108                 });
1109 
1110         charset("x-MacThai", "MacThai",
1111                 new String[] {
1112                     "MacThai" // JDK historical
1113                 });
1114 
1115         charset("x-MacSymbol", "MacSymbol",
1116                 new String[] {
1117                     "MacSymbol" // JDK historical
1118                 });
1119 
1120         charset("x-MacDingbat", "MacDingbat",
1121                 new String[] {
1122                     "MacDingbat" // JDK historical
1123                 });
1124 
1125         instance = this;
1126 
1127     }
1128 
1129     private boolean initialized = false;
1130 
1131     // If the sun.nio.cs.map property is defined on the command line we won't
1132     // see it in the system-properties table until after the charset subsystem
1133     // has been initialized.  We therefore delay the effect of this property
1134     // until after the JRE has completely booted.
1135     //
1136     // At the moment following values for this property are supported, property
1137     // value string is case insensitive.
1138     //
1139     // (1)"Windows-31J/Shift_JIS"
1140     // In 1.4.1 we added a correct implementation of the Shift_JIS charset
1141     // but in previous releases this charset name had been treated as an alias
1142     // for Windows-31J, aka MS932. Users who have existing code that depends
1143     // upon this alias can restore the previous behavior by defining this


1175 
1176         String map = getProperty("sun.nio.cs.map");
1177         boolean sjisIsMS932 = false;
1178         boolean iso2022jpIsMS50221 = false;
1179         boolean iso2022jpIsMS50220 = false;
1180         boolean iso2022jpIsMSISO2022JP = false;
1181         if (map != null) {
1182             String[] maps = map.split(",");
1183             for (int i = 0; i < maps.length; i++) {
1184                 if (maps[i].equalsIgnoreCase("Windows-31J/Shift_JIS")) {
1185                     sjisIsMS932 = true;
1186                 } else if (maps[i].equalsIgnoreCase("x-windows-50221/ISO-2022-JP")) {
1187                     iso2022jpIsMS50221 = true;
1188                 } else if (maps[i].equalsIgnoreCase("x-windows-50220/ISO-2022-JP")) {
1189                     iso2022jpIsMS50220 = true;
1190                 } else if (maps[i].equalsIgnoreCase("x-windows-iso2022jp/ISO-2022-JP")) {
1191                     iso2022jpIsMSISO2022JP = true;
1192                 }
1193             }
1194         }
1195         if (sjisIsMS932) {
1196             deleteCharset("Shift_JIS",
1197                           new String[] {
1198                               // IANA aliases
1199                               "sjis", // historical
1200                               "shift_jis",
1201                               "shift-jis",
1202                               "ms_kanji",
1203                               "x-sjis",
1204                               "csShiftJIS"
1205                           });
1206             deleteCharset("windows-31j",
1207                           new String[] {
1208                               "MS932", // JDK historical
1209                               "windows-932",
1210                               "csWindows31J"
1211                           });
1212             charset("Shift_JIS", "SJIS",
1213                     new String[] {
1214                         // IANA aliases
1215                         "sjis"          // JDK historical


1306         initialized = true;
1307     }
1308 
1309     private static String getProperty(String key) {
1310         // this method may be called during initialization of
1311         // system class loader and thus not using lambda
1312         return AccessController.doPrivileged(
1313             new PrivilegedAction<String>() {
1314                 @Override
1315                 public String run() {
1316                     return System.getProperty(key);
1317                 }
1318             });
1319     }
1320 
1321     public static String[] aliasesFor(String charsetName) {
1322         if (instance == null)
1323             return null;
1324         return instance.aliases(charsetName);
1325     }

1326 }
   1 /*
   2  * Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved.
   3  *
   4  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   5  *
   6  * This code is free software; you can redistribute it and/or modify it
   7  * under the terms of the GNU General Public License version 2 only, as
   8  * published by the Free Software Foundation.  Oracle designates this
   9  * particular file as subject to the "Classpath" exception as provided
  10  * by Oracle in the LICENSE file that accompanied this code.
  11  *
  12  * This code is distributed in the hope that it will be useful, but WITHOUT
  13  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  14  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  15  * version 2 for more details (a copy is included in the LICENSE file that
  16  * accompanied this code).
  17  *
  18  * You should have received a copy of the GNU General Public License version
  19  * 2 along with this work; if not, write to the Free Software Foundation,
  20  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  21  *
  22  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  23  * or visit www.oracle.com if you need additional information or have any
  24  * questions.
  25  *
  26  */
  27 
  28 // -- This file was mechanically generated: Do not edit! -- //
  29 
  30 package sun.nio.cs.ext;
  31 
  32 import java.lang.ref.SoftReference;
  33 import java.nio.charset.Charset;
  34 import java.nio.charset.spi.CharsetProvider;
  35 import sun.nio.cs.AbstractCharsetProvider;
  36 import java.security.AccessController;
  37 import java.security.PrivilegedAction;
  38 import sun.nio.cs.AbstractCharsetProvider;
  39 
  40 /**
  41  * Provider for extended charsets.
  42  */
  43 
  44 public class ExtendedCharsets extends AbstractCharsetProvider {


  45 
  46     static volatile ExtendedCharsets instance = null;
  47 
  48     public ExtendedCharsets() {
  49 
  50         super("sun.nio.cs.ext");  // identify provider pkg name.
  51 
  52         _CHARSETS_DEF_LIST_


















































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































  53 
  54         instance = this;
  55 
  56     }
  57 
  58     private boolean initialized = false;
  59 
  60     // If the sun.nio.cs.map property is defined on the command line we won't
  61     // see it in the system-properties table until after the charset subsystem
  62     // has been initialized.  We therefore delay the effect of this property
  63     // until after the JRE has completely booted.
  64     //
  65     // At the moment following values for this property are supported, property
  66     // value string is case insensitive.
  67     //
  68     // (1)"Windows-31J/Shift_JIS"
  69     // In 1.4.1 we added a correct implementation of the Shift_JIS charset
  70     // but in previous releases this charset name had been treated as an alias
  71     // for Windows-31J, aka MS932. Users who have existing code that depends
  72     // upon this alias can restore the previous behavior by defining this


 104 
 105         String map = getProperty("sun.nio.cs.map");
 106         boolean sjisIsMS932 = false;
 107         boolean iso2022jpIsMS50221 = false;
 108         boolean iso2022jpIsMS50220 = false;
 109         boolean iso2022jpIsMSISO2022JP = false;
 110         if (map != null) {
 111             String[] maps = map.split(",");
 112             for (int i = 0; i < maps.length; i++) {
 113                 if (maps[i].equalsIgnoreCase("Windows-31J/Shift_JIS")) {
 114                     sjisIsMS932 = true;
 115                 } else if (maps[i].equalsIgnoreCase("x-windows-50221/ISO-2022-JP")) {
 116                     iso2022jpIsMS50221 = true;
 117                 } else if (maps[i].equalsIgnoreCase("x-windows-50220/ISO-2022-JP")) {
 118                     iso2022jpIsMS50220 = true;
 119                 } else if (maps[i].equalsIgnoreCase("x-windows-iso2022jp/ISO-2022-JP")) {
 120                     iso2022jpIsMSISO2022JP = true;
 121                 }
 122             }
 123         }
 124         if (sjisIsMS932 && hasCharset("Shift_JIS")) {
 125             deleteCharset("Shift_JIS",
 126                           new String[] {
 127                               // IANA aliases
 128                               "sjis", // historical
 129                               "shift_jis",
 130                               "shift-jis",
 131                               "ms_kanji",
 132                               "x-sjis",
 133                               "csShiftJIS"
 134                           });
 135             deleteCharset("windows-31j",
 136                           new String[] {
 137                               "MS932", // JDK historical
 138                               "windows-932",
 139                               "csWindows31J"
 140                           });
 141             charset("Shift_JIS", "SJIS",
 142                     new String[] {
 143                         // IANA aliases
 144                         "sjis"          // JDK historical


 235         initialized = true;
 236     }
 237 
 238     private static String getProperty(String key) {
 239         // this method may be called during initialization of
 240         // system class loader and thus not using lambda
 241         return AccessController.doPrivileged(
 242             new PrivilegedAction<String>() {
 243                 @Override
 244                 public String run() {
 245                     return System.getProperty(key);
 246                 }
 247             });
 248     }
 249 
 250     public static String[] aliasesFor(String charsetName) {
 251         if (instance == null)
 252             return null;
 253         return instance.aliases(charsetName);
 254     }
 255 
 256 }