use loadStrings() instead of custom BufferedReader

This commit is contained in:
Ben Fry
2022-01-18 17:21:54 -05:00
parent 6108ac4f52
commit cdabecebb3

View File

@@ -138,9 +138,8 @@ public abstract class Mode {
@SuppressWarnings("SameParameterValue")
protected void loadKeywords(File keywordFile,
String commentPrefix) throws IOException {
BufferedReader reader = PApplet.createReader(keywordFile);
String line;
while ((line = reader.readLine()) != null) {
String[] lines = PApplet.loadStrings(keywordFile);
for (String line : lines) {
if (!line.trim().startsWith(commentPrefix)) {
// Was difficult to make sure that mode authors were properly doing
// tab-separated values. By definition, there can't be additional
@@ -173,7 +172,6 @@ public abstract class Mode {
}
}
}
reader.close();
}