StringPrepDataReader.java
2.06 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
/*
* 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;
public final class StringPrepDataReader
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[]{83, 80, 82, 80};
private static final byte[] DATA_FORMAT_VERSION = new byte[]{3, 2, 5, 2};
public StringPrepDataReader(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());
}
}
public void read(byte[] idnaBytes, char[] mappingTable) throws IOException {
this.dataInputStream.readFully(idnaBytes);
for (int i = 0; i < mappingTable.length; ++i) {
mappingTable[i] = this.dataInputStream.readChar();
}
}
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 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;
}
public byte[] getUnicodeVersion() {
return this.unicodeVersion;
}
}