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

public Interface RowWriterProcessor<T>

Known Direct Implementers
com.univocity.parsers.common.processor.RowWriterProcessorSwitch, com.univocity.parsers.common.processor.BeanWriterProcessor, com.univocity.parsers.common.processor.ObjectRowWriterProcessor
Type Parameters
<T>
the type that is converted by this implementation into an Object array, suitable for writing to the output.
Imports
com.univocity.parsers.common.*, com.univocity.parsers.conversions.*, com.univocity.parsers.csv.*, com.univocity.parsers.fixed.*

The essential callback interface to convert input objects into a manageable format for writing. Used by any writer that extends AbstractWriter.

When writing to an output, the writer will obtain the RowWriterProcessor from CommonWriterSettings#getRowWriterProcessor(), and invoke RowWriterProcessor#write(Object, NormalizedString[], int[]) to convert the input to an array of objects. This array of objects will in turn be handed to the writer to produce a record in the expected format.

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

Author
Univocity Software Pty Ltd - [email protected]
See Also
com.univocity.parsers.common.AbstractWriter, com.univocity.parsers.common.CommonWriterSettings

Method Summary

Modifier and TypeMethod and Description
public Object[]

Returns:

an Object array that is suitable for writing. If null or an empty array is returned then the writer might either skip this value or write an empty record (if CommonSettings#getSkipEmptyLines() is false)
write
(T
The original input record that must be converted into an Object array before writing to an output.
input
,
NormalizedString[]
All field names used to produce records in a given destination. May be null if no headers have been defined in CommonSettings#getHeaders()
headers
,
int[]
The indexes of the headers that are actually being written. May be null if no fields have been selected using CommonSettings#selectFields(String...) or CommonSettings#selectIndexes(Integer...)
indexesToWrite
)

Converts the given input into an Object array that is suitable for writing.

Method Detail

writeback to summary
public Object[] write(T input, NormalizedString[] headers, int[] indexesToWrite)

Converts the given input into an Object array that is suitable for writing. Used by format-specific writers that extend AbstractWriter.

Parameters
input:T

The original input record that must be converted into an Object array before writing to an output.

headers:NormalizedString[]

All field names used to produce records in a given destination. May be null if no headers have been defined in CommonSettings#getHeaders()

indexesToWrite:int[]

The indexes of the headers that are actually being written. May be null if no fields have been selected using CommonSettings#selectFields(String...) or CommonSettings#selectIndexes(Integer...)

Returns:Object[]

an Object array that is suitable for writing. If null or an empty array is returned then the writer might either skip this value or write an empty record (if CommonSettings#getSkipEmptyLines() is false)

See Also
CsvWriter, FixedWidthWriter, CommonSettings, AbstractWriter