|
@@ -16,8 +16,8 @@ public class HamletParser {
|
16
|
16
|
hamletData = loadFile();
|
17
|
17
|
}
|
18
|
18
|
|
19
|
|
- private static String loadFile(){
|
20
|
|
- ClassLoader classLoader = HamletParser.class.getClassLoader();
|
|
19
|
+ public String loadFile(){
|
|
20
|
+ ClassLoader classLoader = getClass().getClassLoader();
|
21
|
21
|
File file = new File(classLoader.getResource("hamlet.txt").getFile());
|
22
|
22
|
StringBuilder result = new StringBuilder("");
|
23
|
23
|
try(Scanner scanner = new Scanner(file)){
|
|
@@ -54,7 +54,7 @@ public class HamletParser {
|
54
|
54
|
return matcher.appendTail(sb).toString();
|
55
|
55
|
}
|
56
|
56
|
|
57
|
|
- private static void changeEverythingAndPutInFile() throws IOException {
|
|
57
|
+ private void changeEverythingAndPutInFile() throws IOException {
|
58
|
58
|
String fixedFile = changeHamletToLeon(changeHoratioToTariq(hamletData));
|
59
|
59
|
FileWriter fileWriter = new FileWriter("src/main/resources/zipcodeHamlet.txt", true);
|
60
|
60
|
fileWriter.write(fixedFile);
|
|
@@ -62,7 +62,8 @@ public class HamletParser {
|
62
|
62
|
}
|
63
|
63
|
|
64
|
64
|
public static void main(String[] args) throws IOException {
|
65
|
|
- changeEverythingAndPutInFile();
|
|
65
|
+ HamletParser h = new HamletParser();
|
|
66
|
+ h.changeEverythingAndPutInFile();
|
66
|
67
|
}
|
67
|
68
|
|
68
|
69
|
}
|