buf.append("a3,b3,c3\r");
buf.append("a4,b4,c4");
StringReader reader = new StringReader(buf.toString());
CSVSerializer serializer = new CSVSerializer();
serializer.setKeys("A", "B", "C");
serializer.getCSVSerializerListeners().add(new CSVSerializerListener() {
@Override
public void beginList(CSVSerializer csvSerializer, List<?> list) {
System.out.println("Begin list: " + list);
}
@Override
public void endList(CSVSerializer csvSerializer) {
System.out.println("End list");
}
@Override
public void readItem(CSVSerializer csvSerializer, Object item) {
System.out.println("Read item: " + item);
}
});
List<?> result = serializer.readObject(reader);
Dictionary<String, Object> row;
// Test the first row
row = (Dictionary<String, Object>)result.get(0);