* the input-output exception
*/
public static Map<String, List<Object>> readCSVFileToMap(final FileReader csvFileReader) throws IOException {
CSVUtils.LOG.info(MethodUtils.executionMessage());
Map<String, List<Object>> parsedData = null;
ICsvMapReader csvMapReader = null;
try {
csvMapReader = new CsvMapReader(csvFileReader, CSVFeedConstants.PIPE_DELIMITED);
final String[] headers = csvMapReader.getHeader(BooleanConstants.TRUE.getPrimitiveType());
parsedData = GeneratorUtils.<String, List<Object>>generateDefaultEmptyHashMap();
for (final String header : headers) {
parsedData.put(header, GeneratorUtils.<Object>generateDefaultEmptyArrayList());
}
Map<String, Object> tempParsedData;
while (null != (tempParsedData = csvMapReader.read(headers, CSVFeedConstants.PROCESSORS))) {
for (final Entry<String, Object> entry : tempParsedData.entrySet()) {
parsedData.get(entry.getKey()).add(entry.getValue());
}
}
} finally {
if (null != csvMapReader) {
csvMapReader.close();
}
}
CSVUtils.LOG.info(MethodUtils.successMessage());
CSVUtils.LOG.info(MethodUtils.callbackMessage(parsedData));
return parsedData;