2
|
1 |
/*
|
|
2 |
* Copyright 2003-2005 Sun Microsystems, Inc. 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. Sun designates this
|
|
8 |
* particular file as subject to the "Classpath" exception as provided
|
|
9 |
* by Sun 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
|
|
22 |
* CA 95054 USA or visit www.sun.com if you need additional information or
|
|
23 |
* have any questions.
|
|
24 |
*/
|
|
25 |
|
|
26 |
package sun.nio.cs;
|
|
27 |
|
|
28 |
import java.nio.charset.Charset;
|
|
29 |
import java.nio.charset.CharsetDecoder;
|
|
30 |
import java.nio.charset.CharsetEncoder;
|
|
31 |
import sun.nio.cs.StandardCharsets;
|
|
32 |
import sun.nio.cs.SingleByteDecoder;
|
|
33 |
import sun.nio.cs.SingleByteEncoder;
|
|
34 |
import sun.nio.cs.HistoricallyNamedCharset;
|
|
35 |
|
|
36 |
public class IBM858
|
|
37 |
extends Charset
|
|
38 |
implements HistoricallyNamedCharset
|
|
39 |
{
|
|
40 |
|
|
41 |
public IBM858() {
|
|
42 |
super("IBM00858", StandardCharsets.aliases_IBM858);
|
|
43 |
}
|
|
44 |
|
|
45 |
public String historicalName() {
|
|
46 |
return "Cp858";
|
|
47 |
}
|
|
48 |
|
|
49 |
public boolean contains(Charset cs) {
|
|
50 |
return (cs instanceof IBM858);
|
|
51 |
}
|
|
52 |
|
|
53 |
public CharsetDecoder newDecoder() {
|
|
54 |
return new Decoder(this);
|
|
55 |
}
|
|
56 |
|
|
57 |
public CharsetEncoder newEncoder() {
|
|
58 |
return new Encoder(this);
|
|
59 |
}
|
|
60 |
|
|
61 |
|
|
62 |
/**
|
|
63 |
* These accessors are temporarily supplied while sun.io
|
|
64 |
* converters co-exist with the sun.nio.cs.{ext} charset coders
|
|
65 |
* These facilitate sharing of conversion tables between the
|
|
66 |
* two co-existing implementations. When sun.io converters
|
|
67 |
* are made extinct these will be unncessary and should be removed
|
|
68 |
*/
|
|
69 |
|
|
70 |
public static String getDecoderSingleByteMappings() {
|
|
71 |
return IBM850.getDecoderSingleByteMappings();
|
|
72 |
}
|
|
73 |
|
|
74 |
public short[] getEncoderIndex1() {
|
|
75 |
return Encoder.index1;
|
|
76 |
|
|
77 |
}
|
|
78 |
public String getEncoderIndex2() {
|
|
79 |
return Encoder.index2;
|
|
80 |
|
|
81 |
}
|
|
82 |
|
|
83 |
private static class Decoder extends IBM850.Decoder {
|
|
84 |
public Decoder(Charset cs) {
|
|
85 |
super(cs);
|
|
86 |
}
|
|
87 |
|
|
88 |
public char decode(int byteIndex) {
|
|
89 |
return (byteIndex == (byte)0xD5) ? '\u20AC' : super.decode(byteIndex);
|
|
90 |
}
|
|
91 |
}
|
|
92 |
|
|
93 |
private static class Encoder extends SingleByteEncoder {
|
|
94 |
public Encoder(Charset cs) {
|
|
95 |
super(cs, index1, index2, 0xFF00, 0x00FF, 8);
|
|
96 |
}
|
|
97 |
|
|
98 |
private final static String index2 =
|
|
99 |
|
|
100 |
"\u0000\u0001\u0002\u0003\u0004\u0005\u0006\u0007" +
|
|
101 |
"\b\t\n\u000B\f\r\u000E\u000F" +
|
|
102 |
"\u0010\u0011\u0012\u0013\u0014\u0015\u0016\u0017" +
|
|
103 |
"\u0018\u0019\u001A\u001B\u001C\u001D\u001E\u001F" +
|
|
104 |
"\u0020\u0021\"\u0023\u0024\u0025\u0026\'" +
|
|
105 |
"\u0028\u0029\u002A\u002B\u002C\u002D\u002E\u002F" +
|
|
106 |
"\u0030\u0031\u0032\u0033\u0034\u0035\u0036\u0037" +
|
|
107 |
"\u0038\u0039\u003A\u003B\u003C\u003D\u003E\u003F" +
|
|
108 |
"\u0040\u0041\u0042\u0043\u0044\u0045\u0046\u0047" +
|
|
109 |
"\u0048\u0049\u004A\u004B\u004C\u004D\u004E\u004F" +
|
|
110 |
"\u0050\u0051\u0052\u0053\u0054\u0055\u0056\u0057" +
|
|
111 |
"\u0058\u0059\u005A\u005B\\\u005D\u005E\u005F" +
|
|
112 |
"\u0060\u0061\u0062\u0063\u0064\u0065\u0066\u0067" +
|
|
113 |
"\u0068\u0069\u006A\u006B\u006C\u006D\u006E\u006F" +
|
|
114 |
"\u0070\u0071\u0072\u0073\u0074\u0075\u0076\u0077" +
|
|
115 |
"\u0078\u0079\u007A\u007B\u007C\u007D\u007E\u007F" +
|
|
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 |
"\u00FF\u00AD\u00BD\u009C\u00CF\u00BE\u00DD\u00F5" +
|
|
121 |
"\u00F9\u00B8\u00A6\u00AE\u00AA\u00F0\u00A9\u00EE" +
|
|
122 |
"\u00F8\u00F1\u00FD\u00FC\u00EF\u00E6\u00F4\u00FA" +
|
|
123 |
"\u00F7\u00FB\u00A7\u00AF\u00AC\u00AB\u00F3\u00A8" +
|
|
124 |
"\u00B7\u00B5\u00B6\u00C7\u008E\u008F\u0092\u0080" +
|
|
125 |
"\u00D4\u0090\u00D2\u00D3\u00DE\u00D6\u00D7\u00D8" +
|
|
126 |
"\u00D1\u00A5\u00E3\u00E0\u00E2\u00E5\u0099\u009E" +
|
|
127 |
"\u009D\u00EB\u00E9\u00EA\u009A\u00ED\u00E8\u00E1" +
|
|
128 |
"\u0085\u00A0\u0083\u00C6\u0084\u0086\u0091\u0087" +
|
|
129 |
"\u008A\u0082\u0088\u0089\u008D\u00A1\u008C\u008B" +
|
|
130 |
"\u00D0\u00A4\u0095\u00A2\u0093\u00E4\u0094\u00F6" +
|
|
131 |
"\u009B\u0097\u00A3\u0096\u0081\u00EC\u00E7\u0098" +
|
|
132 |
"\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
|
|
133 |
"\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
|
|
134 |
"\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
|
|
135 |
"\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
|
|
136 |
"\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
|
|
137 |
"\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
|
|
138 |
"\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
|
|
139 |
"\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
|
|
140 |
"\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
|
|
141 |
"\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
|
|
142 |
"\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
|
|
143 |
"\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
|
|
144 |
"\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
|
|
145 |
"\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
|
|
146 |
"\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
|
|
147 |
"\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
|
|
148 |
"\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
|
|
149 |
"\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
|
|
150 |
"\u0000\u0000\u009F\u0000\u0000\u0000\u0000\u0000" +
|
|
151 |
"\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
|
|
152 |
"\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
|
|
153 |
"\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
|
|
154 |
"\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
|
|
155 |
"\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
|
|
156 |
"\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
|
|
157 |
"\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
|
|
158 |
"\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
|
|
159 |
"\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
|
|
160 |
"\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
|
|
161 |
"\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
|
|
162 |
"\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
|
|
163 |
"\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
|
|
164 |
"\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
|
|
165 |
"\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
|
|
166 |
"\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
|
|
167 |
"\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
|
|
168 |
"\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
|
|
169 |
"\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
|
|
170 |
"\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
|
|
171 |
"\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
|
|
172 |
"\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
|
|
173 |
"\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
|
|
174 |
"\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
|
|
175 |
"\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
|
|
176 |
"\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
|
|
177 |
"\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
|
|
178 |
"\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
|
|
179 |
"\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
|
|
180 |
"\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
|
|
181 |
"\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
|
|
182 |
"\u0000\u0000\u0000\u00F2\u0000\u0000\u0000\u0000" +
|
|
183 |
"\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
|
|
184 |
"\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
|
|
185 |
"\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
|
|
186 |
"\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
|
|
187 |
"\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
|
|
188 |
"\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
|
|
189 |
"\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
|
|
190 |
"\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
|
|
191 |
"\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
|
|
192 |
"\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
|
|
193 |
"\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
|
|
194 |
"\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
|
|
195 |
"\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
|
|
196 |
"\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
|
|
197 |
"\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
|
|
198 |
"\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
|
|
199 |
"\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
|
|
200 |
"\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
|
|
201 |
"\u00D5\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
|
|
202 |
"\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
|
|
203 |
"\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
|
|
204 |
"\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
|
|
205 |
"\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
|
|
206 |
"\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
|
|
207 |
"\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
|
|
208 |
"\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
|
|
209 |
"\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
|
|
210 |
"\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
|
|
211 |
"\u0000\u0000\u0000\u0000\u00C4\u0000\u00B3\u0000" +
|
|
212 |
"\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
|
|
213 |
"\u00DA\u0000\u0000\u0000\u00BF\u0000\u0000\u0000" +
|
|
214 |
"\u00C0\u0000\u0000\u0000\u00D9\u0000\u0000\u0000" +
|
|
215 |
"\u00C3\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
|
|
216 |
"\u00B4\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
|
|
217 |
"\u00C2\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
|
|
218 |
"\u00C1\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
|
|
219 |
"\u00C5\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
|
|
220 |
"\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
|
|
221 |
"\u0000\u0000\u0000\u0000\u00CD\u00BA\u0000\u0000" +
|
|
222 |
"\u00C9\u0000\u0000\u00BB\u0000\u0000\u00C8\u0000" +
|
|
223 |
"\u0000\u00BC\u0000\u0000\u00CC\u0000\u0000\u00B9" +
|
|
224 |
"\u0000\u0000\u00CB\u0000\u0000\u00CA\u0000\u0000" +
|
|
225 |
"\u00CE\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
|
|
226 |
"\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
|
|
227 |
"\u0000\u0000\u0000\u0000\u00DF\u0000\u0000\u0000" +
|
|
228 |
"\u00DC\u0000\u0000\u0000\u00DB\u0000\u0000\u0000" +
|
|
229 |
"\u0000\u0000\u0000\u0000\u0000\u00B0\u00B1\u00B2" +
|
|
230 |
"\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
|
|
231 |
"\u0000\u0000\u0000\u0000\u00FE\u0000\u0000\u0000" +
|
|
232 |
"\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
|
|
233 |
"\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
|
|
234 |
"\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
|
|
235 |
"\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
|
|
236 |
"\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
|
|
237 |
"\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
|
|
238 |
"\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
|
|
239 |
"\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
|
|
240 |
"\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
|
|
241 |
"\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
|
|
242 |
"\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
|
|
243 |
"\u0000\u0000\u0000\u0000";
|
|
244 |
|
|
245 |
private final static short index1[] = {
|
|
246 |
0, 256, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403,
|
|
247 |
403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403,
|
|
248 |
636, 403, 403, 403, 403, 892, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403,
|
|
249 |
403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403,
|
|
250 |
403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403,
|
|
251 |
403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403,
|
|
252 |
403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403,
|
|
253 |
403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403,
|
|
254 |
403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403,
|
|
255 |
403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403,
|
|
256 |
403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403,
|
|
257 |
403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403,
|
|
258 |
403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403,
|
|
259 |
403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403,
|
|
260 |
403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403,
|
|
261 |
403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403,
|
|
262 |
};
|
|
263 |
}
|
|
264 |
}
|