public abstract class AbstractCsvLineResourceBuilder extends Object implements IResourceBuilder
This class deals with the CSV streaming part and invoke the
IResourceTuple.addKeyValue(String, Tuple)
method for each read value.
s * @author dimi
IResourceBuilder.CompactionType
Modifier and Type | Field and Description |
---|---|
protected List<String> |
columns |
protected CsvOperator |
csvOperator |
Constructor and Description |
---|
AbstractCsvLineResourceBuilder(List<String> columns,
String delimiter,
boolean inferTypes,
boolean hasHeader)
Ctor.
|
Modifier and Type | Method and Description |
---|---|
void |
onStart()
Callback to tell you you are about to receive new lines.
|
void |
onStream(Reader reader)
Callback for you to stream the remote resource file.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
onEnd, prepare
protected CsvOperator csvOperator
public AbstractCsvLineResourceBuilder(List<String> columns, String delimiter, boolean inferTypes, boolean hasHeader)
columns
- the expected csv columnsdelimiter
- the csv delimiterinferTypes
- true to make the inner tuple typed.hashKey
- not null to declare the key to be used to build the hash tablelowerCase
- true if keys must be converted to loewr caseshasHeader
- true if the csv file has a header with column declaredcompact
- true to leverage compact tuplespublic void onStart()
IResourceBuilder
onStart
in interface IResourceBuilder
public void onStream(Reader reader) throws IOException
IResourceBuilder
onStream
in interface IResourceBuilder
reader
- the input stream to consume the resource fileIOException
- in case of IO errorCopyright © 2023. All rights reserved.