Class410.parseAwfulCSV(BufferedReader reader,boolean header)#0{
if (ch == '\"') {
insideQuote = true;
} else if (ch == '\r' || ch == '\n') {
if (ch == '\r') {
// check to see if next is a '\n'
reader.mark(1);
if (reader.read() != '\n') {
reader.reset();
}
}
setString(row, col, new String(c, 0, count));
count = 0;
if (row == 0 && header) {
// Use internal row removal (efficient because only one row).
removeTitleRow();
// Un-set the header variable so that next time around, we don't
// just get stuck into a loop, removing the 0th row repeatedly.
header = false;
}
row++;
col = 0;
} else if (ch == ',') {
setString(row, col, new String(c, 0, count));
count = 0;
// starting a new column, make sure we have room
col++;
ensureColumn(col);
} else { // just a regular character, add it
if (count == c.length) {
c = PApplet.expand(c);
}
c[count++] = (char) ch;
}
}
|