Use Java 8 Methods

This commit is contained in:
LOOHP 2021-02-21 14:44:59 +08:00
parent 6013235c73
commit 9fe48fc2a9
2 changed files with 4 additions and 2 deletions

View File

@ -4,7 +4,7 @@
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<groupId>com.loohp</groupId> <groupId>com.loohp</groupId>
<artifactId>Limbo</artifactId> <artifactId>Limbo</artifactId>
<version>0.4.0-ALPHA-SNAPSHOT</version> <version>0.4.0-ALPHA</version>
<build> <build>
<sourceDirectory>src/main/java</sourceDirectory> <sourceDirectory>src/main/java</sourceDirectory>
<resources> <resources>

View File

@ -3,8 +3,10 @@ package com.loohp.limbo.File;
import java.awt.image.BufferedImage; import java.awt.image.BufferedImage;
import java.io.File; import java.io.File;
import java.io.FileInputStream; import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException; import java.io.IOException;
import java.io.InputStreamReader; import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.PrintWriter; import java.io.PrintWriter;
import java.nio.charset.StandardCharsets; import java.nio.charset.StandardCharsets;
import java.util.Map.Entry; import java.util.Map.Entry;
@ -61,7 +63,7 @@ public class ServerProperties {
String value = entry.getValue().toString(); String value = entry.getValue().toString();
prop.putIfAbsent(key, value); prop.putIfAbsent(key, value);
} }
PrintWriter pw = new PrintWriter(file, StandardCharsets.UTF_8); PrintWriter pw = new PrintWriter(new OutputStreamWriter(new FileOutputStream(file), StandardCharsets.UTF_8));
prop.store(pw, COMMENT); prop.store(pw, COMMENT);
pw.close(); pw.close();