add print() and write() to Table and TableRow (fixes #4396)

This commit is contained in:
Ben Fry
2016-05-08 14:31:29 -04:00
parent 6f0b8ce04d
commit 171195426d
4 changed files with 36 additions and 0 deletions

View File

@@ -2590,6 +2590,19 @@ public class Table {
public String[] getColumnTitles() {
return table.getColumnTitles();
}
public void print() {
write(new PrintWriter(System.out));
}
public void write(PrintWriter writer) {
for (int i = 0 ; i < getColumnCount(); i++) {
if (i != 0) {
writer.print('\t');
}
writer.print(getString(i));
}
}
}
@@ -4571,4 +4584,14 @@ public class Table {
public Table copy() {
return new Table(rows());
}
public void write(PrintWriter writer) {
writeTSV(writer);
}
public void print() {
writeTSV(new PrintWriter(System.out));
}
}