Upgrade to Java NIO
This commit is contained in:
@@ -7,6 +7,8 @@ import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.io.PrintWriter;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.sql.Connection;
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.ResultSet;
|
||||
@@ -27,7 +29,7 @@ import java.util.Map;
|
||||
* drops.
|
||||
*/
|
||||
public class SkillbookChanceFetcher {
|
||||
private static final File OUTPUT_FILE = ToolConstants.getOutputFile("skillbook_drop_data.sql");
|
||||
private static final Path OUTPUT_FILE = ToolConstants.getOutputFile("skillbook_drop_data.sql");
|
||||
private static final Map<Pair<Integer, Integer>, Integer> skillbookChances = new HashMap<>();
|
||||
|
||||
private static PrintWriter printWriter;
|
||||
@@ -102,8 +104,8 @@ public class SkillbookChanceFetcher {
|
||||
}
|
||||
|
||||
private static void generateSkillbookChanceUpdateFile() {
|
||||
try {
|
||||
printWriter = new PrintWriter(OUTPUT_FILE, StandardCharsets.UTF_8);
|
||||
try(PrintWriter pw = new PrintWriter(Files.newOutputStream(OUTPUT_FILE))) {
|
||||
printWriter = pw;
|
||||
|
||||
printSkillbookChanceUpdateSqlHeader();
|
||||
|
||||
@@ -112,7 +114,6 @@ public class SkillbookChanceFetcher {
|
||||
printWriter.println("(" + e.getKey().getLeft() + ", " + e.getKey().getRight() + ", 1, 1, 0, " + e.getValue() + "),");
|
||||
}
|
||||
|
||||
printWriter.close();
|
||||
} catch (IOException ioe) {
|
||||
ioe.printStackTrace();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user