2011. 2. 17.

CVSReader 사용

http://opencsv.sourceforge.net/

BufferedReader br = new BufferedReader(new InputStreamReader(
WcagValidationItem.class.getResourceAsStream("ITEMDESC.csv")));
CSVReader reader = new CSVReader(br, ',');

HeaderColumnNameTranslateMappingStrategy strat = new HeaderColumnNameTranslateMappingStrategy();
strat.setType(ItemDesc.class);
Map columnMappings = new HashMap();
columnMappings.put("IITEMMAPPINGCODE","itemMappingCode");
columnMappings.put("SDESC","desc");
columnMappings.put("SSUBJECT","subject");
strat.setColumnMapping(columnMappings);

CsvToBean csv = new CsvToBean();
List list = csv.parse(strat, reader);

Map itemDescs = new HashMap();

for ( ItemDesc item : list ) {
itemDescs.put(item.getItemMappingCode(), item);
}

return itemDescs;

chart

http://code.google.com/p/clientsidegchart/?redir=1

댓글 없음: