CosParseBuf.java
3.64 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
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
/*
* Decompiled with CFR 0_118.
*
* Could not load the following classes:
* com.adobe.internal.io.stream.InputByteStream
*/
package com.adobe.internal.pdftoolkit.core.cos;
import com.adobe.internal.io.stream.InputByteStream;
import java.io.IOException;
import java.io.InputStream;
final class CosParseBuf
implements InputByteStream {
private InputByteStream mBaseBuf = null;
private int mBufferSize = 0;
private long mOrigPos = 0;
private int mBaseOffset = 0;
private int mPos = 0;
private int mEnd = 0;
private byte[] mBuffer = null;
private boolean readTillBufferSize = false;
CosParseBuf(InputByteStream baseBuf, int bufferSize) throws IOException {
this.mBaseBuf = baseBuf;
this.mBufferSize = bufferSize;
this.mBuffer = new byte[this.mBufferSize];
this.mOrigPos = baseBuf.getPosition();
this.mEnd = baseBuf.read(this.mBuffer);
}
CosParseBuf(InputByteStream baseBuf, int bufferSize, boolean readTillBufferSize) throws IOException {
this(baseBuf, bufferSize);
this.readTillBufferSize = readTillBufferSize;
}
public int read() throws IOException {
if (this.readTillBufferSize && this.mPos == this.mBufferSize) {
return -1;
}
if (this.mPos == this.mEnd) {
this.mBaseOffset += this.mPos;
this.mEnd = this.mBaseBuf.read(this.mBuffer);
if (this.mEnd <= 0) {
return -1;
}
this.mPos = 0;
}
return 255 & this.mBuffer[this.mPos++];
}
public int unget() {
if (this.mPos > 0) {
--this.mPos;
}
return this.mBuffer[this.mPos];
}
public long getPosition() {
return this.mOrigPos + (long)this.mBaseOffset + (long)this.mPos;
}
public void close() throws IOException {
this.mBaseBuf.seek(this.mOrigPos + (long)this.mBaseOffset + (long)this.mPos);
this.mBaseBuf = null;
this.mBuffer = null;
}
public boolean eof() throws IOException {
if (this.mPos < this.mEnd) {
return false;
}
return this.mBaseBuf.eof();
}
public long bytesAvailable() throws IOException {
throw new IOException("Unimplemented method call on CosParseBuf: bytesAvailable");
}
public boolean exists(byte[] key, long extent) throws IOException {
throw new IOException("Unimplemented method call on CosParseBuf: exists");
}
public long indexOf(byte[] key) throws IOException {
throw new IOException("Unimplemented method call on CosParseBuf: indexOf");
}
public long length() throws IOException {
throw new IOException("Unimplemented method call on CosParseBuf: length");
}
public int read(byte[] bytes) throws IOException {
throw new IOException("Unimplemented method call on CosParseBuf: read");
}
public int read(byte[] bytes, int position, int length) throws IOException {
throw new IOException("Unimplemented method call on CosParseBuf: read");
}
public InputByteStream seek(long position) throws IOException {
throw new IOException("Unimplemented method call on CosParseBuf: seek");
}
public InputByteStream slice() throws IOException {
throw new IOException("Unimplemented method call on CosParseBuf: slice");
}
public InputByteStream slice(long begin, long length) throws IOException {
throw new IOException("Unimplemented method call on CosParseBuf: slice");
}
public InputStream toInputStream() throws IOException {
throw new IOException("Unimplemented method call on CosParseBuf: toInputStream");
}
}