summaryrefslogtreecommitdiffstats
path: root/src/org/jetbrains/java/decompiler/util/InterpreterUtil.java
diff options
context:
space:
mode:
authorRoman Shevchenko <roman.shevchenko@jetbrains.com>2014-08-29 14:31:45 +0400
committerRoman Shevchenko <roman.shevchenko@jetbrains.com>2014-08-29 14:57:29 +0400
commit84ea54eb1e2c68091080951a3024cca98f70aca2 (patch)
tree323218d81ced0fd327fa3701ec9f7f1e407855f8 /src/org/jetbrains/java/decompiler/util/InterpreterUtil.java
parent076e4393f25bf1ad1ff1bd2853153e2b595dd90b (diff)
downloadfernflower-84ea54eb1e2c68091080951a3024cca98f70aca2.tar
fernflower-84ea54eb1e2c68091080951a3024cca98f70aca2.tar.gz
fernflower-84ea54eb1e2c68091080951a3024cca98f70aca2.tar.lz
fernflower-84ea54eb1e2c68091080951a3024cca98f70aca2.tar.xz
fernflower-84ea54eb1e2c68091080951a3024cca98f70aca2.zip
java-decompiler: post-import cleanup (code style issues)
Diffstat (limited to 'src/org/jetbrains/java/decompiler/util/InterpreterUtil.java')
-rw-r--r--src/org/jetbrains/java/decompiler/util/InterpreterUtil.java41
1 files changed, 19 insertions, 22 deletions
diff --git a/src/org/jetbrains/java/decompiler/util/InterpreterUtil.java b/src/org/jetbrains/java/decompiler/util/InterpreterUtil.java
index f429636..a1da87b 100644
--- a/src/org/jetbrains/java/decompiler/util/InterpreterUtil.java
+++ b/src/org/jetbrains/java/decompiler/util/InterpreterUtil.java
@@ -27,27 +27,26 @@ import java.util.List;
public class InterpreterUtil {
public static void copyFile(File in, File out) throws IOException {
- FileChannel inChannel = new FileInputStream(in).getChannel();
- FileChannel outChannel = new FileOutputStream(out).getChannel();
+ FileInputStream inStream = new FileInputStream(in);
try {
- // magic number for Windows, 64Mb - 32Kb)
- int maxCount = (64 * 1024 * 1024) - (32 * 1024);
- long size = inChannel.size();
- long position = 0;
- while (position < size) {
- position += inChannel.transferTo(position, maxCount, outChannel);
+ FileOutputStream outStream = new FileOutputStream(out);
+ try {
+ FileChannel inChannel = inStream.getChannel();
+ FileChannel outChannel = outStream.getChannel();
+ // magic number for Windows, 64Mb - 32Kb)
+ int maxCount = (64 * 1024 * 1024) - (32 * 1024);
+ long size = inChannel.size();
+ long position = 0;
+ while (position < size) {
+ position += inChannel.transferTo(position, maxCount, outChannel);
+ }
+ }
+ finally {
+ outStream.close();
}
- }
- catch (IOException e) {
- throw e;
}
finally {
- if (inChannel != null) {
- inChannel.close();
- }
- if (outChannel != null) {
- outChannel.close();
- }
+ inStream.close();
}
}
@@ -74,12 +73,10 @@ public class InterpreterUtil {
public static boolean equalSets(Collection<?> c1, Collection<?> c2) {
if (c1 == null) {
- return c2 == null ? true : false;
+ return c2 == null;
}
- else {
- if (c2 == null) {
- return false;
- }
+ else if (c2 == null) {
+ return false;
}
if (c1.size() != c2.size()) {