summaryrefslogtreecommitdiffstats
path: root/src/org/jetbrains/java/decompiler/util
diff options
context:
space:
mode:
authorRoman Shevchenko <roman.shevchenko@jetbrains.com>2014-09-02 20:56:03 +0400
committerRoman Shevchenko <roman.shevchenko@jetbrains.com>2014-09-03 11:39:32 +0400
commit2df49d32a71818227e80a8628688906f2ede8a6a (patch)
treedced5f5ebf2f860d5683abf6910f180a67f9471d /src/org/jetbrains/java/decompiler/util
parentc0c83126a69a0c652f343e972f727ffd7f5f10af (diff)
downloadfernflower-2df49d32a71818227e80a8628688906f2ede8a6a.tar
fernflower-2df49d32a71818227e80a8628688906f2ede8a6a.tar.gz
fernflower-2df49d32a71818227e80a8628688906f2ede8a6a.tar.lz
fernflower-2df49d32a71818227e80a8628688906f2ede8a6a.tar.xz
fernflower-2df49d32a71818227e80a8628688906f2ede8a6a.zip
java-decompiler: fixes and cleanups
- unified attribute loading code - common methods for checking member flags - verifying skip() - correct resource closing - typos
Diffstat (limited to 'src/org/jetbrains/java/decompiler/util')
-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");
+ }
+ }
}