Clean up code & Upgrade syntax to new Java

This commit is contained in:
Đạt Nhân Trương
2022-08-07 01:35:02 +07:00
parent bbdf236a10
commit f983b4dccf
17 changed files with 44 additions and 61 deletions

View File

@@ -4,8 +4,9 @@ import com.esotericsoftware.yamlbeans.YamlReader;
import constants.string.CharsetConstants;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.util.List;
@@ -18,7 +19,7 @@ public class YamlConfig {
private static YamlConfig loadConfig() {
try {
YamlReader reader = new YamlReader(new FileReader(CONFIG_FILE_NAME, CharsetConstants.CHARSET));
YamlReader reader = new YamlReader(Files.newBufferedReader(Paths.get(CONFIG_FILE_NAME), CharsetConstants.CHARSET));
YamlConfig config = reader.read(YamlConfig.class);
reader.close();
return config;