add save() methods and implement write() consistently in the List and Dict classes

This commit is contained in:
Ben Fry
2018-04-24 18:25:35 -04:00
parent 36607cf2d2
commit 15e67c206e
11 changed files with 170 additions and 6 deletions

View File

@@ -571,8 +571,17 @@ public class StringDict {
/**
* Write tab-delimited entries out to
* @param writer
* Save tab-delimited entries to a file (TSV format, UTF-8 encoding)
*/
public void save(File file) {
PrintWriter writer = PApplet.createWriter(file);
write(writer);
writer.close();
}
/**
* Write tab-delimited entries to a PrintWriter
*/
public void write(PrintWriter writer) {
for (int i = 0; i < count; i++) {