< prev index next >

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

Print this page


   1 
   2 /*
   3  * Copyright (c) 2006, 2012, Oracle and/or its affiliates. All rights reserved.
   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  */
  29 
  30 package sun.nio.cs.ext;
  31 
  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 sun.nio.cs.DoubleByte;
  38 import static sun.nio.cs.CharsetMapping.*;
  39 
  40 // EBCDIC DBCS-only Korean
  41 public class IBM834 extends Charset
  42 {
  43     public IBM834() {
  44         super("x-IBM834", ExtendedCharsets.aliasesFor("x-IBM834"));
  45     }
  46 
  47     public boolean contains(Charset cs) {
  48         return (cs instanceof IBM834);
  49     }
  50 
  51     public CharsetDecoder newDecoder() {
  52         IBM933.initb2c();
  53         return new DoubleByte.Decoder_DBCSONLY(
  54             this, IBM933.b2c, null, 0x40, 0xfe);  // hardcode the b2min/max
  55     }
  56 
  57     public CharsetEncoder newEncoder() {
  58         IBM933.initc2b();
  59         return new Encoder(this);
  60     }
  61 
  62     protected static class Encoder extends DoubleByte.Encoder_DBCSONLY {
  63         public Encoder(Charset cs) {
  64             super(cs, new byte[] {(byte)0xfe, (byte)0xfe},


   1 
   2 /*
   3  * Copyright (c) 2006, 2020, Oracle and/or its affiliates. All rights reserved.
   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  */
  29 
  30 package $PACKAGE$;
  31 
  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 sun.nio.cs.DoubleByte;
  38 import static sun.nio.cs.CharsetMapping.*;
  39 
  40 // EBCDIC DBCS-only Korean
  41 public class IBM834 extends Charset
  42 {
  43     public IBM834() {
  44         super("x-IBM834", $ALIASES$);
  45     }
  46 
  47     public boolean contains(Charset cs) {
  48         return (cs instanceof IBM834);
  49     }
  50 
  51     public CharsetDecoder newDecoder() {
  52         IBM933.initb2c();
  53         return new DoubleByte.Decoder_DBCSONLY(
  54             this, IBM933.b2c, null, 0x40, 0xfe);  // hardcode the b2min/max
  55     }
  56 
  57     public CharsetEncoder newEncoder() {
  58         IBM933.initc2b();
  59         return new Encoder(this);
  60     }
  61 
  62     protected static class Encoder extends DoubleByte.Encoder_DBCSONLY {
  63         public Encoder(Charset cs) {
  64             super(cs, new byte[] {(byte)0xfe, (byte)0xfe},


< prev index next >