InputStreamImpl.java
1.62 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
/*
* Decompiled with CFR 0_118.
*/
package com.adobe.internal.io.stream;
import com.adobe.internal.io.stream.InputByteStream;
import java.io.IOException;
import java.io.InputStream;
class InputStreamImpl
extends InputStream {
InputByteStream ibs;
protected long mark = 0;
public InputStreamImpl(InputByteStream ibs) {
this.ibs = ibs;
}
@Override
public int available() throws IOException {
return (int)(this.ibs.bytesAvailable() <= Integer.MAX_VALUE ? this.ibs.bytesAvailable() : Integer.MAX_VALUE);
}
@Override
public void mark(int readLimit) {
try {
this.mark = this.ibs.getPosition();
}
catch (IOException e) {
throw new RuntimeException(e);
}
}
@Override
public boolean markSupported() {
return true;
}
@Override
public void reset() throws IOException {
this.ibs.seek(this.mark);
}
@Override
public long skip(long n) throws IOException {
n = Math.min(n, this.ibs.length());
this.ibs.seek(this.ibs.getPosition() + n);
return n;
}
@Override
public void close() throws IOException {
if (this.ibs != null) {
this.ibs.close();
this.ibs = null;
}
}
@Override
public int read() throws IOException {
return this.ibs.read();
}
@Override
public int read(byte[] b, int offset, int length) throws IOException {
return this.ibs.read(b, offset, length);
}
@Override
public int read(byte[] b) throws IOException {
return this.read(b, 0, b.length);
}
}