Top Description Methods
com.univocity.parsers.common.processor.core

public Interface Processor<T extends Context>

Known Direct Subinterfaces
com.univocity.parsers.common.processor.RowProcessor
Known Direct Implementers
com.univocity.parsers.common.processor.core.AbstractBatchedColumnProcessor, com.univocity.parsers.common.processor.core.AbstractBatchedObjectColumnProcessor, com.univocity.parsers.common.processor.core.AbstractBeanProcessor, com.univocity.parsers.common.processor.core.AbstractColumnProcessor, com.univocity.parsers.common.processor.core.AbstractConcurrentProcessor, com.univocity.parsers.common.processor.core.AbstractListProcessor, com.univocity.parsers.common.processor.core.AbstractMultiBeanProcessor, com.univocity.parsers.common.processor.core.AbstractObjectProcessor, com.univocity.parsers.common.processor.core.AbstractProcessor, com.univocity.parsers.common.processor.core.AbstractProcessorSwitch, com.univocity.parsers.common.processor.core.CompositeProcessor
Imports
com.univocity.parsers.common.*, com.univocity.parsers.common.processor.*, com.univocity.parsers.conversions.*

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 Processor#rowProcessed(String[], Context).

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

More control and information over the parsing process are provided by the Context 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 - [email protected]
See Also
AbstractParser, CommonParserSettings, ParsingContext, Context

Method Summary

Modifier and TypeMethod and Description
public void
processEnded(T
A contextual object with information and controls over the state of the parsing process
context
)

This method will by invoked by the parser once, after the parsing process stopped and all resources were closed.

public void
processStarted(T
A contextual object with information and controls over the current state of the parsing process
context
)

This method will by invoked by the parser once, when it is ready to start processing the input.

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
)

Invoked by the parser after all values of a valid record have been processed.

Method Detail

processEndedback to summary
public void processEnded(T 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:T

A contextual object with information and controls over the state of the parsing process

processStartedback to summary
public void processStarted(T context)

This method will by invoked by the parser once, when it is ready to start processing the input.

Parameters
context:T

A contextual object with information and controls over the current state of the parsing process

rowProcessedback to summary
public void rowProcessed(String[] row, T context)

Invoked by the parser after all values of a valid record have been processed.

Parameters
row:String[]

the data extracted by the parser for an individual record. Note that:

context:T

A contextual object with information and controls over the current state of the parsing process