use of org.supercsv.io.ICsvListReader in project apex-malhar by apache.
the class HBaseCsvMappingPutOperator method parseMapping.
public void parseMapping() {
ICsvListReader listReader = null;
StringReader sr = null;
ArrayList<String> csvList = new ArrayList<String>();
try {
sr = new StringReader(mappingString);
listReader = new CsvListReader(sr, CsvPreference.STANDARD_PREFERENCE);
csvList = (ArrayList<String>) listReader.read();
} catch (IOException e) {
logger.error("Cannot read the mapping string", e);
DTThrowable.rethrow(e);
} finally {
try {
sr.close();
listReader.close();
} catch (IOException e) {
logger.error("Error closing Csv reader", e);
DTThrowable.rethrow(e);
}
}
for (int index = 0; index < csvList.size(); index++) {
String value = csvList.get(index);
if (value.equals("row")) {
rowIndex = index;
} else {
ColDef c = new ColDef();
c.colFam = value.substring(0, value.indexOf('.'));
c.colName = value.substring(value.indexOf('.') + 1);
colMap.put(index, c);
}
}
}
use of org.supercsv.io.ICsvListReader in project voltdb by VoltDB.
the class CSVLoader method main.
/**
* csvloader main. (main is directly used by tests as well be sure to reset statics that you need to start over)
*
* @param args
* @throws IOException
* @throws InterruptedException
*
*/
public static void main(String[] args) throws IOException, InterruptedException {
start = System.currentTimeMillis();
long insertTimeStart = start;
long insertTimeEnd;
final CSVConfig cfg = new CSVConfig();
cfg.parse(CSVLoader.class.getName(), args);
config = cfg;
if (config.noquotechar) {
config.quotechar = '