Use factory method for creating FileInputStream

This commit is contained in:
Anosh D. Ullenius
2022-06-17 20:34:58 +02:00
parent 03ed2f52d1
commit 508ef73d85
3 changed files with 6 additions and 4 deletions
@@ -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);
}