Upgrade to Java NIO
This commit is contained in:
@@ -5,6 +5,8 @@ import provider.wz.WZFiles;
|
||||
|
||||
import java.io.*;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
@@ -16,7 +18,7 @@ import java.util.List;
|
||||
* the "info" node in their WZ node tree.
|
||||
*/
|
||||
public class MapInfoRetriever {
|
||||
private static final File OUTPUT_FILE = ToolConstants.getOutputFile("map_info_report.txt");
|
||||
private static final Path OUTPUT_FILE = ToolConstants.getOutputFile("map_info_report.txt");
|
||||
private static final List<Integer> missingInfo = new ArrayList<>();
|
||||
|
||||
private static BufferedReader bufferedReader = null;
|
||||
@@ -129,18 +131,14 @@ public class MapInfoRetriever {
|
||||
}
|
||||
|
||||
private static void writeReport() {
|
||||
try {
|
||||
PrintWriter printWriter = new PrintWriter(OUTPUT_FILE, StandardCharsets.UTF_8);
|
||||
|
||||
if (!missingInfo.isEmpty()) {
|
||||
try(PrintWriter printWriter = new PrintWriter(Files.newOutputStream(OUTPUT_FILE))) {
|
||||
if (!missingInfo.isEmpty()) {
|
||||
for (Integer i : missingInfo) {
|
||||
printWriter.println(i);
|
||||
}
|
||||
} else {
|
||||
printWriter.println("All map files contain 'info' node.");
|
||||
}
|
||||
|
||||
printWriter.close();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user