Package com.epimorphics.converters
Class CSVDataSource
- java.lang.Object
-
- com.epimorphics.converters.CSVDataSource
-
- All Implemented Interfaces:
RawDataSource,Iterable<Map<String,Object>>,Iterator<Map<String,Object>>
public class CSVDataSource extends Object implements RawDataSource
Reader for CVS files with assumed header row.- Version:
- $Revision: $
- Author:
- Dave Reynolds
-
-
Field Summary
Fields Modifier and Type Field Description protected List<String[]>allrowsprotected au.com.bytecode.opencsv.CSVReadercsvInprotected List<String>headersprotected booleanpreloadprotected String[]rowstatic StringROW_VARNAMEprotected longrowNum-
Fields inherited from interface com.epimorphics.converters.RawDataSource
INDEX, ROW
-
-
Constructor Summary
Constructors Constructor Description CSVDataSource(File file)CSVDataSource(File file, boolean preload)CSVDataSource(Reader reader)CSVDataSource(Reader reader, boolean preload)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description List<String>getFieldNames()Return the set of top level field names in each recordlonggetRowsProcessed()booleanhasNext()Return true if more record values are available.Iterator<Map<String,Object>>iterator()Return itself as an iteratorMap<String,Object>next()Return the next record value.voidremove()longsize()Return the total number of rows in the source or -1 if this information is not available-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
Methods inherited from interface java.util.Iterator
forEachRemaining
-
-
-
-
Field Detail
-
ROW_VARNAME
public static final String ROW_VARNAME
- See Also:
- Constant Field Values
-
csvIn
protected au.com.bytecode.opencsv.CSVReader csvIn
-
row
protected String[] row
-
rowNum
protected long rowNum
-
preload
protected boolean preload
-
-
Constructor Detail
-
CSVDataSource
public CSVDataSource(File file) throws IOException
- Throws:
IOException
-
CSVDataSource
public CSVDataSource(Reader reader) throws IOException
- Throws:
IOException
-
CSVDataSource
public CSVDataSource(File file, boolean preload) throws IOException
- Throws:
IOException
-
CSVDataSource
public CSVDataSource(Reader reader, boolean preload) throws IOException
- Throws:
IOException
-
-
Method Detail
-
getRowsProcessed
public long getRowsProcessed()
-
getFieldNames
public List<String> getFieldNames()
Description copied from interface:RawDataSourceReturn the set of top level field names in each record- Specified by:
getFieldNamesin interfaceRawDataSource
-
hasNext
public boolean hasNext()
Description copied from interface:RawDataSourceReturn true if more record values are available.
-
next
public Map<String,Object> next()
Description copied from interface:RawDataSourceReturn the next record value.
-
iterator
public Iterator<Map<String,Object>> iterator()
Description copied from interface:RawDataSourceReturn itself as an iterator
-
size
public long size()
Description copied from interface:RawDataSourceReturn the total number of rows in the source or -1 if this information is not available- Specified by:
sizein interfaceRawDataSource
-
-