< prev index next >

make/src/classes/build/tools/charsetmapping/DBCS.java

Print this page
rev 17642 : 8186517: sun.nio.cs.StandardCharsets$Aliases and Classes can be lazily loaded
Reviewed-by: sherman, martin, plevart


 162         if (clzName.startsWith("JIS_X_0208")) {
 163             c2bRepl = "new byte[]{ (byte)0x21, (byte)0x29 },";
 164         } else if (clzName.startsWith("JIS_X_0212")) {
 165             c2bRepl = "new byte[]{ (byte)0x22, (byte)0x44 },";
 166         } else if (clzName.startsWith("IBM300")) {
 167             c2bRepl = "new byte[]{ (byte)0x42, (byte)0x6f },";
 168         }
 169 
 170         while (s.hasNextLine()) {
 171             String line = s.nextLine();
 172             if (line.indexOf("$") == -1) {
 173                 ops.println(line);
 174                 continue;
 175             }
 176             line = line.replace("$PACKAGE$" , pkgName)
 177                        .replace("$IMPLEMENTS$", (hisName == null)?
 178                                 "" : "implements HistoricallyNamedCharset")
 179                        .replace("$NAME_CLZ$", clzName)
 180                        .replace("$NAME_ALIASES$",
 181                                 "sun.nio.cs".equals(pkgName) ?
 182                                 "StandardCharsets.aliases_" + clzName :
 183                                 "ExtendedCharsets.aliasesFor(\"" + csName + "\")")
 184                        .replace("$NAME_CS$" , csName)
 185                        .replace("$CONTAINS$",
 186                                 "MS932".equals(clzName)?
 187                                 "return ((cs.name().equals(\"US-ASCII\")) || (cs instanceof JIS_X_0201) || (cs instanceof " + clzName + "));":
 188                                 (isASCII ?
 189                                  "return ((cs.name().equals(\"US-ASCII\")) || (cs instanceof " + clzName + "));":
 190                                  "return (cs instanceof " + clzName + ");"))
 191                        .replace("$HISTORICALNAME$",
 192                                 (hisName == null)? "" :
 193                                 "    public String historicalName() { return \"" + hisName + "\"; }")
 194                        .replace("$DECTYPE$", type)
 195                        .replace("$ENCTYPE$", type)
 196                        .replace("$B1MIN$"   , "0x" + Integer.toString(b1Min, 16))
 197                        .replace("$B1MAX$"   , "0x" + Integer.toString(b1Max, 16))
 198                        .replace("$B2MIN$"   , "0x" + Integer.toString(b2Min, 16))
 199                        .replace("$B2MAX$"   , "0x" + Integer.toString(b2Max, 16))
 200                        .replace("$ASCIICOMPATIBLE$", isASCII ? "true" : "false")
 201                        .replace("$B2C$", b2c)
 202                        .replace("$C2BLENGTH$", "0x" + Integer.toString(c2bOff, 16))


 162         if (clzName.startsWith("JIS_X_0208")) {
 163             c2bRepl = "new byte[]{ (byte)0x21, (byte)0x29 },";
 164         } else if (clzName.startsWith("JIS_X_0212")) {
 165             c2bRepl = "new byte[]{ (byte)0x22, (byte)0x44 },";
 166         } else if (clzName.startsWith("IBM300")) {
 167             c2bRepl = "new byte[]{ (byte)0x42, (byte)0x6f },";
 168         }
 169 
 170         while (s.hasNextLine()) {
 171             String line = s.nextLine();
 172             if (line.indexOf("$") == -1) {
 173                 ops.println(line);
 174                 continue;
 175             }
 176             line = line.replace("$PACKAGE$" , pkgName)
 177                        .replace("$IMPLEMENTS$", (hisName == null)?
 178                                 "" : "implements HistoricallyNamedCharset")
 179                        .replace("$NAME_CLZ$", clzName)
 180                        .replace("$NAME_ALIASES$",
 181                                 "sun.nio.cs".equals(pkgName) ?
 182                                 "StandardCharsets.aliases_" + clzName + "()" :
 183                                 "ExtendedCharsets.aliasesFor(\"" + csName + "\")")
 184                        .replace("$NAME_CS$" , csName)
 185                        .replace("$CONTAINS$",
 186                                 "MS932".equals(clzName)?
 187                                 "return ((cs.name().equals(\"US-ASCII\")) || (cs instanceof JIS_X_0201) || (cs instanceof " + clzName + "));":
 188                                 (isASCII ?
 189                                  "return ((cs.name().equals(\"US-ASCII\")) || (cs instanceof " + clzName + "));":
 190                                  "return (cs instanceof " + clzName + ");"))
 191                        .replace("$HISTORICALNAME$",
 192                                 (hisName == null)? "" :
 193                                 "    public String historicalName() { return \"" + hisName + "\"; }")
 194                        .replace("$DECTYPE$", type)
 195                        .replace("$ENCTYPE$", type)
 196                        .replace("$B1MIN$"   , "0x" + Integer.toString(b1Min, 16))
 197                        .replace("$B1MAX$"   , "0x" + Integer.toString(b1Max, 16))
 198                        .replace("$B2MIN$"   , "0x" + Integer.toString(b2Min, 16))
 199                        .replace("$B2MAX$"   , "0x" + Integer.toString(b2Max, 16))
 200                        .replace("$ASCIICOMPATIBLE$", isASCII ? "true" : "false")
 201                        .replace("$B2C$", b2c)
 202                        .replace("$C2BLENGTH$", "0x" + Integer.toString(c2bOff, 16))
< prev index next >