use of uk.ac.bris.cs.rfideasalreadytaken.lumberjack.exceptions.FileUploadException in project lumberjack by fn-ctional.
the class WebBackend method multipartFileToRecords.
private Iterable<CSVRecord> multipartFileToRecords(MultipartFile csv) throws FileUploadException {
try {
File file = new File(csv.getOriginalFilename());
csv.transferTo(file);
Reader in = new FileReader(file);
Iterable<CSVRecord> records = CSVFormat.DEFAULT.withHeader(HEADERS).withFirstRecordAsHeader().parse(in);
return records;
} catch (IOException e) {
throw new FileUploadException();
}
}
Aggregations