Top Description Fields Constructors Methods
com.univocity.parsers.common

public abstract Class AbstractWriter<S extends CommonWriterSettings<?>>

extends Object
Class Inheritance
Known Direct Subclasses
com.univocity.parsers.csv.CsvWriter, com.univocity.parsers.fixed.FixedWidthWriter, com.univocity.parsers.tsv.TsvWriter
Type Parameters
<S>
The specific writer settings configuration class, which can potentially provide additional configuration options supported by the writer implementation.
Imports
com.univocity.parsers.common.fields.*, com.univocity.parsers.common.input.*, com.univocity.parsers.common.processor.*, com.univocity.parsers.common.record.*, com.univocity.parsers.fixed.*, java.io.*, java.nio.charset.*, java.util.*

The AbstractWriter class provides a common ground for all writers in univocity-parsers. It handles all settings defined by CommonWriterSettings, and delegates the writing algorithm implementation to its subclasses through the abstract method AbstractWriter#processRow(Object[]) The following (absolutely required) attributes are exposed to subclasses:
Author
Univocity Software Pty Ltd - [email protected]
See Also
com.univocity.parsers.csv.CsvWriter, com.univocity.parsers.csv.CsvWriterSettings, com.univocity.parsers.fixed.FixedWidthWriter, com.univocity.parsers.fixed.FixedWidthWriterSettings, com.univocity.parsers.tsv.TsvWriter, com.univocity.parsers.tsv.TsvWriterSettings, com.univocity.parsers.common.input.WriterCharAppender, com.univocity.parsers.common.processor.RowWriterProcessor

Field Summary

Modifier and TypeField and Description
protected final WriterCharAppender
private final boolean
protected final char
private NormalizedString[]
protected final String
private boolean
private final int
protected boolean
private Map<NormalizedString[], Map<NormalizedString, Integer>>
protected NormalizedString[]
protected boolean[]
protected boolean
protected boolean
private int[]
private final CommonSettings<DummyFormat>
private final boolean
private int
private final char[]
protected final String
private Object[]
private final Object[]
private int
protected long
private final WriterCharAppender
private final boolean
protected boolean
private boolean
protected final int
private Writer
private final RowWriterProcessor<T>
protected boolean

Constructor Summary

AccessConstructor and Description
public
AbstractWriter(S
the writer configuration
settings
)

All writers must support, at the very least, the settings provided by CommonWriterSettings.

public
AbstractWriter(File
the output file that will be written with the format-specific records as defined by subclasses of AbstractWriter.
file
,
S
the writer configuration
settings
)

All writers must support, at the very least, the settings provided by CommonWriterSettings.

public
AbstractWriter(File
the output file that will be written with the format-specific records as defined by subclasses of AbstractWriter.
file
,
String
the encoding of the file
encoding
,
S
the writer configuration
settings
)

All writers must support, at the very least, the settings provided by CommonWriterSettings.

public
AbstractWriter(File
the output file that will be written with the format-specific records as defined by subclasses of AbstractWriter.
file
,
Charset
the encoding of the file
encoding
,
S
the writer configuration
settings
)

All writers must support, at the very least, the settings provided by CommonWriterSettings.

public
AbstractWriter(OutputStream
the output stream that will be written with the format-specific records as defined by subclasses of AbstractWriter.
output
,
S
the writer configuration
settings
)

All writers must support, at the very least, the settings provided by CommonWriterSettings.

public
AbstractWriter(OutputStream
the output stream that will be written with the format-specific records as defined by subclasses of AbstractWriter.
output
,
String
the encoding of the stream
encoding
,
S
the writer configuration
settings
)

All writers must support, at the very least, the settings provided by CommonWriterSettings.

public
AbstractWriter(OutputStream
the output stream that will be written with the format-specific records as defined by subclasses of AbstractWriter.
output
,
Charset
the encoding of the stream
encoding
,
S
the writer configuration
settings
)

All writers must support, at the very least, the settings provided by CommonWriterSettings.

public
AbstractWriter(Writer
the output resource that will receive the format-specific records as defined by subclasses of AbstractWriter.
writer
,
S
the writer configuration
settings
)

All writers must support, at the very least, the settings provided by CommonWriterSettings.

Method Summary

Modifier and TypeMethod and Description
public final void
addStringValues(Collection<String>
the values to be written
values
)

Writes a sequence of Strings to a row in memory.

public final void
addValue(Object
the value to be written
value
)

Writes a value to a row in memory.

public final void
addValue(int
the position in the row that should receive the value.
index
,
Object
the value to be written
value
)

Writes a value to a row in memory.

public final void
addValue(String
the name of the column of the new row that should receive the value.
headerName
,
Object
the value to be written
value
)

Writes a value to a row in memory.

private final void
addValue(NormalizedString[] headersInContext, NormalizedString headerName, boolean ignoreOnMismatch, Object value)

public final void
addValues(Object...
the values to be written
values
)

Writes a sequence of values to a row in memory.

public final void
addValues(Collection<?>
the values to be written
values
)

Writes a sequence of values to a row in memory.

private Object[]
protected final boolean

Returns:

true if the value being written is not a header name, or it is a header name that won't conflict with another header if its surrounding whitespaces are trimmed.
allowTrim
(int
index of the field to be written.
fieldIndex
)

Checks whether the writer can remove trailing/leading whitespaces from a value being written.

protected final void
appendToRow(char
the character to append to the output row
ch
)

Appends the given character to the output row.

protected final void
appendToRow(char[]
the sequence of characters to append to the output row
chars
)

Appends the given character sequence to the output row

protected final void
appendValueToRow()

Appends the processed sequence of characters in AbstractWriter#appender to the output row.

public final void
close()

Closes the java.io.Writer given in this class constructor.

public final void
commentRow(String
the contents to be written as a comment to the output
comment
)

Writes a comment row to the output.

public final String

Returns:

a formatted String containing the comment.
commentRowToString
(String
the contents to be written as a comment to a String.
comment
)

Writes a comment row to a String

public final void
discardValues()

Discards the contents written to the internal in-memory row (using or #writeValue().

protected void
enableNewlineAfterRecord(boolean enableNewlineAfterRecord)

protected Object[]
expand(Object[] row, int length, Integer h2)

private <T> void
fillOutputRow(T[]
user-provided data which has to be rearranged to the expected record sequence before writing to the output.
row
)

Used when fields were selected and the input rows have a different order than the output.

private void
public final void
flush()

Flushes the java.io.Writer given in this class constructor.

private Object[]
private String
private int

Returns:

the position of the given header, or -1 if it's not found when ignoreOnMismatch is set to true
getFieldIndex
(NormalizedString[]
headers currently in use (they might change).
headersInContext
,
NormalizedString
the name of the header whose position will be identified
headerName
,
boolean
flag indicating that if the header is not found, no exception is to be thrown, and -1 should be returned instead.
ignoreOnMismatch
)

Calculates the index of a header name in relation to the original headers array defined in this writer

public final long

Returns:

the number of records written to the output so far
getRecordCount
()

Returns the number of records written to the output so far

private NormalizedString[]
protected String

Returns:

the String representation of the given object
getStringValue
(Object
the object to be converted into a String.
element
)

Converts a given object to its String representation for writing to a String

protected abstract void
initialize(S
the settings object specific to the format being written.
settings
)

Initializes the concrete implementation of this class with format-specific settings.

private void
internalWriteRow()

Writes the accumulated value of a record to the output, followed by a newline, and increases the record count.

private String

Returns:

a formatted String containing the comment.
internalWriteRowToString
()

Writes the accumulated value of a record to the output, followed by a newline, and increases the record count.

public final <
the key type
K
>
void
processObjectRecords(Map<K, String>
a mapping associating the keys of the input map to their corresponding header names.
headerMapping
,
Map<K, Object[]>
the map whose values will be used to generate a number of output records
rowData
)

Processes the data in all values of a map using the RowWriterProcessor provided by CommonWriterSettings#getRowWriterProcessor(), then writes all values to the output .

public final <
the key type
K
>
void
processObjectRecordsAndClose(Map<K, String>
a mapping associating the keys of the input map to their corresponding header names.
headerMapping
,
Map<K, Object[]>
the map whose values will be used to generate a number of output records
rowData
)

Processes the data in all values of a map using the RowWriterProcessor provided by CommonWriterSettings#getRowWriterProcessor(), then writes all values to the output and closes the writer.

public final <
the key type
K
>
void
processObjectRecordsAndClose(Map<K, Object[]>
the map whose values will be used to generate a number of output records
rowData
)

Processes the data in all values of a map using the RowWriterProcessor provided by CommonWriterSettings#getRowWriterProcessor(), then writes all values to the output and closes the writer.

public final <
the key type
K
>
List<String>

Returns:

a List of formatted String, each String representing one successful iteration over at least one element of the iterators in the map.
processObjectRecordsToString
(Map<K, Object[]>
the map whose values will be used to generate a List of String.
rowData
)

Processes the data in all values of a map using the RowWriterProcessor provided by CommonWriterSettings#getRowWriterProcessor() and writes the result into a List of String formatted to according to the specified output format.

public final <
the key type
K
>
List<String>

Returns:

a List of formatted String, each String representing one successful iteration over at least one element of the iterators in the map.
processObjectRecordsToString
(Map<K, String>
a mapping associating the keys of the input map to their corresponding header names.
headerMapping
,
Map<K, Object[]>
the map whose values will be used to generate a List of String.
rowData
)

Processes the data in all values of a map using the RowWriterProcessor provided by CommonWriterSettings#getRowWriterProcessor() and writes the result into a List of String formatted to according to the specified output format.

public final void
processRecord(Object...
the information of a single record to be transformed by a RowWriterProcessor and then written to the output
record
)

Processes the data given for an individual record with the RowWriterProcessor provided by CommonWriterSettings#getRowWriterProcessor(), then writes it.

public final <T extends Record> void
processRecord(T record)

public final void
processRecord(Object
the information of a single record to be transformed by a RowWriterProcessor and then written to the output
record
)

Processes the data given for an individual record with the RowWriterProcessor provided by CommonWriterSettings#getRowWriterProcessor(), then writes it.

public final void
processRecord(Map<?, ?>
the map whose values will be used to generate a List of String.
rowData
)

Processes the values of a map using the RowWriterProcessor provided by CommonWriterSettings#getRowWriterProcessor() and writes the result into a new output record A TextWritingException will be thrown if no RowWriterProcessor is provided by CommonWriterSettings#getRowWriterProcessor().

public final <
the key type
K
>
void
processRecord(Map<K, String>
a mapping associating the keys of the input map to their corresponding header names.
headerMapping
,
Map<K, ?>
the map whose values will be used to generate a List of String.
rowData
)

Processes the values of a map using the RowWriterProcessor provided by CommonWriterSettings#getRowWriterProcessor() and writes the result into a new output record A TextWritingException will be thrown if no RowWriterProcessor is provided by CommonWriterSettings#getRowWriterProcessor().

public final void
processRecords(Iterable<?>
the records to be transformed by a RowWriterProcessor and then written to the output
records
)

Iterates over all records, processes each one with the RowWriterProcessor provided by CommonWriterSettings#getRowWriterProcessor(), and writes them.

public final void
processRecords(Object[]
the records to transformed by a RowWriterProcessor and then written to the output
records
)

Iterates over all records, processes each one with the RowWriterProcessor provided by CommonWriterSettings#getRowWriterProcessor(), and writes them.

public final <
the concrete Record type
T extends Record
>
void
processRecords(T[]
the records to transformed by a RowWriterProcessor and then written to the output
records
)

Iterates over all records, processes each one with the RowWriterProcessor provided by CommonWriterSettings#getRowWriterProcessor(), and writes them.

public final <
the key type
K
,
the iterable type
I extends Iterable<?>
>
void
processRecords(Map<K, I>
the map whose values will be used to generate a number of output records
rowData
)

Processes the data in all values of a map using the RowWriterProcessor provided by CommonWriterSettings#getRowWriterProcessor(), then writes all values to the output .

public final <
the key type
K
,
the iterable type
I extends Iterable<?>
>
void
processRecords(Map<K, String>
a mapping associating the keys of the input map to their corresponding header names.
headerMapping
,
Map<K, I>
the map whose values will be used to generate a number of output records
rowData
)

Processes the data in all values of a map using the RowWriterProcessor provided by CommonWriterSettings#getRowWriterProcessor(), then writes all values to the output .

public final void
processRecordsAndClose(Iterable<?>
the records to be transformed by a RowWriterProcessor and then written to the output
allRecords
)

Iterates over all records, processes each one with the RowWriterProcessor provided by CommonWriterSettings#getRowWriterProcessor(), and writes them, then finally and closes the output A TextWritingException will be thrown if no RowWriterProcessor is provided by CommonWriterSettings#getRowWriterProcessor().

public final void
processRecordsAndClose(Object[]
the records to be transformed by a RowWriterProcessor and then written to the output
allRecords
)

Iterates over all records, processes each one with the RowWriterProcessor provided by CommonWriterSettings#getRowWriterProcessor(), and writes them, then finally and closes the output A TextWritingException will be thrown if no RowWriterProcessor is provided by CommonWriterSettings#getRowWriterProcessor().

public final <
the key type
K
,
the iterable type
I extends Iterable<?>
>
void
processRecordsAndClose(Map<K, String>
a mapping associating the keys of the input map to their corresponding header names.
headerMapping
,
Map<K, I>
the map whose values will be used to generate a number of output records
rowData
)

Processes the data in all values of a map using the RowWriterProcessor provided by CommonWriterSettings#getRowWriterProcessor(), then writes all values to the output and closes the writer.

public final <
the key type
K
,
the iterable type
I extends Iterable<?>
>
void
processRecordsAndClose(Map<K, I>
the map whose values will be used to generate a number of output records
rowData
)

Processes the data in all values of a map using the RowWriterProcessor provided by CommonWriterSettings#getRowWriterProcessor(), then writes all values to the output and closes the writer.

public final List<String>

Returns:

a List containing the information transformed from the given records as formatted Strings
processRecordsToString
(Iterable<?>
the records to be transformed by a RowWriterProcessor and then written to a List of String.
records
)

Iterates over all records, processes each one with the RowWriterProcessor provided by CommonWriterSettings#getRowWriterProcessor(), and writes them to a List of String.

public final List<String>

Returns:

a List containing the information transformed from the given records as formatted Strings
processRecordsToString
(Object[]
the records to transformed by a RowWriterProcessor and then written a String.
records
)

Iterates over all records, processes each one with the RowWriterProcessor provided by CommonWriterSettings#getRowWriterProcessor(), and writes them them to a List of String.

public final <
the key type
K
,
the iterable type
I extends Iterable<?>
>
List<String>

Returns:

a List of formatted String, each String representing one successful iteration over at least one element of the iterators in the map.
processRecordsToString
(Map<K, I>
the map whose values will be used to generate a List of String.
rowData
)

Processes the data in all values of a map using the RowWriterProcessor provided by CommonWriterSettings#getRowWriterProcessor() and writes the result into a List of String formatted to according to the specified output format.

public final <
the key type
K
,
the iterable type
I extends Iterable<?>
>
List<String>

Returns:

a List of formatted String, each String representing one successful iteration over at least one element of the iterators in the map.
processRecordsToString
(Map<K, String>
a mapping associating the keys of the input map to their corresponding header names.
headerMapping
,
Map<K, I>
the map whose values will be used to generate a List of String.
rowData
)

Processes the data in all values of a map using the RowWriterProcessor provided by CommonWriterSettings#getRowWriterProcessor() and writes the result into a List of String formatted to according to the specified output format.

public final String

Returns:

a formatted String containing the information transformed from the given record
processRecordToString
(Object...
the information of a single record to be transformed by a RowWriterProcessor and then written to a String.
record
)

Processes the data given for an individual record with the RowWriterProcessor provided by CommonWriterSettings#getRowWriterProcessor(), then writes it to a String.

public final <
the concrete Record type
T extends Record
>
String

Returns:

a formatted String containing the information transformed from the given record
processRecordToString
(T
the information of a single record to be transformed by a RowWriterProcessor and then written to a String.
record
)

Processes the data given for an individual record with the RowWriterProcessor provided by CommonWriterSettings#getRowWriterProcessor(), then writes it to a String.

public final String

Returns:

a formatted String containing the information transformed from the given record
processRecordToString
(Object
the information of a single record to be transformed by a RowWriterProcessor and then written to a String.
record
)

Processes the data given for an individual record with the RowWriterProcessor provided by CommonWriterSettings#getRowWriterProcessor(), then writes it.

public final String

Returns:

a String containing the given data as a formatted String
processRecordToString
(Map<?, ?>
the map whose values will be used to generate a List of String.
rowData
)

Processes the values of a map using the RowWriterProcessor provided by CommonWriterSettings#getRowWriterProcessor() and writes the result into String formatted according to the specified output format.

public final <
the key type
K
>
String

Returns:

a String containing the given data as a formatted String
processRecordToString
(Map<K, String>
a mapping associating the keys of the input map to their corresponding header names.
headerMapping
,
Map<K, ?>
the map whose values will be used to generate a List of String.
rowData
)

Processes the values of a map using the RowWriterProcessor provided by CommonWriterSettings#getRowWriterProcessor() and writes the result into String formatted according to the specified output format.

protected abstract void
processRow(Object[]
the data to be written to the output in the expected format.
row
)

Format-specific implementation for writing a single record into the output.

public final void
processValuesToRow()

Writes the contents accumulated in an internal in-memory row (using or #addValue() to a new record in the output.

public final String

Returns:

a formatted String containing the result produced by the RowWriterProcessor using the values accumulated in internal in-memory row.
processValuesToString
()

Writes the contents accumulated in an internal in-memory row (using or #addValue() to a String The objects added to this row will be processed with the RowWriterProcessor provided by CommonWriterSettings#getRowWriterProcessor().

private void
setHeadersFromMap(Map<?, ?>
the input map whose keys will be used to generate headers for the output.
map
,
boolean
indicates whether to take the map keys or values to build the header rows.
keys
)

Iterates over the keys of a map and builds an internal header row.

protected static int

Returns:

the index of the first non-whitespace character in the given element.
skipLeadingWhitespace
(int
starting range after which characters will be considered whitespace
whitespaceRangeStart
,
String
the String to be scanned for leading whitespaces.
element
)

Identifies the starting character index of a value being written if leading whitespaces are to be discarded

Implementation Note

whitespaces are considered all characters where ch <= ' ' evaluates to true

private void
submitRow(Object[]
the data to be written for a single record in the output.
row
)

Submits a row for processing by the format-specific implementation.

private TextWritingException
throwExceptionAndClose(String
Description of the error
message
)

In case of any exceptions, a TextWritingException is thrown, and the output java.io.Writer is closed.

private TextWritingException
throwExceptionAndClose(String
Description of the error
message
,
Throwable
the exception to be wrapped by a TextWritingException
cause
)

In case of any exceptions, a TextWritingException is thrown, and the output java.io.Writer is closed.

private TextWritingException
throwExceptionAndClose(String
Description of the error
message
,
String
characters used to write to the output at the time the exception happened
recordCharacters
,
Throwable
the exception to be wrapped by a TextWritingException
cause
)

In case of any exceptions, a TextWritingException is thrown, and the output java.io.Writer is closed.

private TextWritingException
throwExceptionAndClose(String
Description of the error
message
,
Object[]
values used to write to the output at the time the exception happened
recordValues
,
Throwable
the exception to be wrapped by a TextWritingException
cause
)

In case of any exceptions, a TextWritingException is thrown, and the output java.io.Writer is closed.

public void
updateFieldExclusion(String...
the selection of fields to exclude from the output.
fieldsToExclude
)

Updates the selection of fields to exclude when writing.

public void
updateFieldExclusion(Integer...
the selection of fields to exclude from the output.
fieldIndexesToExclude
)

Updates the selection of fields to exclude when writing.

public void
updateFieldSelection(String...
the new selection of fields to write.
newFieldSelection
)

Updates the selection of fields to write.

public void
updateFieldSelection(Integer...
the new selection of fields to write.
newFieldSelectionByIndex
)

Updates the selection of fields to write.

private void
updateIndexesToWrite(CommonSettings<?> settings)

Update indexes to write based on the field selection provided by the user.

private <K> Map<K, Iterable<Object>>
wrapObjectArray(Map<K, Object[]> rowData)

private <K> Map<K, Iterable<String>>
wrapRecordValues(Map<K, ? extends Record> rowData)

private <K> Map<K, Iterable<String>>
wrapStringArray(Map<K, String[]> rowData)

public final void
writeEmptyRow()

Writes an empty line to the output, unless this is a com.univocity.parsers.fixed.FixedWidthWriter whose FixedWidthWriterSettings#getWriteLineSeparatorAfterRecord() evaluates to false.

public final void
writeHeaders()

Writes the headers defined in CommonSettings#getHeaders() A TextWritingException will be thrown if no headers were defined or if records were already written to the output.

public final void
writeHeaders(Collection<?>
the headers to write to the output.
headers
)

Writes the given collection of headers to the output.

public final void
writeHeaders(String...
the headers to write to the output.
headers
)

Writes the given collection of headers to the output.

public final String

Returns:

a formatted String containing the headers defined in CommonSettings#getHeaders()
writeHeadersToString
()

Writes the headers defined in CommonSettings#getHeaders() to a String

public final String

Returns:

a formatted String containing the given headers
writeHeadersToString
(Collection<?>
the headers to write to a String
headers
)

Writes the given collection of headers to a String A TextWritingException will be thrown if no headers were defined.

public final String

Returns:

a formatted String containing the given headers
writeHeadersToString
(String...
the headers to write to a String
headers
)

Writes the given collection of headers to a String A TextWritingException will be thrown if no headers were defined or if records were already written to a String

public final <
the key type
K
>
void
writeObjectRows(Map<K, String>
a mapping associating the keys of the input map to their corresponding header names.
headerMapping
,
Map<K, Object[]>
the map whose values will be used to generate a number of output records
rowData
)

Writes the values of a given map to multiple output records Each value is expected to be iterable and the result of this method will produce the number of records equal to the longest iterable.

public final <
the key type
K
>
void
writeObjectRowsAndClose(Map<K, String>
a mapping associating the keys of the input map to their corresponding header names.
headerMapping
,
Map<K, Object[]>
the map whose values will be used to generate a number of output records
rowData
)

Writes the values of a given map to multiple output records and closes the output when finished.

public final <
the key type
K
>
void
writeObjectRowsAndClose(Map<K, Object[]>
the map whose values will be used to generate a number of output records
rowData
)

Writes the values of a given map to multiple output records and closes the output when finished.

public final <
the key type
K
>
List<String>

Returns:

a List of formatted String, each String representing one successful iteration over at least one element of the iterators in the map.
writeObjectRowsToString
(Map<K, String>
a mapping associating the keys of the input map to their corresponding header names.
headerMapping
,
Map<K, Object[]>
the map whose values will be used to generate a List of String.
rowData
)

Writes the values of a given map to a List of String formatted to according to the specified output format.

public final <
the concrete Record type
T extends Record
>
void
writeRecord(T
the information of a single record to be written to the output
row
)

Writes the data given for an individual record.

public final void
writeRecords(Collection<? extends Record>
the rows to be written to the output
rows
)

Iterates over all records and writes them to the output.

public final <
the key type
K
>
void
writeRecords(Map<K, String>
a mapping associating the keys of the input map to their corresponding header names.
headerMapping
,
Map<K, ? extends Record>
the map whose values will be used to generate a number of output records
rowData
)

Writes the values of a given map to multiple output records Each value is expected to be iterable and the result of this method will produce the number of records equal to the longest iterable.

public final void
writeRecordsAndClose(Collection<? extends Record>
the rows to be written to the output
allRows
)

Iterates over all records, writes them and closes the output

Note

this method will not use the RowWriterProcessor.

public final <
the key type
K
>
void
writeRecordsAndClose(Map<K, String>
a mapping associating the keys of the input map to their corresponding header names.
headerMapping
,
Map<K, ? extends Record>
the map whose values will be used to generate a number of output records
rowData
)

Writes the values of a given map to multiple output records and closes the output when finished.

public final <
the key type
K
>
void
writeRecordsAndClose(Map<K, ? extends Record>
the map whose values will be used to generate a number of output records
rowData
)

Writes the values of a given map to multiple output records and closes the output when finished.

public final List<String>

Returns:

a List containing the given rows as formatted Strings
writeRecordsToString
(Collection<? extends Record>
the rows to be written to a List of String.
rows
)

Iterates over all records and writes them to a List of String

Note

this method will not use the RowWriterProcessor.

public final <
the key type
K
>
List<String>

Returns:

a List of formatted String, each String representing one successful iteration over at least one element of the iterators in the map.
writeRecordsToString
(Map<K, String>
a mapping associating the keys of the input map to their corresponding header names.
headerMapping
,
Map<K, ? extends Record>
the map whose values will be used to generate a List of String.
rowData
)

Writes the values of a given map to a List of String formatted to according to the specified output format.

public final <T extends Record> String

Returns:

a formatted String containing the information of the given record
writeRecordToString
(T
the information of a single record to be written to a String.
row
)

Writes the data given for an individual record to a String.

public final void
writeRow(Collection<?>
the information of a single record to be written to the output
row
)

Writes the data given for an individual record.

public final void
writeRow(String[]
the information of a single record to be written to the output
row
)

Writes the data given for an individual record.

public final void
writeRow(Object...
the information of a single record to be written to the output
row
)

Writes the data given for an individual record.

public final void
writeRow(String
the line to be written to the output
row
)

Writes a plain (potentially free-text) String as a line to the output.

public final void
writeRow(Map<?, ?>
the map whose values will be used to generate a new record
rowData
)

Writes the values of a given map into new output record

Note

this method will not use the RowWriterProcessor.

public final <
the key type
K
>
void
writeRow(Map<K, String>
a mapping associating the keys of the input map to their corresponding header names.
headerMapping
,
Map<K, ?>
the map whose values will be used to generate a new record
rowData
)

Writes the values of a given map into new output record

Note

this method will not use the RowWriterProcessor.

public final void
writeRows(Object[][]
the rows to be written to the output
rows
)

Iterates over all records and writes them to the output.

public final <
Collection of objects containing values of a row
C extends Collection<?>
>
void
writeRows(Iterable<C>
the rows to be written to the output
rows
)

Iterates over all records and writes them to the output.

public final void
writeRows(Collection<Object[]>
the rows to be written to the output
rows
)

Iterates over all records and writes them to the output.

public final <
the key type
K
,
the iterable type
I extends Iterable<?>
>
void
writeRows(Map<K, I>
the map whose values will be used to generate a number of output records
rowData
)

Writes the values of a given map to multiple output records Each value is expected to be iterable and the result of this method will produce the number of records equal to the longest iterable.

public final <
the key type
K
,
the iterable type
I extends Iterable<?>
>
void
writeRows(Map<K, String>
a mapping associating the keys of the input map to their corresponding header names.
headerMapping
,
Map<K, I>
the map whose values will be used to generate a number of output records
rowData
)

Writes the values of a given map to multiple output records Each value is expected to be iterable and the result of this method will produce the number of records equal to the longest iterable.

private <
the key type
K
,
the iterable type
I extends Iterable<?>
>
void
writeRows(Map<K, String>
a mapping associating the keys of the input map to their corresponding header names.
headerMapping
,
Map<K, I>
the map whose values will be used to generate a List of String.
rowData
,
List<String>
an output List to fill with formatted Strings, each String representing one successful iteration over at least one element of the iterators in the map.
outputList
,
boolean useRowProcessor)

Writes the values of a given map to a List of String formatted to according to the specified output format.

public final <
Collection of objects containing values of a row
C extends Collection<?>
>
void
writeRowsAndClose(Iterable<C>
the rows to be written to the output
allRows
)

Iterates over all records, writes them and closes the output

Note

this method will not use the RowWriterProcessor.

public final void
writeRowsAndClose(Collection<Object[]>
the rows to be written to the output
allRows
)

Iterates over all records, writes them and closes the output

Note

this method will not use the RowWriterProcessor.

public final void
writeRowsAndClose(Object[][]
the rows to be written to the output
allRows
)

Iterates over all records, writes them and closes the output

Note

this method will not use the RowWriterProcessor.

public final <
the key type
K
,
the iterable type
I extends Iterable<?>
>
void
writeRowsAndClose(Map<K, String>
a mapping associating the keys of the input map to their corresponding header names.
headerMapping
,
Map<K, I>
the map whose values will be used to generate a number of output records
rowData
)

Writes the values of a given map to multiple output records and closes the output when finished.

public final <
the key type
K
,
the iterable type
I extends Iterable<?>
>
void
writeRowsAndClose(Map<K, I>
the map whose values will be used to generate a number of output records
rowData
)

Writes the values of a given map to multiple output records and closes the output when finished.

public final List<String>

Returns:

a List containing the given rows as formatted Strings
writeRowsToString
(Object[][]
the rows to be written to a List of String.
rows
)

Iterates over all records and writes them to a List of String

Note

this method will not use the RowWriterProcessor.

public final <
Collection of objects containing values of a row
C extends Collection<?>
>
List<String>

Returns:

a List containing the given rows as formatted Strings
writeRowsToString
(Iterable<C>
the rows to be written to a List of String.
rows
)

Iterates over all records and writes them to a List of String

Note

this method will not use the RowWriterProcessor.

public final List<String>

Returns:

a List containing the given rows as formatted Strings
writeRowsToString
(Collection<Object[]>
the rows to be written to a List of String.
rows
)

Iterates over all records and writes them to a List of String

Note

this method will not use the RowWriterProcessor.

public final <
the key type
K
,
the iterable type
I extends Iterable<?>
>
List<String>

Returns:

a List of formatted String, each String representing one successful iteration over at least one element of the iterators in the map.
writeRowsToString
(Map<K, I>
the map whose values will be used to generate a List of String.
rowData
)

Writes the values of a given map to a List of String formatted to according to the specified output format.

public final <
the key type
K
,
the iterable type
I extends Iterable<?>
>
List<String>

Returns:

a List of formatted String, each String representing one successful iteration over at least one element of the iterators in the map.
writeRowsToString
(Map<K, String>
a mapping associating the keys of the input map to their corresponding header names.
headerMapping
,
Map<K, I>
the map whose values will be used to generate a List of String.
rowData
)

Writes the values of a given map to a List of String formatted to according to the specified output format.

public final String

Returns:

a formatted String containing the information of the given record
writeRowToString
(Collection<?>
the information of a single record to be written to a String
row
)

Writes the data given for an individual record to a String

Note

this method will not use the RowWriterProcessor.

public final String

Returns:

a formatted String containing the information of the given record
writeRowToString
(String[]
the information of a single record to be written to a String.
row
)

Writes the data given for an individual record to a String.

public final String

Returns:

a formatted String containing the information of the given record
writeRowToString
(Object...
the information of a single record to be written to a String.
row
)

Writes the data given for an individual record to a String.

public final String

Returns:

a String containing the given data as a formatted String
writeRowToString
(Map<?, ?>
the map whose values will be used to generate a String.
rowData
)

Writes the values of a given map to a String formatted to according to the specified output format

Note

this method will not use the RowWriterProcessor.

public final <
the key type
K
>
String

Returns:

a String containing the given data as a formatted String
writeRowToString
(Map<K, String>
a mapping associating the keys of the input map to their corresponding header names.
headerMapping
,
Map<K, ?>
the map whose values will be used to generate a String.
rowData
)

Writes the values of a given map to a String formatted to according to the specified output format

Note

this method will not use the RowWriterProcessor.

public final void
writeStringRows(Collection<String[]>
the rows to be written to the output
rows
)

Iterates over all records and writes them to the output.

public final <
Collection of objects containing values of a row
C extends Collection<?>
>
void
writeStringRows(Iterable<C>
the rows to be written to the output
rows
)

Iterates over all records and writes them to the output.

public final <
the key type
K
>
void
writeStringRows(Map<K, String>
a mapping associating the keys of the input map to their corresponding header names.
headerMapping
,
Map<K, String[]>
the map whose values will be used to generate a number of output records
rowData
)

Writes the values of a given map to multiple output records Each value is expected to be iterable and the result of this method will produce the number of records equal to the longest iterable.

public final void
writeStringRowsAndClose(Collection<String[]>
the rows to be written to the output
allRows
)

Iterates over all records, writes them and closes the output

Note

this method will not use the RowWriterProcessor.

public final <
the key type
K
>
void
writeStringRowsAndClose(Map<K, String>
a mapping associating the keys of the input map to their corresponding header names.
headerMapping
,
Map<K, String[]>
the map whose values will be used to generate a number of output records
rowData
)

Writes the values of a given map to multiple output records and closes the output when finished.

public final <
the key type
K
>
void
writeStringRowsAndClose(Map<K, String[]>
the map whose values will be used to generate a number of output records
rowData
)

Writes the values of a given map to multiple output records and closes the output when finished.

public final <
Collection of objects containing values of a row
C extends Collection<?>
>
List<String>

Returns:

a List containing the given rows as formatted Strings
writeStringRowsToString
(Iterable<C>
the rows to be written to a List of String.
rows
)

Iterates over all records and writes them to a List of String

Note

this method will not use the RowWriterProcessor.

public final List<String>

Returns:

a List containing the given rows as formatted Strings
writeStringRowsToString
(Collection<String[]>
the rows to be written to a List of String.
rows
)

Iterates over all records and writes them to a List of String

Note

this method will not use the RowWriterProcessor.

public final <
the key type
K
>
List<String>

Returns:

a List of formatted String, each String representing one successful iteration over at least one element of the iterators in the map.
writeStringRowsToString
(Map<K, String>
a mapping associating the keys of the input map to their corresponding header names.
headerMapping
,
Map<K, String[]>
the map whose values will be used to generate a List of String.
rowData
)

Writes the values of a given map to a List of String formatted to according to the specified output format.

private <
type of the key in both rowData and headerMapping maps.
K
>
void
writeValuesFromMap(Map<K, String>
an optional map associating keys of the rowData map with expected header names
headerMapping
,
Map<K, ?>
the data to be written. Its keys will be used to form a header row in case no headers are available.
rowData
)

Writes values from an implementation of java.util.Map to a partial output record, ready to be written to the output.

public final void
writeValuesToRow()

Writes the contents accumulated in an internal in-memory row (using or #writeValue() to a new record in the output.

public final String

Returns:

a formatted String containing the information accumulated in the internal in-memory row.
writeValuesToString
()

Writes the contents accumulated in an internal in-memory row (using or #addValue() as a String

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait