30 import java.nio.charset.CharsetEncoder; 31 32 public class ISO2022_JP_2 extends ISO2022_JP 33 { 34 public ISO2022_JP_2() { 35 super("ISO-2022-JP-2", 36 ExtendedCharsets.aliasesFor("ISO-2022-JP-2")); 37 } 38 39 public String historicalName() { 40 return "ISO2022JP2"; 41 } 42 43 public boolean contains(Charset cs) { 44 return super.contains(cs) || 45 (cs instanceof JIS_X_0212) || 46 (cs instanceof ISO2022_JP_2); 47 } 48 49 public CharsetDecoder newDecoder() { 50 return new Decoder(this, Decoder.DEC0208, DEC0212); 51 } 52 53 public CharsetEncoder newEncoder() { 54 return new Encoder(this, Encoder.ENC0208, ENC0212, true); 55 } 56 57 private final static DoubleByte.Decoder DEC0212 = 58 (DoubleByte.Decoder)new JIS_X_0212().newDecoder(); 59 60 private final static DoubleByte.Encoder ENC0212 = 61 (DoubleByte.Encoder)new JIS_X_0212().newEncoder(); 62 63 } | 30 import java.nio.charset.CharsetEncoder; 31 32 public class ISO2022_JP_2 extends ISO2022_JP 33 { 34 public ISO2022_JP_2() { 35 super("ISO-2022-JP-2", 36 ExtendedCharsets.aliasesFor("ISO-2022-JP-2")); 37 } 38 39 public String historicalName() { 40 return "ISO2022JP2"; 41 } 42 43 public boolean contains(Charset cs) { 44 return super.contains(cs) || 45 (cs instanceof JIS_X_0212) || 46 (cs instanceof ISO2022_JP_2); 47 } 48 49 public CharsetDecoder newDecoder() { 50 return new Decoder(this, Decoder.DEC0208, CoderHolder.DEC0212); 51 } 52 53 public CharsetEncoder newEncoder() { 54 return new Encoder(this, Encoder.ENC0208, CoderHolder.ENC0212, true); 55 } 56 57 private static class CoderHolder { 58 final static DoubleByte.Decoder DEC0212 = 59 (DoubleByte.Decoder)new JIS_X_0212().newDecoder(); 60 final static DoubleByte.Encoder ENC0212 = 61 (DoubleByte.Encoder)new JIS_X_0212().newEncoder(); 62 } 63 } |