001: /*
002: * Copyright 2001-2005 Sun Microsystems, Inc. All Rights Reserved.
003: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
004: *
005: * This code is free software; you can redistribute it and/or modify it
006: * under the terms of the GNU General Public License version 2 only, as
007: * published by the Free Software Foundation. Sun designates this
008: * particular file as subject to the "Classpath" exception as provided
009: * by Sun in the LICENSE file that accompanied this code.
010: *
011: * This code is distributed in the hope that it will be useful, but WITHOUT
012: * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
013: * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
014: * version 2 for more details (a copy is included in the LICENSE file that
015: * accompanied this code).
016: *
017: * You should have received a copy of the GNU General Public License version
018: * 2 along with this work; if not, write to the Free Software Foundation,
019: * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
020: *
021: * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
022: * CA 95054 USA or visit www.sun.com if you need additional information or
023: * have any questions.
024: */
025:
026: package sun.awt.motif;
027:
028: import java.nio.charset.Charset;
029: import java.nio.charset.CharsetEncoder;
030: import java.nio.charset.CharsetDecoder;
031: import sun.nio.cs.ext.DoubleByteEncoder;
032:
033: public class X11SunUnicode_0 extends Charset {
034: public X11SunUnicode_0() {
035: super ("X11SunUnicode_0", null);
036: }
037:
038: public CharsetEncoder newEncoder() {
039: return new Encoder(this );
040: }
041:
042: /* Seems like supporting a decoder is required, but we aren't going
043: * to be publically exposing this class, so no need to waste work
044: */
045: public CharsetDecoder newDecoder() {
046: throw new Error(
047: "Decoder is not implemented for X11SunUnicode_0 Charset");
048: }
049:
050: public boolean contains(Charset cs) {
051: return cs instanceof X11SunUnicode_0;
052: }
053:
054: private static class Encoder extends DoubleByteEncoder {
055: public Encoder(Charset cs) {
056: super (cs, index1, index2);
057: }
058:
059: private final static String innerIndex0 = "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000"
060: + "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000"
061: + "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000"
062: + "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000"
063: + "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000"
064: + "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000"
065: + "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000"
066: + "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000"
067: + "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000"
068: + "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000"
069: + "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000"
070: + "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000"
071: + "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000"
072: + "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000"
073: + "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000"
074: + "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000"
075: + "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000"
076: + "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000"
077: + "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000"
078: + "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000"
079: + "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000"
080: + "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000"
081: + "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000"
082: + "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000"
083: + "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000"
084: + "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000"
085: + "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000"
086: + "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000"
087: + "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000"
088: + "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000"
089: + "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000"
090: + "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000"
091: + "\u0000\u0120\u0121\u0122\u0000\u0123\u0124\u0125"
092: + "\u0126\u0127\u0128\u0129\u012A\u012B\u012C\u012D"
093: + "\u012E\u012F\u0130\u0131\u0132\u0133\u0134\u0135"
094: + "\u0136\u0137\u0138\u0139\u013A\u013B\u013C\u013D"
095: + "\u013E\u013F\u0140\u0141\u0142\u0143\u0144\u0145"
096: + "\u0146\u0147\u0148\u0149\u014A\u014B\u014C\u014D"
097: + "\u014E\u014F\u0150\u0151\u0152\u0153\u0154\u0155"
098: + "\u0156\u0157\u0000\u0000\u0158\u0159\u015A\u015B"
099: + "\u015C\u015D\u015E\u015F\u0160\u0161\u0162\u0163"
100: + "\u0164\u0165\u0166\u0167\u0168\u0169\u0000\u0000"
101: + "\u016A\u016B\u016C\u016D\u016E\u0000\u0000\u0000"
102: + "\u016F\u0170\u0171\u0172\u0173\u0174\u0175\u0176"
103: + "\u0177\u0178\u0179\u017A\u017B\u017C\u017D\u017E"
104: + "\u017F\u0180\u0181\u0182\u0183\u0184\u0185\u0186"
105: + "\u0187\u0000\u0000\u0000\u0000\u0000\u0000\u0000"
106: + "\u0000\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:
124: private final static short index1[] = { 0, 0, 0, 0, 0, 0, 0, 0,
125: 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
126: 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
127: 0, 0, 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, 0, 0,
129: 0, 0, 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, 0, 0,
131: 0, 0, 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, 0, 0,
133: 0, 0, 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, 0, 0,
135: 0, 0, 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, 0, 0,
137: 0, 0, 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 };
139:
140: private final static String index2[] = { innerIndex0 };
141:
142: /* The default implementation creates a decoder and we don't have one */
143: public boolean isLegalReplacement(byte[] repl) {
144: return true;
145: }
146: }
147: }
|