MCPcopy Index your code
hub / github.com/benfry/processing4 / writeCSV

Method writeCSV

core/src/processing/data/Table.java:1279–1313  ·  view source on GitHub ↗
(PrintWriter writer)

Source from the content-addressed store, hash-verified

1277
1278
1279 protected void writeCSV(PrintWriter writer) {
1280 if (columnTitles != null) {
1281 for (int col = 0; col < getColumnCount(); col++) {
1282 if (col != 0) {
1283 writer.print(',');
1284 }
1285 try {
1286 if (columnTitles[col] != null) { // col < columnTitles.length &&
1287 writeEntryCSV(writer, columnTitles[col]);
1288 }
1289 } catch (ArrayIndexOutOfBoundsException e) {
1290 PApplet.printArray(columnTitles);
1291 PApplet.printArray(columns);
1292 throw e;
1293 }
1294 }
1295 writer.println();
1296 }
1297 for (int row = 0; row < rowCount; row++) {
1298 for (int col = 0; col < getColumnCount(); col++) {
1299 if (col != 0) {
1300 writer.print(',');
1301 }
1302 String entry = getString(row, col);
1303 // just write null entries as blanks, rather than spewing 'null'
1304 // all over the spreadsheet file.
1305 if (entry != null) {
1306 writeEntryCSV(writer, entry);
1307 }
1308 }
1309 // Prints the newline for the row, even if it's missing
1310 writer.println();
1311 }
1312 writer.flush();
1313 }
1314
1315
1316 protected void writeEntryCSV(PrintWriter writer, String entry) {

Callers 1

saveMethod · 0.95

Calls 7

getColumnCountMethod · 0.95
writeEntryCSVMethod · 0.95
printArrayMethod · 0.95
getStringMethod · 0.95
printMethod · 0.65
printlnMethod · 0.45
flushMethod · 0.45

Tested by

no test coverage detected