com.univocity.parsers.common.processor
Interface RowProcessor

All Known Implementing Classes:
AbstractRowProcessor, BatchedColumnProcessor, BatchedObjectColumnProcessor, BeanListProcessor, BeanProcessor, ColumnProcessor, ConcurrentRowProcessor, MasterDetailListProcessor, MasterDetailProcessor, ObjectColumnProcessor, ObjectRowListProcessor, ObjectRowProcessor, RowListProcessor

public interface RowProcessor

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[], ParsingContext).

Before parsing the first row, the parser will invoke the processStarted(ParsingContext) 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(ParsingContext) is called so you can perform any additional housekeeping you might need.

More control and information over the parsing process are provided by the ParsingContext object.

uniVocity-parsers provides many useful default implementations of this interface in the package com.univocity.parsers.common.processor, namely:

Author:
uniVocity Software Pty Ltd - parsers@univocity.com
See Also:
AbstractParser, CommonParserSettings, ParsingContext

Method Summary
 void processEnded(ParsingContext context)
          This method will by invoked by the parser once, after the parsing process stopped and all resources were closed.
 void processStarted(ParsingContext context)
          This method will by invoked by the parser once, when it is ready to start processing the input.
 void rowProcessed(String[] row, ParsingContext context)
          Invoked by the parser after all values of a valid record have been processed.
 

Method Detail

processStarted

void processStarted(ParsingContext context)
This method will by invoked by the parser once, when it is ready to start processing the input.

Parameters:
context - A contextual object with information and controls over the current state of the parsing process

rowProcessed

void rowProcessed(String[] row,
                  ParsingContext context)
Invoked by the parser after all values of a valid record have been processed.

Parameters:
row - the data extracted by the parser for an individual record. Note that:
context - A contextual object with information and controls over the current state of the parsing process

processEnded

void processEnded(ParsingContext 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 ParsingContext.stop().

Parameters:
context - A contextual object with information and controls over the state of the parsing process


Copyright © 2015 uniVocity Software Pty Ltd. All rights reserved.