public interface RowProcessor extends com.univocity.parsers.common.processor.core.Processor<HtmlParsingContext>
The essential callback interface to handle records parsed by any parser that extends AbstractParser.
When parsing an input, uniVocity-parsers will obtain the RowProcessor from CommonParserSettings.getRowProcessor(), and delegate each parsed row to rowProcessed(String[], HtmlParsingContext).
Before parsing the first row, the parser will invoke the processStarted(HtmlParsingContext) method. By this time the input buffer will be already loaded and ready to be consumed.
After parsing the last row, all resources are closed and the processing stops. Only after the processEnded(HtmlParsingContext) is called so you can perform any additional housekeeping you might need.
More control and information over the parsing process are provided by the HtmlParsingContext object.
uniVocity-parsers provides many useful default implementations of this interface in the package com.univocity.parsers.common.processor, namely:
RowListProcessor: convenience class for storing the processed rows into a list.ObjectRowProcessor: used for processing rows and executing conversions of parsed values to objects using instances of ConversionObjectRowListProcessor: convenience class for rows of converted objects using ObjectRowProcessor into a list.MasterDetailProcessor: used for reading inputs where records are organized in a master-detail fashion (with a master element that contains a list of associated elements) MasterDetailListProcessor: convenience class for storing MasterDetailRecord created by instances created by MasterDetailProcessor into a list BeanProcessor: used for automatically create and populate javabeans annotated with the annotations provided in package com.univocity.parsers.annotationsBeanListProcessor: convenience class for storing all javabeans created by BeanProcessor into a listHtmlParser,
HtmlEntitySettings,
HtmlParsingContext| Modifier and Type | Method and Description |
|---|---|
void |
processEnded(HtmlParsingContext context)
This method will by invoked by the parser once, after the parsing process stopped and all resources were closed.
|
void |
processStarted(HtmlParsingContext context)
This method will by invoked by the parser once, when it is ready to start processing the input.
|
void |
rowProcessed(String[] row,
HtmlParsingContext context)
Invoked by the parser after all values of a valid record have been processed.
|
void processStarted(HtmlParsingContext context)
This method will by invoked by the parser once, when it is ready to start processing the input.
processStarted in interface com.univocity.parsers.common.processor.core.Processor<HtmlParsingContext>context - A contextual object with information and controls over the current state of the parsing processvoid rowProcessed(String[] row, HtmlParsingContext context)
Invoked by the parser after all values of a valid record have been processed.
rowProcessed in interface com.univocity.parsers.common.processor.core.Processor<HtmlParsingContext>row - the data extracted by the parser for an individual record of a given entity. It will never by null.context - A contextual object with information and controls over the current state of the parsing processvoid processEnded(HtmlParsingContext context)
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 Context.stop().
processEnded in interface com.univocity.parsers.common.processor.core.Processor<HtmlParsingContext>context - A contextual object with information and controls over the state of the parsing processCopyright © 2018 uniVocity Software Pty Ltd. All rights reserved.