ExtendedDataInputStream.java
1.36 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
/*
* Decompiled with CFR 0_118.
*/
package com.adobe.internal.io;
import java.io.DataInputStream;
import java.io.EOFException;
import java.io.IOException;
import java.io.InputStream;
public class ExtendedDataInputStream
extends DataInputStream {
public ExtendedDataInputStream(InputStream in) {
super(in);
}
public long readUnsignedInt() throws IOException {
long value = 0;
for (int i = 0; i < 4; ++i) {
int b = this.read();
if (b == -1) {
throw new EOFException("Unexpected end of stream.");
}
value = (value << 8) + (long)(b & 255);
}
return value;
}
public int readUnsigned3ByteInt() throws IOException {
int value = 0;
for (int i = 0; i < 3; ++i) {
int b = this.read();
if (b == -1) {
throw new EOFException("Unexpected end of stream.");
}
value = (value << 8) + (b & 255);
}
return value;
}
public void skipFully(long n) throws IOException {
long totalBytesSkipped = 0;
while (n > 0) {
long bytesSkipped = super.skip(n);
if (bytesSkipped == 0) {
throw new EOFException("Unable to skip.");
}
n -= bytesSkipped;
totalBytesSkipped += bytesSkipped;
}
}
}