UCharacterNameReader.java
3.96 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
/*
* Decompiled with CFR 0_118.
*/
package com.adobe.agl.impl;
import com.adobe.agl.impl.ICUBinary;
import com.adobe.agl.impl.UCharacterName;
import java.io.DataInputStream;
import java.io.IOException;
import java.io.InputStream;
final class UCharacterNameReader
implements ICUBinary.Authenticate {
private DataInputStream m_dataInputStream_;
private int m_tokenstringindex_;
private int m_groupindex_;
private int m_groupstringindex_;
private int m_algnamesindex_;
private static final byte[] DATA_FORMAT_VERSION_ = new byte[]{1, 0, 0, 0};
private static final byte[] DATA_FORMAT_ID_ = new byte[]{117, 110, 97, 109};
public boolean isDataVersionAcceptable(byte[] version) {
return version[0] == DATA_FORMAT_VERSION_[0];
}
protected UCharacterNameReader(InputStream inputStream) throws IOException {
ICUBinary.readHeader(inputStream, DATA_FORMAT_ID_, this);
this.m_dataInputStream_ = new DataInputStream(inputStream);
}
protected void read(UCharacterName data) throws IOException {
this.m_tokenstringindex_ = this.m_dataInputStream_.readInt();
this.m_groupindex_ = this.m_dataInputStream_.readInt();
this.m_groupstringindex_ = this.m_dataInputStream_.readInt();
this.m_algnamesindex_ = this.m_dataInputStream_.readInt();
int count = this.m_dataInputStream_.readChar();
char[] token = new char[count];
for (int i = 0; i < count; i = (char)(i + '\u0001')) {
token[i] = this.m_dataInputStream_.readChar();
}
int size = this.m_groupindex_ - this.m_tokenstringindex_;
byte[] tokenstr = new byte[size];
this.m_dataInputStream_.readFully(tokenstr);
data.setToken(token, tokenstr);
count = this.m_dataInputStream_.readChar();
data.setGroupCountSize(count, 3);
char[] group = new char[count *= 3];
for (int i2 = 0; i2 < count; ++i2) {
group[i2] = this.m_dataInputStream_.readChar();
}
size = this.m_algnamesindex_ - this.m_groupstringindex_;
byte[] groupstring = new byte[size];
this.m_dataInputStream_.readFully(groupstring);
data.setGroup(group, groupstring);
count = this.m_dataInputStream_.readInt();
UCharacterName.AlgorithmName[] alg = new UCharacterName.AlgorithmName[count];
for (int i3 = 0; i3 < count; ++i3) {
UCharacterName.AlgorithmName an = this.readAlg();
if (an == null) {
throw new IOException("unames.icu read error: Algorithmic names creation error");
}
alg[i3] = an;
}
data.setAlgorithm(alg);
}
private UCharacterName.AlgorithmName readAlg() throws IOException {
int rangeend;
byte type;
int variant;
UCharacterName.AlgorithmName result = new UCharacterName.AlgorithmName();
int rangestart = this.m_dataInputStream_.readInt();
if (!result.setInfo(rangestart, rangeend = this.m_dataInputStream_.readInt(), type = this.m_dataInputStream_.readByte(), (byte)(variant = this.m_dataInputStream_.readByte()))) {
return null;
}
int size = this.m_dataInputStream_.readChar();
if (type == 1) {
char[] factor = new char[variant];
for (int j = 0; j < variant; ++j) {
factor[j] = this.m_dataInputStream_.readChar();
}
result.setFactor(factor);
size -= variant << 1;
}
StringBuffer prefix = new StringBuffer();
char c = (char)(this.m_dataInputStream_.readByte() & 255);
while (c != '\u0000') {
prefix.append(c);
c = (char)(this.m_dataInputStream_.readByte() & 255);
}
result.setPrefix(prefix.toString());
if ((size -= 12 + prefix.length() + 1) > 0) {
byte[] string = new byte[size];
this.m_dataInputStream_.readFully(string);
result.setFactorString(string);
}
return result;
}
}