-
Notifications
You must be signed in to change notification settings - Fork 8
Batch Process
ybonnel edited this page Aug 14, 2012
·
3 revisions
In this page, you will find all informations about the usage of batch process in CsvEngine.
This code will just read the first two lines of the CSV File.
List<Dog> dogs = engine.parseFirstLinesOfInputStream(getCsvFile(), Dog.class, 2).getObjects();
engine.parseFileAndHandleBatch(new InputStreamReader(getCsvFile()), Dog.class, new InsertBatch<Dog>() {
int count = 1;
public void handleBatch(List<Dog> objects) {
System.out.println("Content of batch " + count);
for (Dog dog : objects) {
System.out.println(dog.toString());
}
count++;
}
}, 2);
You can see samples in CsvEngineSample.