コード例 #1
0
ファイル: CSVInput.java プロジェクト: augiwan/loader
 private void initializeCSVReader(FunctionContext context) throws IOException {
   this.csvReader = new CSVReader(new FileReader(context.getParameterAsString(IP_CSV_FILE)));
   this.headers = csvReader.readNext();
   if (headers == null) {
     throw new RuntimeException("no data found in input csv file");
   }
 }
コード例 #2
0
ファイル: CSVInput.java プロジェクト: augiwan/loader
 @Override
 public void execute(FunctionContext context) throws Exception {
   String[] csvParameters = this.csvReader.readNext();
   if (csvParameters == null) {
     csvReader.close();
     initializeCSVReader(context);
     csvParameters = this.csvReader.readNext();
   }
   if (csvParameters != null) {
     for (int headerI = 0; headerI < headers.length; headerI++) {
       context.addParameter(headers[headerI], csvParameters[headerI]);
     }
   }
 }