NormalizerDataReader.java
3.29 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
/*
* Decompiled with CFR 0_118.
*/
package com.adobe.agl.impl;
import com.adobe.agl.impl.ICUBinary;
import com.adobe.agl.impl.ICUDebug;
import java.io.DataInputStream;
import java.io.IOException;
import java.io.InputStream;
final class NormalizerDataReader
implements ICUBinary.Authenticate {
private static final boolean debug = ICUDebug.enabled("NormalizerDataReader");
private DataInputStream dataInputStream;
private byte[] unicodeVersion;
private static final byte[] DATA_FORMAT_ID = new byte[]{78, 111, 114, 109};
private static final byte[] DATA_FORMAT_VERSION = new byte[]{2, 2, 5, 2};
protected NormalizerDataReader(InputStream inputStream) throws IOException {
if (debug) {
System.out.println("Bytes in inputStream " + inputStream.available());
}
this.unicodeVersion = ICUBinary.readHeader(inputStream, DATA_FORMAT_ID, this);
if (debug) {
System.out.println("Bytes left in inputStream " + inputStream.available());
}
this.dataInputStream = new DataInputStream(inputStream);
if (debug) {
System.out.println("Bytes left in dataInputStream " + this.dataInputStream.available());
}
}
protected int[] readIndexes(int length) throws IOException {
int[] indexes = new int[length];
for (int i = 0; i < length; ++i) {
indexes[i] = this.dataInputStream.readInt();
}
return indexes;
}
protected void read(byte[] normBytes, byte[] fcdBytes, byte[] auxBytes, char[] extraData, char[] combiningTable, Object[] canonStartSets) throws IOException {
int i;
this.dataInputStream.readFully(normBytes);
for (i = 0; i < extraData.length; ++i) {
extraData[i] = this.dataInputStream.readChar();
}
for (i = 0; i < combiningTable.length; ++i) {
combiningTable[i] = this.dataInputStream.readChar();
}
this.dataInputStream.readFully(fcdBytes);
this.dataInputStream.readFully(auxBytes);
int[] canonStartSetsIndexes = new int[32];
for (int i2 = 0; i2 < canonStartSetsIndexes.length; ++i2) {
canonStartSetsIndexes[i2] = this.dataInputStream.readChar();
}
char[] startSets = new char[canonStartSetsIndexes[0] - 32];
for (int i3 = 0; i3 < startSets.length; ++i3) {
startSets[i3] = this.dataInputStream.readChar();
}
char[] bmpTable = new char[canonStartSetsIndexes[1]];
for (int i4 = 0; i4 < bmpTable.length; ++i4) {
bmpTable[i4] = this.dataInputStream.readChar();
}
char[] suppTable = new char[canonStartSetsIndexes[2]];
for (int i5 = 0; i5 < suppTable.length; ++i5) {
suppTable[i5] = this.dataInputStream.readChar();
}
canonStartSets[0] = canonStartSetsIndexes;
canonStartSets[1] = startSets;
canonStartSets[2] = bmpTable;
canonStartSets[3] = suppTable;
}
public byte[] getDataFormatVersion() {
return DATA_FORMAT_VERSION;
}
public boolean isDataVersionAcceptable(byte[] version) {
return version[0] == DATA_FORMAT_VERSION[0] && version[2] == DATA_FORMAT_VERSION[2] && version[3] == DATA_FORMAT_VERSION[3];
}
public byte[] getUnicodeVersion() {
return this.unicodeVersion;
}
}