make/data/charsetmapping/DoubleByte-X.java.template

Print this page




  33 import java.util.Arrays;
  34 import sun.nio.cs.HistoricallyNamedCharset;
  35 import sun.nio.cs.DoubleByte;
  36 import sun.nio.cs.*;
  37 
  38 public class $NAME_CLZ$ extends Charset
  39                         $IMPLEMENTS$
  40 {
  41     public $NAME_CLZ$() {
  42         super("$NAME_CS$", $NAME_ALIASES$);
  43     }
  44 
  45     $HISTORICALNAME$
  46 
  47     public boolean contains(Charset cs) {
  48         $CONTAINS$
  49     }
  50 
  51     public CharsetDecoder newDecoder() {
  52         initb2c();
  53         return new  DoubleByte.Decoder$DECTYPE$(this, b2c, b2cSB, $B2MIN$, $B2MAX$);
  54     }
  55 
  56     public CharsetEncoder newEncoder() {
  57         initc2b();
  58         return new DoubleByte.Encoder$ENCTYPE$(this, $ENC_REPLACEMENT$ c2b, c2bIndex); 
  59     }
  60 
  61     $B2C$
  62     static char[][] b2c = new char[b2cStr.length][];
  63     static char[] b2cSB;
  64     private static volatile boolean b2cInitialized = false;
  65 
  66     static void initb2c() {
  67         if (b2cInitialized)
  68             return;
  69         synchronized (b2c) {
  70             if (b2cInitialized)
  71                 return;
  72             for (int i = 0; i < b2cStr.length; i++) {
  73                 if (b2cStr[i] == null)
  74                     b2c[i] = DoubleByte.B2C_UNMAPPABLE;
  75                 else
  76                     b2c[i] = b2cStr[i].toCharArray();
  77             }
  78             b2cSB = b2cSBStr.toCharArray();




  33 import java.util.Arrays;
  34 import sun.nio.cs.HistoricallyNamedCharset;
  35 import sun.nio.cs.DoubleByte;
  36 import sun.nio.cs.*;
  37 
  38 public class $NAME_CLZ$ extends Charset
  39                         $IMPLEMENTS$
  40 {
  41     public $NAME_CLZ$() {
  42         super("$NAME_CS$", $NAME_ALIASES$);
  43     }
  44 
  45     $HISTORICALNAME$
  46 
  47     public boolean contains(Charset cs) {
  48         $CONTAINS$
  49     }
  50 
  51     public CharsetDecoder newDecoder() {
  52         initb2c();
  53         return new  DoubleByte.Decoder$DECTYPE$(this, b2c, b2cSB, $B2MIN$, $B2MAX$, $ASCIICOMPATIBLE$);
  54     }
  55 
  56     public CharsetEncoder newEncoder() {
  57         initc2b();
  58         return new DoubleByte.Encoder$ENCTYPE$(this, $ENC_REPLACEMENT$ c2b, c2bIndex, $ASCIICOMPATIBLE$);
  59     }
  60 
  61     $B2C$
  62     static char[][] b2c = new char[b2cStr.length][];
  63     static char[] b2cSB;
  64     private static volatile boolean b2cInitialized = false;
  65 
  66     static void initb2c() {
  67         if (b2cInitialized)
  68             return;
  69         synchronized (b2c) {
  70             if (b2cInitialized)
  71                 return;
  72             for (int i = 0; i < b2cStr.length; i++) {
  73                 if (b2cStr[i] == null)
  74                     b2c[i] = DoubleByte.B2C_UNMAPPABLE;
  75                 else
  76                     b2c[i] = b2cStr[i].toCharArray();
  77             }
  78             b2cSB = b2cSBStr.toCharArray();