MCPcopy Index your code
hub / github.com/processing/processing / writeCSV

Method writeCSV

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

Source from the content-addressed store, hash-verified

1257
1258
1259 protected void writeCSV(PrintWriter writer) {
1260 if (columnTitles != null) {
1261 for (int col = 0; col < getColumnCount(); col++) {
1262 if (col != 0) {
1263 writer.print(',');
1264 }
1265 try {
1266 if (columnTitles[col] != null) { // col < columnTitles.length &&
1267 writeEntryCSV(writer, columnTitles[col]);
1268 }
1269 } catch (ArrayIndexOutOfBoundsException e) {
1270 PApplet.printArray(columnTitles);
1271 PApplet.printArray(columns);
1272 throw e;
1273 }
1274 }
1275 writer.println();
1276 }
1277 for (int row = 0; row < rowCount; row++) {
1278 for (int col = 0; col < getColumnCount(); col++) {
1279 if (col != 0) {
1280 writer.print(',');
1281 }
1282 String entry = getString(row, col);
1283 // just write null entries as blanks, rather than spewing 'null'
1284 // all over the spreadsheet file.
1285 if (entry != null) {
1286 writeEntryCSV(writer, entry);
1287 }
1288 }
1289 // Prints the newline for the row, even if it's missing
1290 writer.println();
1291 }
1292 writer.flush();
1293 }
1294
1295
1296 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