blob: 6658e2a3c2d59eb91346c71329eccc0ee9298f99 (
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 writeClasses(ClassMatches matches, File file)
throws IOException {
try (FileWriter out = new FileWriter(file)) {
for (ClassMatch match : matches) {
writeClassMatch(out, match);
}
}
}
private static void writeClassMatch(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());
}
}
}
|