From 7f9e18399248849cf6a2d68df492a4045e84f40b Mon Sep 17 00:00:00 2001 From: Nico Mexis Date: Mon, 15 Jul 2024 16:27:09 +0200 Subject: [PATCH] Nicer code --- .../com/googlecode/dex2jar/tools/ClassVersionSwitch.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/dex-tools/src/main/java/com/googlecode/dex2jar/tools/ClassVersionSwitch.java b/dex-tools/src/main/java/com/googlecode/dex2jar/tools/ClassVersionSwitch.java index 7652c721..5e6c35ca 100644 --- a/dex-tools/src/main/java/com/googlecode/dex2jar/tools/ClassVersionSwitch.java +++ b/dex-tools/src/main/java/com/googlecode/dex2jar/tools/ClassVersionSwitch.java @@ -2,9 +2,9 @@ import java.io.File; -import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; +import java.nio.file.Files; import java.util.Enumeration; import java.util.zip.ZipEntry; import java.util.zip.ZipFile; @@ -26,13 +26,14 @@ public static void main(String... args) throws IOException { } int version = Integer.parseInt(args[0]); if (version < 1 || version >= Constants.JAVA_VERSIONS.length) { - throw new RuntimeException("version not support yet!"); + throw new RuntimeException("version not supported yet!"); } File old = new File(args[1]); File n = new File(args[2]); byte[] buff = new byte[1024 * 50]; final int jVersion = Constants.JAVA_VERSIONS[version]; - try (ZipFile zip = new ZipFile(old); ZipOutputStream zos = new ZipOutputStream(new FileOutputStream(n))) { + try (ZipFile zip = new ZipFile(old); ZipOutputStream zos = + new ZipOutputStream(Files.newOutputStream(n.toPath()))) { Enumeration e = zip.entries(); while (e.hasMoreElements()) {