blob: 49ffb6d791ac0e2db3d7ebe7ce0696af6f4fc82a (
plain) (
blame)
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
35
36
37
38
39
40
41
|
package cuchaz.enigma.convert;
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
import cuchaz.enigma.mapping.ClassEntry;
public class MatchesWriter {
public static void write(Matches matches, File file)
throws IOException {
try (FileWriter out = new FileWriter(file)) {
for (ClassMatch match : matches) {
writeMatch(out, match);
}
}
}
private static void writeMatch(FileWriter out, ClassMatch match)
throws IOException {
writeClasses(out, match.sourceClasses);
out.write(":");
writeClasses(out, match.destClasses);
out.write("\n");
}
private static void writeClasses(FileWriter out, Iterable<ClassEntry> classes)
throws IOException {
boolean isFirst = true;
for (ClassEntry entry : classes) {
if (isFirst) {
isFirst = false;
} else {
out.write(",");
}
out.write(entry.toString());
}
}
}
|