Use factory method for creating FileInputStream
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
@@ -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=")) {
|
||||
|
||||
Reference in New Issue
Block a user