32 import java.nio.ByteBuffer; 33 import java.nio.charset.Charset; 34 import java.nio.charset.CharsetDecoder; 35 import java.nio.charset.CharsetEncoder; 36 import java.nio.charset.CoderResult; 37 import static sun.nio.cs.CharsetMapping.*; 38 39 // EBCDIC DBCS-only Korean 40 public class IBM834 extends Charset 41 { 42 public IBM834() { 43 super("x-IBM834", ExtendedCharsets.aliasesFor("x-IBM834")); 44 } 45 46 public boolean contains(Charset cs) { 47 return (cs instanceof IBM834); 48 } 49 50 public CharsetDecoder newDecoder() { 51 IBM933.initb2c(); 52 return new DoubleByte.Decoder_EBCDIC_DBCSONLY( 53 this, IBM933.b2c, 0x40, 0xfe); // hardcode the b2min/max 54 } 55 56 public CharsetEncoder newEncoder() { 57 IBM933.initc2b(); 58 return new Encoder(this); 59 } 60 61 protected static class Encoder extends DoubleByte.Encoder_EBCDIC_DBCSONLY { 62 public Encoder(Charset cs) { 63 super(cs, new byte[] {(byte)0xfe, (byte)0xfe}, 64 IBM933.c2b, IBM933.c2bIndex); 65 } 66 67 public int encodeChar(char ch) { 68 int bb = super.encodeChar(ch); 69 if (bb == UNMAPPABLE_ENCODING) { 70 // Cp834 has 6 additional non-roundtrip char->bytes 71 // mappings, see#6379808 72 if (ch == '\u00b7') { 73 return 0x4143; 74 } else if (ch == '\u00ad') { 75 return 0x4148; 76 } else if (ch == '\u2015') { 77 return 0x4149; 78 } else if (ch == '\u223c') { 79 return 0x42a1; 80 } else if (ch == '\uff5e') { 81 return 0x4954; | 32 import java.nio.ByteBuffer; 33 import java.nio.charset.Charset; 34 import java.nio.charset.CharsetDecoder; 35 import java.nio.charset.CharsetEncoder; 36 import java.nio.charset.CoderResult; 37 import static sun.nio.cs.CharsetMapping.*; 38 39 // EBCDIC DBCS-only Korean 40 public class IBM834 extends Charset 41 { 42 public IBM834() { 43 super("x-IBM834", ExtendedCharsets.aliasesFor("x-IBM834")); 44 } 45 46 public boolean contains(Charset cs) { 47 return (cs instanceof IBM834); 48 } 49 50 public CharsetDecoder newDecoder() { 51 IBM933.initb2c(); 52 return new DoubleByte.Decoder_DBCSONLY( 53 this, IBM933.b2c, null, 0x40, 0xfe); // hardcode the b2min/max 54 } 55 56 public CharsetEncoder newEncoder() { 57 IBM933.initc2b(); 58 return new Encoder(this); 59 } 60 61 protected static class Encoder extends DoubleByte.Encoder_DBCSONLY { 62 public Encoder(Charset cs) { 63 super(cs, new byte[] {(byte)0xfe, (byte)0xfe}, 64 IBM933.c2b, IBM933.c2bIndex); 65 } 66 67 public int encodeChar(char ch) { 68 int bb = super.encodeChar(ch); 69 if (bb == UNMAPPABLE_ENCODING) { 70 // Cp834 has 6 additional non-roundtrip char->bytes 71 // mappings, see#6379808 72 if (ch == '\u00b7') { 73 return 0x4143; 74 } else if (ch == '\u00ad') { 75 return 0x4148; 76 } else if (ch == '\u2015') { 77 return 0x4149; 78 } else if (ch == '\u223c') { 79 return 0x42a1; 80 } else if (ch == '\uff5e') { 81 return 0x4954; |