diff --git a/core/src/main/java/com/threerings/getdown/util/LaunchUtil.java b/core/src/main/java/com/threerings/getdown/util/LaunchUtil.java index 1fa15ee..4ec94fe 100644 --- a/core/src/main/java/com/threerings/getdown/util/LaunchUtil.java +++ b/core/src/main/java/com/threerings/getdown/util/LaunchUtil.java @@ -9,6 +9,7 @@ import java.io.File; import java.io.FileOutputStream; import java.io.IOException; import java.io.PrintStream; +import java.nio.file.Files; import java.util.Locale; import static com.threerings.getdown.Log.log; @@ -52,7 +53,7 @@ public final class LaunchUtil { // create the file that instructs Getdown to upgrade File vfile = new File(appdir, "version.txt"); - try (PrintStream ps = new PrintStream(new FileOutputStream(vfile))) { + try (PrintStream ps = new PrintStream(Files.newOutputStream(vfile.toPath()))) { ps.println(newVersion); } diff --git a/core/src/main/java/com/threerings/getdown/util/VersionUtil.java b/core/src/main/java/com/threerings/getdown/util/VersionUtil.java index 7bdcb76..b99ab03 100644 --- a/core/src/main/java/com/threerings/getdown/util/VersionUtil.java +++ b/core/src/main/java/com/threerings/getdown/util/VersionUtil.java @@ -32,7 +32,7 @@ public final class VersionUtil { long fileVersion = -1; try (BufferedReader bin = - new BufferedReader(new InputStreamReader(new FileInputStream(vfile), UTF_8))) { + new BufferedReader(new InputStreamReader(Files.newInputStream(vfile.toPath()), UTF_8))) { String vstr = bin.readLine(); if (!StringUtil.isBlank(vstr)) { fileVersion = Long.parseLong(vstr); @@ -81,7 +81,7 @@ public final class VersionUtil public static long readReleaseVersion (File relfile, String versRegex) { try (BufferedReader in = - new BufferedReader(new InputStreamReader(new FileInputStream(relfile), UTF_8))) { + new BufferedReader(new InputStreamReader(Files.newInputStream(relfile.toPath()), UTF_8))) { String line = null, relvers = null; while ((line = in.readLine()) != null) { if (line.startsWith("JAVA_VERSION=")) { diff --git a/launcher/src/main/java/com/threerings/getdown/launcher/ProxyUtil.java b/launcher/src/main/java/com/threerings/getdown/launcher/ProxyUtil.java index 7d7c1f5..7b69cba 100644 --- a/launcher/src/main/java/com/threerings/getdown/launcher/ProxyUtil.java +++ b/launcher/src/main/java/com/threerings/getdown/launcher/ProxyUtil.java @@ -20,6 +20,7 @@ import java.net.Proxy; import java.net.URL; import java.net.URLConnection; import java.net.UnknownHostException; +import java.nio.file.Files; import java.util.Iterator; import java.util.ServiceLoader; @@ -188,7 +189,7 @@ public final class ProxyUtil { public static void saveProxy (Application app, String host, String port) { File pfile = app.getLocalPath("proxy.txt"); - try (PrintStream pout = new PrintStream(new FileOutputStream(pfile))) { + try (PrintStream pout = new PrintStream(Files.newOutputStream(pfile.toPath()))) { if (!StringUtil.isBlank(host)) { pout.println("host = " + host); }