Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/mobile
Path: blob/master/test/jdk/sun/nio/cs/OLD/IBM943C_OLD.java
41154 views
1
/*
2
* Copyright (c) 2003, 2004, 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
*/
28
29
30
import java.nio.charset.Charset;
31
import java.nio.charset.CharsetDecoder;
32
import java.nio.charset.CharsetEncoder;
33
import java.nio.charset.CharacterCodingException;
34
import sun.nio.cs.HistoricallyNamedCharset;
35
36
public class IBM943C_OLD extends Charset implements HistoricallyNamedCharset
37
{
38
39
public IBM943C_OLD() {
40
super("x-IBM943C_OLD", null);
41
}
42
43
public String historicalName() {
44
return "Cp943_OLDC";
45
}
46
47
public boolean contains(Charset cs) {
48
return ((cs.name().equals("US-ASCII"))
49
|| (cs instanceof IBM943C_OLD));
50
}
51
52
public CharsetDecoder newDecoder() {
53
return new Decoder(this);
54
}
55
56
public CharsetEncoder newEncoder() {
57
return new Encoder(this);
58
}
59
60
private static class Decoder extends IBM943_OLD.Decoder {
61
protected static final String singleByteToChar;
62
63
static {
64
String indexs = "";
65
for (char c = '\0'; c < '\u0080'; ++c) indexs += c;
66
singleByteToChar = indexs +
67
IBM943_OLD.Decoder.singleByteToChar.substring(indexs.length());
68
}
69
70
public Decoder(Charset cs) {
71
super(cs, singleByteToChar);
72
}
73
}
74
75
private static class Encoder extends IBM943_OLD.Encoder {
76
77
protected static final short index1[];
78
protected static final String index2a;
79
protected static final int shift = 6;
80
81
static {
82
String indexs = "";
83
for (char c = '\0'; c < '\u0080'; ++c) indexs += c;
84
index2a = IBM943_OLD.Encoder.index2a + indexs;
85
86
int o = IBM943_OLD.Encoder.index2a.length() + 15000;
87
index1 = new short[IBM943_OLD.Encoder.index1.length];
88
System.arraycopy(IBM943_OLD.Encoder.index1,
89
0,
90
index1,
91
0,
92
IBM943_OLD.Encoder.index1.length);
93
94
for (int i = 0; i * (1<<shift) < 128; ++i) {
95
index1[i] = (short)(o + i * (1<<shift));
96
}
97
}
98
99
public Encoder(Charset cs) {
100
super(cs, index1, index2a);
101
}
102
}
103
}
104
105