net.sf.flatpack.StreamingRecord Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of flatpack Show documentation
Show all versions of flatpack Show documentation
Simple Java delimited and fixed width file parser. Handles CSV, Excel CSV, Tab, Pipe delimiters, just to name a few.
Maps column positions in the file to user friendly names via XML. See FlatPack Feature List under News for complete feature list.
package net.sf.flatpack;
import java.util.Collections;
import java.util.List;
import java.util.Optional;
public class StreamingRecord implements StreamingDataSet {
private final DataSet dataSet;
public StreamingRecord(final DataSet dataSet) {
super();
this.dataSet = dataSet;
}
@Override
public Optional getRecord() {
return dataSet.getRecord();
}
@Override
public boolean next() {
return dataSet != null ? dataSet.next() : false;
}
@Override
public int getErrorCount() {
return dataSet != null ? dataSet.getErrorCount() : 0;
}
@Override
public List getErrors() {
return dataSet != null ? dataSet.getErrors() : Collections.emptyList();
}
}