1 /*
   2  * Copyright (c) 2001, 2005, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.  Oracle designates this
   8  * particular file as subject to the "Classpath" exception as provided
   9  * by Oracle in the LICENSE file that accompanied this code.
  10  *
  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any
  23  * questions.
  24  */
  25 
  26 
  27 package sun.awt.motif;
  28 
  29 import java.nio.charset.Charset;
  30 import java.nio.charset.CharsetEncoder;
  31 import java.nio.charset.CharsetDecoder;
  32 import sun.nio.cs.ext.DoubleByteEncoder;
  33 
  34 public class X11SunUnicode_0 extends Charset {
  35     public X11SunUnicode_0 () {
  36         super("X11SunUnicode_0", null);
  37     }
  38 
  39     public CharsetEncoder newEncoder() {
  40         return new Encoder(this);
  41     }
  42 
  43     /* Seems like supporting a decoder is required, but we aren't going
  44      * to be publically exposing this class, so no need to waste work
  45      */
  46     public CharsetDecoder newDecoder() {
  47         throw new Error("Decoder is not implemented for X11SunUnicode_0 Charset");
  48     }
  49 
  50     public boolean contains(Charset cs) {
  51         return cs instanceof X11SunUnicode_0;
  52     }
  53 
  54     private static class Encoder extends DoubleByteEncoder {
  55         public Encoder(Charset cs) {
  56             super(cs, index1, index2);
  57         }
  58 
  59         private final static String innerIndex0=
  60             "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000"+
  61             "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000"+
  62             "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000"+
  63             "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000"+
  64             "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000"+
  65             "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000"+
  66             "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000"+
  67             "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000"+
  68             "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000"+
  69             "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000"+
  70             "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000"+
  71             "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000"+
  72             "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000"+
  73             "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000"+
  74             "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000"+
  75             "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000"+
  76             "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000"+
  77             "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000"+
  78             "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000"+
  79             "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000"+
  80             "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000"+
  81             "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000"+
  82             "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000"+
  83             "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000"+
  84             "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000"+
  85             "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000"+
  86             "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000"+
  87             "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000"+
  88             "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000"+
  89             "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000"+
  90             "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000"+
  91             "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000"+
  92             "\u0000\u0120\u0121\u0122\u0000\u0123\u0124\u0125"+
  93             "\u0126\u0127\u0128\u0129\u012A\u012B\u012C\u012D"+
  94             "\u012E\u012F\u0130\u0131\u0132\u0133\u0134\u0135"+
  95             "\u0136\u0137\u0138\u0139\u013A\u013B\u013C\u013D"+
  96             "\u013E\u013F\u0140\u0141\u0142\u0143\u0144\u0145"+
  97             "\u0146\u0147\u0148\u0149\u014A\u014B\u014C\u014D"+
  98             "\u014E\u014F\u0150\u0151\u0152\u0153\u0154\u0155"+
  99             "\u0156\u0157\u0000\u0000\u0158\u0159\u015A\u015B"+
 100             "\u015C\u015D\u015E\u015F\u0160\u0161\u0162\u0163"+
 101             "\u0164\u0165\u0166\u0167\u0168\u0169\u0000\u0000"+
 102             "\u016A\u016B\u016C\u016D\u016E\u0000\u0000\u0000"+
 103             "\u016F\u0170\u0171\u0172\u0173\u0174\u0175\u0176"+
 104             "\u0177\u0178\u0179\u017A\u017B\u017C\u017D\u017E"+
 105             "\u017F\u0180\u0181\u0182\u0183\u0184\u0185\u0186"+
 106             "\u0187\u0000\u0000\u0000\u0000\u0000\u0000\u0000"+
 107             "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000"+
 108             "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000"+
 109             "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000"+
 110             "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000"+
 111             "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000"+
 112             "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000"+
 113             "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000"+
 114             "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000"+
 115             "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000"+
 116             "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000"+
 117             "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000"+
 118             "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000"+
 119             "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000"+
 120             "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000"+
 121             "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000"+
 122             "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000"+
 123             "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000";
 124 
 125         private final static short index1[] = {
 126             0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0,
 127             0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
 128             0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
 129             0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
 130             0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
 131             0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
 132             0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
 133             0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
 134             0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
 135             0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
 136             0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
 137             0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
 138             0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
 139             0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
 140             0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
 141             0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
 142         };
 143 
 144         private final static String index2[] = {
 145             innerIndex0
 146         };
 147 
 148         /* The default implementation creates a decoder and we don't have one */
 149         public boolean isLegalReplacement(byte[] repl) {
 150             return true;
 151         }
 152     }
 153 }
--- EOF ---