Processor implementation that stores values of columns.
Values parsed in each row will be split into columns of Strings. Each column has its own list of values.
At the end of the process, the user can access the lists with values parsed for all columns using the methods getColumnValuesAsList(),
getColumnValuesAsMapOfIndexes() and getColumnValuesAsMapOfNames().
Note
Storing the values of all columns may be memory intensive. For large inputs, use a AbstractBatchedColumnProcessor instead
AbstractParser, Processor, ColumnReader
| Modifier and Type | Field and Description |
|---|---|
| private final ColumnSplitter |
| Access | Constructor and Description |
|---|---|
| public | |
| public | AbstractColumnProcessor(int
the expected number of rows to be processed expectedRowCount)Constructs a column processor pre-allocating room for the expected number of rows to be processed |
| Modifier and Type | Method and Description |
|---|---|
| public List | getColumn(String
the name of the column in the input. columnName)Implements com. |
| public List | getColumn(int
the position of the column in the input (0-based). columnIndex)Implements com. |
| public final List | getColumnValuesAsList()
Implements com. |
| public final Map | getColumnValuesAsMapOfIndexes()
Implements com. |
| public final Map | getColumnValuesAsMapOfNames()
Implements com. |
| public final String[] | getHeaders()
Implements com. |
| public void | processEnded(T
A contextual object with information and controls over the state of the parsing process context)Implements com. |
| public void | processStarted(T
A contextual object with information and controls over the current state of the parsing process context)Implements com. |
| public final void | putColumnValuesInMapOfIndexes(Map<Integer, List<String>>
the map to hold the values of each column map)Implements com. |
| public final void | putColumnValuesInMapOfNames(Map<String, List<String>>
the map to hold the values of each column map)Implements com. |
| public void | rowProcessed(String[]
the data extracted by the parser for an individual record. Note that:
row, T
A contextual object with information and controls over the current state of the parsing process context)Implements com. |
| splitter | back to summary |
|---|---|
| private final ColumnSplitter<String> splitter | |
| AbstractColumnProcessor | back to summary |
|---|---|
| public AbstractColumnProcessor() Constructs a column processor, pre-allocating room for 1000 rows. | |
| AbstractColumnProcessor | back to summary |
|---|---|
| public AbstractColumnProcessor(int expectedRowCount) Constructs a column processor pre-allocating room for the expected number of rows to be processed
| |
| getColumn | back to summary |
|---|---|
| public List Implements com. Doc from com. Returns the values of a given column. | |
| getColumn | back to summary |
|---|---|
| public List Implements com. Doc from com. Returns the values of a given column. | |
| getColumnValuesAsList | back to summary |
|---|---|
| public final List Implements com. Doc from com. Returns the values processed for each column | |
| getColumnValuesAsMapOfIndexes | back to summary |
|---|---|
| public final Map Implements com. Doc from com. Returns a map of column indexes and their respective list of values parsed from the input. | |
| getColumnValuesAsMapOfNames | back to summary |
|---|---|
| public final Map Implements com. Doc from com. Returns a map of column names and their respective list of values parsed from the input. | |
| getHeaders | back to summary |
|---|---|
| public final String[] getHeaders() Implements com. Doc from com. Returns the column headers. This can be either the headers defined in | |
| processEnded | back to summary |
|---|---|
| public void processEnded(T context) Implements com. Doc from com. This method will by invoked by the parser once, after the parsing process stopped and all resources were closed. It will always be called by the parser: in case of errors, if the end of the input us reached, or if the user stopped the process manually using
| |
| processStarted | back to summary |
|---|---|
| public void processStarted(T context) Implements com. Doc from com. This method will by invoked by the parser once, when it is ready to start processing the input.
| |
| putColumnValuesInMapOfIndexes | back to summary |
|---|---|
| public final void putColumnValuesInMapOfIndexes(Map<Integer, List<String>> map) Implements com. Doc from com. Fills a given map associating each column index to its list of values | |
| putColumnValuesInMapOfNames | back to summary |
|---|---|
| public final void putColumnValuesInMapOfNames(Map<String, List<String>> map) Implements com. Doc from com. Fills a given map associating each column name to its list o values | |
| rowProcessed | back to summary |
|---|---|
| public void rowProcessed(String[] row, T context) Implements com. Doc from com. Invoked by the parser after all values of a valid record have been processed.
| |