前回の CsvLineWriteProcessor を使ってみると。。。
final List<String> datas = new ArrayList<String>();
datas.add(new String{"uran" , "Hellow \"\" 2quot! " ,"Aaaa123"});
datas.add(new String{"beth" , "" , "BB , CC"});
datas.add(new String{"ann" , " ,," , "テストDD"});
CsvOutStreamProcessor cp = new CsvOutStreamProcessor("UTF-8");
int line = cp.processStream("c:/work/a.csv",new CsvLineWriteProcessor(){
boolean b=true;
@Override
public List<String> headerLine(){
return new ArrayList<String>(Arrays.asList(new String{"Name","Message","Etc"}));
}
@Override
public List<String> dataLine(int count){
if (datas.size()==count) this.b = false;
return Arrays.asList(datas.get(count - 1));
}
@Override
public boolean continueProcessing(){
return this.b;
}
});