-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMapReader.java
executable file
·34 lines (28 loc) · 988 Bytes
/
MapReader.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
import java.io.*;
import java.util.Scanner;
public class MapReader {
static TreeBuilder treeBuilder;
public static void main(String[] args) throws IOException {
if (args.length == 0) {
System.out.println("USAGE: java MapReader <file>.co");
return;
}
try {
treeBuilder = new TreeBuilder(args[0]);
}
catch (IOException e) {
System.out.println ("Couldn't read file.");
return;
}
try {
DataOutputStream out = new DataOutputStream(new BufferedOutputStream(new FileOutputStream(args[0] + ".bin")));
treeBuilder.write(out);
out.flush();
}
catch (FileNotFoundException e) {
System.out.println ("Couldn't write file.");
return;
}
System.out.println ("File successfully processed. You may run MapLoader now.");
}
}