CompressedCmapLineReader.java
1.67 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
/*
* Decompiled with CFR 0_118.
*/
package com.adobe.internal.pdftoolkit.pdf.graphics.font.impl;
import java.io.IOException;
import java.io.LineNumberReader;
import java.io.Reader;
class CompressedCmapLineReader
extends LineNumberReader {
private static final String EOF_STRING = "%%EOF";
private static final String BEGIN_RESOURCE_START_STRING = "%%BeginResource: CMap (";
private boolean cmapEof;
private boolean actualEof;
private String cmapName;
public CompressedCmapLineReader(Reader in) throws IOException {
super(in);
}
public String readLine() throws IOException {
if (this.cmapEof) {
return null;
}
String line = super.readLine();
if (line == null) {
this.actualEof = true;
return null;
}
if ("%%EOF".equals(line)) {
this.cmapEof = true;
return null;
}
if (this.cmapName == null && line.startsWith("%%BeginResource: CMap (")) {
this.cmapName = line.substring("%%BeginResource: CMap (".length(), line.lastIndexOf(41));
}
if (line.startsWith("%%")) {
return line;
}
if (line.contains(":")) {
line = line.replace(":", "> <");
}
if (line.contains("=")) {
line = line.replace("=", "> ");
}
return line;
}
String getCmapName() {
return this.cmapName;
}
public void resetCmapReader() throws IOException {
this.cmapEof = false;
this.cmapName = null;
}
public boolean actualEof() {
return this.actualEof;
}
public void close() throws IOException {
}
}