summaryrefslogtreecommitdiffstats
path: root/src/org/jetbrains/java/decompiler/util/DataInputFullStream.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/org/jetbrains/java/decompiler/util/DataInputFullStream.java')
-rw-r--r--src/org/jetbrains/java/decompiler/util/DataInputFullStream.java17
1 files changed, 11 insertions, 6 deletions
diff --git a/src/org/jetbrains/java/decompiler/util/DataInputFullStream.java b/src/org/jetbrains/java/decompiler/util/DataInputFullStream.java
index 0ed20dc..79e8c1d 100644
--- a/src/org/jetbrains/java/decompiler/util/DataInputFullStream.java
+++ b/src/org/jetbrains/java/decompiler/util/DataInputFullStream.java
@@ -25,20 +25,19 @@ public class DataInputFullStream extends DataInputStream {
super(in);
}
- public final int readFull(byte[] b) throws IOException {
-
+ public int readFull(byte[] b) throws IOException {
int length = b.length;
- byte[] btemp = new byte[length];
+ byte[] temp = new byte[length];
int pos = 0;
- int bytes_read = -1;
+ int bytes_read;
while (true) {
- bytes_read = read(btemp, 0, length - pos);
+ bytes_read = read(temp, 0, length - pos);
if (bytes_read == -1) {
return -1;
}
- System.arraycopy(btemp, 0, b, pos, bytes_read);
+ System.arraycopy(temp, 0, b, pos, bytes_read);
pos += bytes_read;
if (pos == length) {
break;
@@ -47,4 +46,10 @@ public class DataInputFullStream extends DataInputStream {
return length;
}
+
+ public void discard(int n) throws IOException {
+ if (super.skip(n) != n) {
+ throw new IOException("Skip failed");
+ }
+ }
}