S
- The specific writer settings configuration class, which can potentially provide additional configuration options supported by the writer implementation.public abstract class AbstractWriter<S extends CommonWriterSettings<?>> extends Object
CommonWriterSettings
, and delegates the writing algorithm implementation to its subclasses through the abstract method processRow(Object[])
The following (absolutely required) attributes are exposed to subclasses:
WriterCharAppender
): the character writer that appends characters from a given input into an internal bufferCsvWriter
,
CsvWriterSettings
,
FixedWidthWriter
,
FixedWidthWriterSettings
,
TsvWriter
,
TsvWriterSettings
,
WriterCharAppender
,
RowWriterProcessor
Modifier and Type | Field and Description |
---|---|
protected WriterCharAppender |
appender |
protected String |
emptyValue |
protected boolean |
expandRows |
protected String |
nullValue |
protected boolean |
usingNullOrEmptyValue |
protected int |
whitespaceRangeStart |
protected boolean |
writingHeaders |
Constructor and Description |
---|
AbstractWriter(File file,
Charset encoding,
S settings)
All writers must support, at the very least, the settings provided by
CommonWriterSettings . |
AbstractWriter(File file,
S settings)
All writers must support, at the very least, the settings provided by
CommonWriterSettings . |
AbstractWriter(File file,
String encoding,
S settings)
All writers must support, at the very least, the settings provided by
CommonWriterSettings . |
AbstractWriter(OutputStream output,
Charset encoding,
S settings)
All writers must support, at the very least, the settings provided by
CommonWriterSettings . |
AbstractWriter(OutputStream output,
S settings)
All writers must support, at the very least, the settings provided by
CommonWriterSettings . |
AbstractWriter(OutputStream output,
String encoding,
S settings)
All writers must support, at the very least, the settings provided by
CommonWriterSettings . |
AbstractWriter(S settings)
All writers must support, at the very least, the settings provided by
CommonWriterSettings . |
AbstractWriter(Writer writer,
S settings)
All writers must support, at the very least, the settings provided by
CommonWriterSettings . |
Modifier and Type | Method and Description |
---|---|
void |
addStringValues(Collection<String> values)
Writes a sequence of Strings to a row in memory.
|
void |
addValue(int index,
Object value)
Writes a value to a row in memory.
|
void |
addValue(Object value)
Writes a value to a row in memory.
|
void |
addValue(String headerName,
Object value)
Writes a value to a row in memory.
|
void |
addValues(Collection<Object> values)
Writes a sequence of values to a row in memory.
|
void |
addValues(Object... values)
Writes a sequence of values to a row in memory.
|
protected void |
appendToRow(char ch)
Appends the given character to the output row.
|
protected void |
appendValueToRow()
Appends the processed sequence of characters in
appender to the output row. |
void |
close()
Closes the
Writer given in this class constructor. |
void |
commentRow(String comment)
Writes a comment row to the output.
|
String |
commentRowToString(String comment)
Writes a comment row to a
String |
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,
String[] h2) |
void |
flush()
Flushes the
Writer given in this class constructor. |
long |
getRecordCount()
Returns the number of records written to the output so far
|
protected String |
getStringValue(Object element)
Converts a given object to its String representation for writing to a
String
If the object is null, then nullValue is returned.
If the String representation of this object is an empty String, then emptyValue is returned
|
protected abstract void |
initialize(S settings)
Initializes the concrete implementation of this class with format-specific settings.
|
<K> void |
processObjectRecords(Map<K,String> headerMapping,
Map<K,Object[]> rowData)
Processes the data in all values of a map using the
RowWriterProcessor provided by CommonWriterSettings.getRowWriterProcessor() ,
then writes all values to the output . |
<K> void |
processObjectRecordsAndClose(Map<K,Object[]> 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. |
<K> void |
processObjectRecordsAndClose(Map<K,String> headerMapping,
Map<K,Object[]> 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. |
<K> List<String> |
processObjectRecordsToString(Map<K,Object[]> 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. |
<K> List<String> |
processObjectRecordsToString(Map<K,String> headerMapping,
Map<K,Object[]> 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. |
void |
processRecord(Map<?,?> rowData)
Processes the values of a map using the
RowWriterProcessor provided by CommonWriterSettings.getRowWriterProcessor()
and writes the result into a new output record |
<K> void |
processRecord(Map<K,String> headerMapping,
Map<K,?> rowData)
Processes the values of a map using the
RowWriterProcessor provided by CommonWriterSettings.getRowWriterProcessor()
and writes the result into a new output record |
void |
processRecord(Object... record)
Processes the data given for an individual record with the
RowWriterProcessor provided by CommonWriterSettings.getRowWriterProcessor() , then writes it. |
void |
processRecord(Object record)
Processes the data given for an individual record with the
RowWriterProcessor provided by CommonWriterSettings.getRowWriterProcessor() , then writes it. |
void |
processRecords(Iterable<?> records)
Iterates over all records, processes each one with the
RowWriterProcessor provided by CommonWriterSettings.getRowWriterProcessor() , and writes them. |
<K,I extends Iterable<?>> |
processRecords(Map<K,I> rowData)
Processes the data in all values of a map using the
RowWriterProcessor provided by CommonWriterSettings.getRowWriterProcessor() ,
then writes all values to the output . |
<K,I extends Iterable<?>> |
processRecords(Map<K,String> headerMapping,
Map<K,I> rowData)
Processes the data in all values of a map using the
RowWriterProcessor provided by CommonWriterSettings.getRowWriterProcessor() ,
then writes all values to the output . |
void |
processRecords(Object[] records)
Iterates over all records, processes each one with the
RowWriterProcessor provided by CommonWriterSettings.getRowWriterProcessor() , and writes them. |
void |
processRecordsAndClose(Iterable<?> allRecords)
Iterates over all records, processes each one with the
RowWriterProcessor provided by CommonWriterSettings.getRowWriterProcessor() , and writes them, then finally and closes the output |
<K,I extends Iterable<?>> |
processRecordsAndClose(Map<K,I> 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. |
<K,I extends Iterable<?>> |
processRecordsAndClose(Map<K,String> headerMapping,
Map<K,I> 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. |
void |
processRecordsAndClose(Object[] allRecords)
Iterates over all records, processes each one with the
RowWriterProcessor provided by CommonWriterSettings.getRowWriterProcessor() , and writes them, then finally and closes the output |
List<String> |
processRecordsToString(Iterable<?> records)
Iterates over all records, processes each one with the
RowWriterProcessor provided by CommonWriterSettings.getRowWriterProcessor() , and writes them to a List of String . |
<K,I extends Iterable<?>> |
processRecordsToString(Map<K,I> 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. |
<K,I extends Iterable<?>> |
processRecordsToString(Map<K,String> headerMapping,
Map<K,I> 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. |
List<String> |
processRecordsToString(Object[] records)
Iterates over all records, processes each one with the
RowWriterProcessor provided by CommonWriterSettings.getRowWriterProcessor() , and writes them them to a List of String . |
String |
processRecordToString(Map<?,?> 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. |
<K> String |
processRecordToString(Map<K,String> headerMapping,
Map<K,?> 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. |
String |
processRecordToString(Object... record)
Processes the data given for an individual record with the
RowWriterProcessor provided by CommonWriterSettings.getRowWriterProcessor() , then writes it to a String . |
String |
processRecordToString(Object record)
Processes the data given for an individual record with the
RowWriterProcessor provided by CommonWriterSettings.getRowWriterProcessor() , then writes it. |
protected abstract void |
processRow(Object[] row)
Format-specific implementation for writing a single record into the output.
|
void |
processValuesToRow()
Writes the contents accumulated in an internal in-memory row (using
or #addValue() to a new record in the output. |
String |
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() . |
protected static int |
skipLeadingWhitespace(int whitespaceRangeStart,
String element)
Identifies the starting character index of a value being written if leading whitespaces are to be discarded.
|
void |
updateFieldExclusion(Integer... fieldIndexesToExclude)
Updates the selection of fields to exclude when writing.
|
void |
updateFieldExclusion(String... fieldsToExclude)
Updates the selection of fields to exclude when writing.
|
void |
updateFieldSelection(Integer... newFieldSelectionByIndex)
Updates the selection of fields to write.
|
void |
updateFieldSelection(String... newFieldSelection)
Updates the selection of fields to write.
|
void |
writeEmptyRow()
Writes an empty line to the output, unless this is a
FixedWidthWriter whose
FixedWidthWriterSettings.getWriteLineSeparatorAfterRecord() evaluates to false . |
void |
writeHeaders()
Writes the headers defined in
CommonSettings.getHeaders() |
void |
writeHeaders(Collection<String> headers)
Writes the given collection of headers to the output.
|
void |
writeHeaders(String... headers)
Writes the given collection of headers to the output.
|
String |
writeHeadersToString()
Writes the headers defined in
CommonSettings.getHeaders() to a String |
String |
writeHeadersToString(Collection<String> headers)
Writes the given collection of headers to a
String |
String |
writeHeadersToString(String... headers)
Writes the given collection of headers to a
String |
<K> void |
writeObjectRows(Map<K,String> headerMapping,
Map<K,Object[]> 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.
|
<K> void |
writeObjectRowsAndClose(Map<K,Object[]> rowData)
Writes the values of a given map to multiple output records and closes the output when finished.
|
<K> void |
writeObjectRowsAndClose(Map<K,String> headerMapping,
Map<K,Object[]> rowData)
Writes the values of a given map to multiple output records and closes the output when finished.
|
<K> List<String> |
writeObjectRowsToString(Map<K,String> headerMapping,
Map<K,Object[]> rowData)
Writes the values of a given map to a
List of String formatted to according to the specified output format. |
void |
writeRow(Collection<Object> row)
Writes the data given for an individual record.
|
void |
writeRow(Map<?,?> rowData)
Writes the values of a given map into new output record
|
<K> void |
writeRow(Map<K,String> headerMapping,
Map<K,?> rowData)
Writes the values of a given map into new output record
|
void |
writeRow(Object... row)
Writes the data given for an individual record.
|
void |
writeRow(String row)
Writes a plain (potentially free-text) String as a line to the output.
|
void |
writeRow(String[] row)
Writes the data given for an individual record.
|
void |
writeRows(Collection<Object[]> rows)
Iterates over all records and writes them to the output.
|
<C extends Collection<Object>> |
writeRows(Iterable<C> rows)
Iterates over all records and writes them to the output.
|
<K,I extends Iterable<?>> |
writeRows(Map<K,I> 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.
|
<K,I extends Iterable<?>> |
writeRows(Map<K,String> headerMapping,
Map<K,I> 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.
|
void |
writeRows(Object[][] rows)
Iterates over all records and writes them to the output.
|
void |
writeRowsAndClose(Collection<Object[]> allRows)
Iterates over all records, writes them and closes the output.
|
<C extends Collection<Object>> |
writeRowsAndClose(Iterable<C> allRows)
Iterates over all records, writes them and closes the output.
|
<K,I extends Iterable<?>> |
writeRowsAndClose(Map<K,I> rowData)
Writes the values of a given map to multiple output records and closes the output when finished.
|
<K,I extends Iterable<?>> |
writeRowsAndClose(Map<K,String> headerMapping,
Map<K,I> rowData)
Writes the values of a given map to multiple output records and closes the output when finished.
|
void |
writeRowsAndClose(Object[][] allRows)
Iterates over all records, writes them and closes the output.
|
List<String> |
writeRowsToString(Collection<Object[]> rows)
Iterates over all records and writes them to a
List of String . |
<C extends Collection<Object>> |
writeRowsToString(Iterable<C> rows)
Iterates over all records and writes them to a
List of String . |
<K,I extends Iterable<?>> |
writeRowsToString(Map<K,I> rowData)
Writes the values of a given map to a
List of String formatted to according to the specified output format. |
<K,I extends Iterable<?>> |
writeRowsToString(Map<K,String> headerMapping,
Map<K,I> rowData)
Writes the values of a given map to a
List of String formatted to according to the specified output format. |
List<String> |
writeRowsToString(Object[][] rows)
Iterates over all records and writes them to a
List of String . |
String |
writeRowToString(Collection<Object> row)
Writes the data given for an individual record to a
String . |
String |
writeRowToString(Map<?,?> rowData)
Writes the values of a given map to a
String formatted to according to the specified output format. |
<K> String |
writeRowToString(Map<K,String> headerMapping,
Map<K,?> rowData)
Writes the values of a given map to a
String formatted to according to the specified output format. |
String |
writeRowToString(Object... row)
Writes the data given for an individual record to a
String . |
String |
writeRowToString(String[] row)
Writes the data given for an individual record to a
String . |
void |
writeStringRows(Collection<String[]> rows)
Iterates over all records and writes them to the output.
|
<C extends Collection<String>> |
writeStringRows(Iterable<C> rows)
Iterates over all records and writes them to the output.
|
<K> void |
writeStringRows(Map<K,String> headerMapping,
Map<K,String[]> 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.
|
void |
writeStringRowsAndClose(Collection<String[]> allRows)
Iterates over all records, writes them and closes the output.
|
<K> void |
writeStringRowsAndClose(Map<K,String[]> rowData)
Writes the values of a given map to multiple output records and closes the output when finished.
|
<K> void |
writeStringRowsAndClose(Map<K,String> headerMapping,
Map<K,String[]> rowData)
Writes the values of a given map to multiple output records and closes the output when finished.
|
List<String> |
writeStringRowsToString(Collection<String[]> rows)
Iterates over all records and writes them to a
List of String . |
<C extends Collection<String>> |
writeStringRowsToString(Iterable<C> rows)
Iterates over all records and writes them to a
List of String . |
<K> List<String> |
writeStringRowsToString(Map<K,String> headerMapping,
Map<K,String[]> rowData)
Writes the values of a given map to a
List of String formatted to according to the specified output format. |
void |
writeValuesToRow()
Writes the contents accumulated in an internal in-memory row (using
or #writeValue() to a new record in the output. |
String |
writeValuesToString()
Writes the contents accumulated in an internal in-memory row (using
or #addValue() as a String |
protected final String nullValue
protected final String emptyValue
protected final WriterCharAppender appender
protected boolean writingHeaders
protected boolean expandRows
protected boolean usingNullOrEmptyValue
protected final int whitespaceRangeStart
public AbstractWriter(S settings)
CommonWriterSettings
. The AbstractWriter requires its configuration to be properly initialized.
Important: by not providing an instance of Writer
to this constructor, only the operations that write to Strings are available.
settings
- the writer configurationpublic AbstractWriter(File file, S settings)
CommonWriterSettings
. The AbstractWriter requires its configuration to be properly initialized.file
- the output file that will be written with the format-specific records as defined by subclasses of AbstractWriter
.settings
- the writer configurationpublic AbstractWriter(File file, String encoding, S settings)
CommonWriterSettings
. The AbstractWriter requires its configuration to be properly initialized.file
- the output file that will be written with the format-specific records as defined by subclasses of AbstractWriter
.encoding
- the encoding of the filesettings
- the writer configurationpublic AbstractWriter(File file, Charset encoding, S settings)
CommonWriterSettings
. The AbstractWriter requires its configuration to be properly initialized.file
- the output file that will be written with the format-specific records as defined by subclasses of AbstractWriter
.encoding
- the encoding of the filesettings
- the writer configurationpublic AbstractWriter(OutputStream output, S settings)
CommonWriterSettings
. The AbstractWriter requires its configuration to be properly initialized.output
- the output stream that will be written with the format-specific records as defined by subclasses of AbstractWriter
.settings
- the writer configurationpublic AbstractWriter(OutputStream output, String encoding, S settings)
CommonWriterSettings
. The AbstractWriter requires its configuration to be properly initialized.output
- the output stream that will be written with the format-specific records as defined by subclasses of AbstractWriter
.encoding
- the encoding of the streamsettings
- the writer configurationpublic AbstractWriter(OutputStream output, Charset encoding, S settings)
CommonWriterSettings
. The AbstractWriter requires its configuration to be properly initialized.output
- the output stream that will be written with the format-specific records as defined by subclasses of AbstractWriter
.encoding
- the encoding of the streamsettings
- the writer configurationpublic AbstractWriter(Writer writer, S settings)
CommonWriterSettings
. The AbstractWriter requires its configuration to be properly initialized.writer
- the output resource that will receive the format-specific records as defined by subclasses of AbstractWriter
.settings
- the writer configurationprotected void enableNewlineAfterRecord(boolean enableNewlineAfterRecord)
protected abstract void initialize(S settings)
settings
- the settings object specific to the format being written.public void updateFieldSelection(String... newFieldSelection)
newFieldSelection
- the new selection of fields to write.public void updateFieldSelection(Integer... newFieldSelectionByIndex)
newFieldSelectionByIndex
- the new selection of fields to write.public void updateFieldExclusion(String... fieldsToExclude)
fieldsToExclude
- the selection of fields to exclude from the output.public void updateFieldExclusion(Integer... fieldIndexesToExclude)
fieldIndexesToExclude
- the selection of fields to exclude from the output.protected abstract void processRow(Object[] row)
The AbstractWriter handles the initialization and processing of the output until it is ready to be written (generally, reorganizing it and passing it on to a RowWriterProcessor
).
It then delegates the record to the writer-specific implementation defined by processRow(Object[])
. In general, an implementation of processRow(Object[])
will perform the following steps:
appender
object. The an individual value is processed, the appendValueToRow()
method must be called.
This will clear the accumulated value in appender
and add it to the output row.appendToRow(char)
Once the processRow(Object[])
method returns, a row will be written to the output with the processed information, and a newline will be automatically written after the given contents, unless this is a
FixedWidthWriter
whose FixedWidthWriterSettings.getWriteLineSeparatorAfterRecord()
evaluates to false
. The newline character sequence will conform to what is specified in Format.getLineSeparator()
This cycle repeats until the writing process is stopped by the user or an error happens.
In case of errors, the unchecked exception TextWritingException
will be thrown and all resources in use will be closed automatically. The exception should contain the cause and more information about the output state when the error happened.
row
- the data to be written to the output in the expected format.CharAppender
,
CommonWriterSettings
protected final void appendValueToRow()
appender
to the output row.protected final void appendToRow(char ch)
ch
- the character to append to the output rowpublic final void writeHeaders()
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<String> headers)
A TextWritingException
will be thrown if no headers were defined or if records were already written to the output.
headers
- the headers to write to the output.public final void writeHeaders(String... headers)
A TextWritingException
will be thrown if no headers were defined or if records were already written to the output.
headers
- the headers to write to the output.public final void processRecordsAndClose(Iterable<?> allRecords)
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()
.
allRecords
- the records to be transformed by a RowWriterProcessor
and then written to the outputpublic final void processRecordsAndClose(Object[] allRecords)
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()
.
allRecords
- the records to be transformed by a RowWriterProcessor
and then written to the outputpublic final void processRecords(Iterable<?> records)
RowWriterProcessor
provided by CommonWriterSettings.getRowWriterProcessor()
, and writes them.
The output will remain open for further writing.
A TextWritingException
will be thrown if no RowWriterProcessor
is provided by CommonWriterSettings.getRowWriterProcessor()
.
records
- the records to be transformed by a RowWriterProcessor
and then written to the outputpublic final void processRecords(Object[] records)
RowWriterProcessor
provided by CommonWriterSettings.getRowWriterProcessor()
, and writes them.
The output will remain open for further writing. *
A TextWritingException
will be thrown if no RowWriterProcessor
is provided by CommonWriterSettings.getRowWriterProcessor()
.
records
- the records to transformed by a RowWriterProcessor
and then written to the outputpublic final void processRecord(Object... record)
RowWriterProcessor
provided by CommonWriterSettings.getRowWriterProcessor()
, then writes it.
The output will remain open for further writing.
A TextWritingException
will be thrown if no RowWriterProcessor
is provided by CommonWriterSettings.getRowWriterProcessor()
.
record
- the information of a single record to be transformed by a RowWriterProcessor
and then written to the outputpublic final void processRecord(Object record)
RowWriterProcessor
provided by CommonWriterSettings.getRowWriterProcessor()
, then writes it.
The output will remain open for further writing.
A TextWritingException
will be thrown if no RowWriterProcessor
is provided by CommonWriterSettings.getRowWriterProcessor()
.
record
- the information of a single record to be transformed by a RowWriterProcessor
and then written to the outputpublic final <C extends Collection<Object>> void writeRowsAndClose(Iterable<C> allRows)
Note this method will not use the RowWriterProcessor
. Use processRecordsAndClose(Iterable)
for that.
C
- Collection of objects containing values of a rowallRows
- the rows to be written to the outputpublic final void writeRowsAndClose(Collection<Object[]> allRows)
Note this method will not use the RowWriterProcessor
. Use processRecordsAndClose(Object[])
for that.
allRows
- the rows to be written to the outputpublic final void writeStringRowsAndClose(Collection<String[]> allRows)
Note this method will not use the RowWriterProcessor
. Use processRecordsAndClose(Iterable)
for that.
allRows
- the rows to be written to the outputpublic final void writeRowsAndClose(Object[][] allRows)
Note this method will not use the RowWriterProcessor
. Use processRecordsAndClose(Object[])
for that.
allRows
- the rows to be written to the outputpublic final void writeRows(Object[][] rows)
The output will remain open for further writing.
Note this method will not use the RowWriterProcessor
. Use processRecords(Object[])
for that.
rows
- the rows to be written to the outputpublic final <C extends Collection<Object>> void writeRows(Iterable<C> rows)
The output will remain open for further writing.
Note this method will not use the RowWriterProcessor
. Use processRecords(Iterable)
for that.
C
- Collection of objects containing values of a rowrows
- the rows to be written to the outputpublic final void writeStringRows(Collection<String[]> rows)
The output will remain open for further writing.
Note this method will not use the RowWriterProcessor
. Use processRecords(Iterable)
for that.
rows
- the rows to be written to the outputpublic final <C extends Collection<String>> void writeStringRows(Iterable<C> rows)
The output will remain open for further writing.
Note this method will not use the RowWriterProcessor
. Use processRecords(Iterable)
for that.
C
- Collection of objects containing values of a rowrows
- the rows to be written to the outputpublic final void writeRows(Collection<Object[]> rows)
The output will remain open for further writing.
Note this method will not use the RowWriterProcessor
. Use processRecords(Iterable)
for that.
rows
- the rows to be written to the outputpublic final void writeRow(Collection<Object> row)
The output will remain open for further writing.
Note this method will not use the RowWriterProcessor
. Use processRecord(Object)
for that.
row
- the information of a single record to be written to the outputpublic final void writeRow(String[] row)
The output will remain open for further writing.
If the given data is null or empty, and CommonSettings.getSkipEmptyLines()
is true, the input will be just ignored.
If CommonSettings.getSkipEmptyLines()
is false, then an empty row will be written to the output (as specified by writeEmptyRow()
).
In case of any errors, a TextWritingException
will be thrown and the Writer
given in the constructor will be closed.
Note this method will not use the RowWriterProcessor
. Use processRecord(Object)
for that.
row
- the information of a single record to be written to the outputpublic final void writeRow(Object... row)
The output will remain open for further writing.
If the given data is null or empty, and CommonSettings.getSkipEmptyLines()
is true, the input will be just ignored.
If CommonSettings.getSkipEmptyLines()
is false, then an empty row will be written to the output (as specified by writeEmptyRow()
).
In case of any errors, a TextWritingException
will be thrown and the Writer
given in the constructor will be closed.
Note this method will not use the RowWriterProcessor
. Use processRecord(Object)
for that.
row
- the information of a single record to be written to the outputpublic final void writeRow(String row)
A newline will automatically written after the given contents, unless this is a
FixedWidthWriter
whose
FixedWidthWriterSettings.getWriteLineSeparatorAfterRecord()
evaluates to false
.
The newline character sequence will conform to what is specified in Format.getLineSeparator()
The writer implementation has no control over the format of this content.
The output will remain open for further writing.
row
- the line to be written to the outputpublic final void writeEmptyRow()
FixedWidthWriter
whose
FixedWidthWriterSettings.getWriteLineSeparatorAfterRecord()
evaluates to false
.
The newline character sequence will conform to what is specified in Format.getLineSeparator()
The output will remain open for further writing.
public final void commentRow(String comment)
A newline will automatically written after the given contents, unless this is a
FixedWidthWriter
whose
FixedWidthWriterSettings.getWriteLineSeparatorAfterRecord()
evaluates to false
.
The newline character sequence will conform to what is specified in Format.getLineSeparator()
The output will remain open for further writing.
comment
- the contents to be written as a comment to the outputprotected static int skipLeadingWhitespace(int whitespaceRangeStart, String element)
Implementation note whitespaces are considered all characters where ch <= ' '
evaluates to true
whitespaceRangeStart
- starting range after which characters will be considered whitespaceelement
- the String to be scanned for leading whitespaces.public final void flush()
Writer
given in this class constructor.
An IllegalStateException will be thrown in case of any errors, and the writer will be closed.
public final void close()
Writer
given in this class constructor.
An IllegalStateException will be thrown in case of any errors.
protected String getStringValue(Object element)
String
nullValue
is returned.emptyValue
is returnedelement
- the object to be converted into a String.public final void addValues(Object... values)
writeValuesToRow()
is called to flush
all values accumulated and effectively write a new record to the outputvalues
- the values to be writtenpublic final void addStringValues(Collection<String> values)
writeValuesToRow()
is called to flush
all values accumulated and effectively write a new record to the outputvalues
- the values to be writtenpublic final void addValues(Collection<Object> values)
writeValuesToRow()
is called to flush
all values accumulated and effectively write a new record to the outputvalues
- the values to be writtenpublic final void addValue(Object value)
writeValuesToRow()
is called to flush
all values accumulated and effectively write a new record to the outputvalue
- the value to be writtenpublic final void writeValuesToRow()
or #writeValue()
to a new record in the output.public final void addValue(int index, Object value)
writeValuesToRow()
is called to flush
all values accumulated and effectively write a new record to the outputindex
- the position in the row that should receive the value.value
- the value to be writtenpublic final void addValue(String headerName, Object value)
writeValuesToRow()
is called to flush
all values accumulated and effectively write a new record to the outputheaderName
- the name of the column of the new row that should receive the value.value
- the value to be writtenpublic final void discardValues()
or #writeValue()
.public final String writeHeadersToString()
CommonSettings.getHeaders()
to a String
String
containing the headers defined in CommonSettings.getHeaders()
public final String writeHeadersToString(Collection<String> headers)
String
A TextWritingException
will be thrown if no headers were defined.
headers
- the headers to write to a String
String
containing the given headerspublic final String writeHeadersToString(String... headers)
String
A TextWritingException
will be thrown if no headers were defined or if records were already written to a String
headers
- the headers to write to a String
String
containing the given headerspublic final List<String> processRecordsToString(Iterable<?> records)
RowWriterProcessor
provided by CommonWriterSettings.getRowWriterProcessor()
, and writes them to a List
of String
.
A TextWritingException
will be thrown if no RowWriterProcessor
is provided by CommonWriterSettings.getRowWriterProcessor()
.
records
- the records to be transformed by a RowWriterProcessor
and then written to a List
of String
.List
containing the information transformed from the given records as formatted String
spublic final List<String> processRecordsToString(Object[] records)
RowWriterProcessor
provided by CommonWriterSettings.getRowWriterProcessor()
, and writes them them to a List
of String
.
A TextWritingException
will be thrown if no RowWriterProcessor
is provided by CommonWriterSettings.getRowWriterProcessor()
.
records
- the records to transformed by a RowWriterProcessor
and then written a String
.List
containing the information transformed from the given records as formatted String
spublic final String processRecordToString(Object... record)
RowWriterProcessor
provided by CommonWriterSettings.getRowWriterProcessor()
, then writes it to a String
.
A TextWritingException
will be thrown if no RowWriterProcessor
is provided by CommonWriterSettings.getRowWriterProcessor()
.
record
- the information of a single record to be transformed by a RowWriterProcessor
and then written to a String
.String
containing the information transformed from the given recordpublic final String processRecordToString(Object record)
RowWriterProcessor
provided by CommonWriterSettings.getRowWriterProcessor()
, then writes it.
The output will remain open for further writing.
A TextWritingException
will be thrown if no RowWriterProcessor
is provided by CommonWriterSettings.getRowWriterProcessor()
.
record
- the information of a single record to be transformed by a RowWriterProcessor
and then written to a String
.String
containing the information transformed from the given recordpublic final List<String> writeRowsToString(Object[][] rows)
List
of String
.
Note this method will not use the RowWriterProcessor
. Use processRecords(Object[])
for that.
rows
- the rows to be written to a List
of String
.List
containing the given rows as formatted String
spublic final <C extends Collection<Object>> List<String> writeRowsToString(Iterable<C> rows)
List
of String
.
Note this method will not use the RowWriterProcessor
. Use processRecords(Iterable)
for that.
C
- Collection of objects containing values of a rowrows
- the rows to be written to a List
of String
.List
containing the given rows as formatted String
spublic final <C extends Collection<String>> List<String> writeStringRowsToString(Iterable<C> rows)
List
of String
.
Note this method will not use the RowWriterProcessor
. Use processRecords(Iterable)
for that.
C
- Collection of objects containing values of a rowrows
- the rows to be written to a List
of String
.List
containing the given rows as formatted String
spublic final List<String> writeRowsToString(Collection<Object[]> rows)
List
of String
.
Note this method will not use the RowWriterProcessor
. Use processRecords(Iterable)
for that.
rows
- the rows to be written to a List
of String
.List
containing the given rows as formatted String
spublic final List<String> writeStringRowsToString(Collection<String[]> rows)
List
of String
.
Note this method will not use the RowWriterProcessor
. Use processRecords(Iterable)
for that.
rows
- the rows to be written to a List
of String
.List
containing the given rows as formatted String
spublic final String writeRowToString(Collection<Object> row)
String
.
Note this method will not use the RowWriterProcessor
. Use processRecord(Object)
for that.
row
- the information of a single record to be written to a String
String
containing the information of the given recordpublic final String writeRowToString(String[] row)
String
.
If the given data is null or empty, and CommonSettings.getSkipEmptyLines()
is true, null
will be returned
In case of any errors, a TextWritingException
will be thrown.
Note this method will not use the RowWriterProcessor
. Use processRecord(Object)
for that.
row
- the information of a single record to be written to a String
.String
containing the information of the given recordpublic final String writeRowToString(Object... row)
String
.
If the given data is null or empty, and CommonSettings.getSkipEmptyLines()
is true, null
will be returned
In case of any errors, a TextWritingException
will be thrown.
Note this method will not use the RowWriterProcessor
. Use processRecord(Object)
for that.
row
- the information of a single record to be written to a String
.String
containing the information of the given recordpublic final String commentRowToString(String comment)
String
comment
- the contents to be written as a comment to a String
.String
containing the comment.public final String writeValuesToString()
or #addValue()
as a String
String
containing the information accumulated in the internal in-memory row.public final void processValuesToRow()
or #addValue()
to a new record in the output.
The objects added to this row will be processed with the RowWriterProcessor
provided by CommonWriterSettings.getRowWriterProcessor()
.
The output will remain open for further writing.
A TextWritingException
will be thrown if no RowWriterProcessor
is provided by CommonWriterSettings.getRowWriterProcessor()
.
public final String processValuesToString()
or #addValue()
to a String
The objects added to this row will be processed with the RowWriterProcessor
provided by CommonWriterSettings.getRowWriterProcessor()
.
The output will remain open for further writing.
A TextWritingException
will be thrown if no RowWriterProcessor
is provided by CommonWriterSettings.getRowWriterProcessor()
.
String
containing the result produced by the RowWriterProcessor
using the values accumulated in internal in-memory row.public final long getRecordCount()
public final String writeRowToString(Map<?,?> rowData)
String
formatted to according to the specified output format.
Note this method will not use the RowWriterProcessor
.
rowData
- the map whose values will be used to generate a String
.String
containing the given data as a formatted String
public final void writeRow(Map<?,?> rowData)
Note this method will not use the RowWriterProcessor
.
rowData
- the map whose values will be used to generate a new recordpublic final <K> String writeRowToString(Map<K,String> headerMapping, Map<K,?> rowData)
String
formatted to according to the specified output format.
Note this method will not use the RowWriterProcessor
.
K
- the key typeheaderMapping
- a mapping associating the keys of the input map to their corresponding header names.rowData
- the map whose values will be used to generate a String
.String
containing the given data as a formatted String
public final <K> void writeRow(Map<K,String> headerMapping, Map<K,?> rowData)
Note this method will not use the RowWriterProcessor
.
K
- the key typeheaderMapping
- a mapping associating the keys of the input map to their corresponding header names.rowData
- the map whose values will be used to generate a new recordpublic final <K,I extends Iterable<?>> List<String> writeRowsToString(Map<K,I> rowData)
List
of String
formatted to according to the specified output format.
Each value is expected to be iterable and the result of this method will produce the number of records equal to the longest iterable.
A new record will be created each time at least one Iterator.hasNext()
returns true
. Null
will be written
when a iterator has been fully read.
Note this method will not use the RowWriterProcessor
.
K
- the key typeI
- the iterable typerowData
- the map whose values will be used to generate a List
of String
.List
of formatted String
, each String
representing one successful iteration over at least one
element of the iterators in the map.public final <K,I extends Iterable<?>> void writeRows(Map<K,I> rowData)
Iterator.hasNext()
returns true
. Null
will be written
when a iterator has been fully read.
Note this method will not use the RowWriterProcessor
.
K
- the key typeI
- the iterable typerowData
- the map whose values will be used to generate a number of output recordspublic final <K,I extends Iterable<?>> List<String> writeRowsToString(Map<K,String> headerMapping, Map<K,I> rowData)
List
of String
formatted to according to the specified output format.
Each value is expected to be iterable and the result of this method will produce the number of records equal to the longest iterable.
A new record will be created each time at least one Iterator.hasNext()
returns true
. Null
will be written
when a iterator has been fully read.
Note this method will not use the RowWriterProcessor
.
K
- the key typeI
- the iterable typeheaderMapping
- a mapping associating the keys of the input map to their corresponding header names.rowData
- the map whose values will be used to generate a List
of String
.List
of formatted String
, each String
representing one successful iteration over at least one
element of the iterators in the map.public final <K,I extends Iterable<?>> void writeRows(Map<K,String> headerMapping, Map<K,I> rowData)
Iterator.hasNext()
returns true
. Null
will be written
when a iterator has been fully read.
Note this method will not use the RowWriterProcessor
.
K
- the key typeI
- the iterable typeheaderMapping
- a mapping associating the keys of the input map to their corresponding header names.rowData
- the map whose values will be used to generate a number of output recordspublic final <K> List<String> writeStringRowsToString(Map<K,String> headerMapping, Map<K,String[]> rowData)
List
of String
formatted to according to the specified output format.
Each value is expected to be iterable and the result of this method will produce the number of records equal to the longest iterable.
A new record will be created each time at least one Iterator.hasNext()
returns true
. Null
will be written
when a iterator has been fully read.
Note this method will not use the RowWriterProcessor
.
K
- the key typeheaderMapping
- a mapping associating the keys of the input map to their corresponding header names.rowData
- the map whose values will be used to generate a List
of String
.List
of formatted String
, each String
representing one successful iteration over at least one
element of the iterators in the map.public final <K> void writeStringRows(Map<K,String> headerMapping, Map<K,String[]> rowData)
Iterator.hasNext()
returns true
. Null
will be written
when a iterator has been fully read.
Note this method will not use the RowWriterProcessor
.
K
- the key typeheaderMapping
- a mapping associating the keys of the input map to their corresponding header names.rowData
- the map whose values will be used to generate a number of output recordspublic final <K> List<String> writeObjectRowsToString(Map<K,String> headerMapping, Map<K,Object[]> rowData)
List
of String
formatted to according to the specified output format.
Each value is expected to be iterable and the result of this method will produce the number of records equal to the longest iterable.
A new record will be created each time at least one Iterator.hasNext()
returns true
. Null
will be written
when a iterator has been fully read.
Note this method will not use the RowWriterProcessor
.
K
- the key typeheaderMapping
- a mapping associating the keys of the input map to their corresponding header names.rowData
- the map whose values will be used to generate a List
of String
.List
of formatted String
, each String
representing one successful iteration over at least one
element of the iterators in the map.public final <K> void writeObjectRows(Map<K,String> headerMapping, Map<K,Object[]> rowData)
Iterator.hasNext()
returns true
. Null
will be written
when a iterator has been fully read.
Note this method will not use the RowWriterProcessor
.
K
- the key typeheaderMapping
- a mapping associating the keys of the input map to their corresponding header names.rowData
- the map whose values will be used to generate a number of output recordspublic final <K> void writeObjectRowsAndClose(Map<K,String> headerMapping, Map<K,Object[]> rowData)
Iterator.hasNext()
returns true
. Null
will be written
when a iterator has been fully read.
Note this method will not use the RowWriterProcessor
.
K
- the key typeheaderMapping
- a mapping associating the keys of the input map to their corresponding header names.rowData
- the map whose values will be used to generate a number of output recordspublic final <K> void writeStringRowsAndClose(Map<K,String> headerMapping, Map<K,String[]> rowData)
Iterator.hasNext()
returns true
. Null
will be written
when a iterator has been fully read.
Note this method will not use the RowWriterProcessor
.
K
- the key typeheaderMapping
- a mapping associating the keys of the input map to their corresponding header names.rowData
- the map whose values will be used to generate a number of output recordspublic final <K> void writeObjectRowsAndClose(Map<K,Object[]> rowData)
Iterator.hasNext()
returns true
. Null
will be written
when a iterator has been fully read.
Note this method will not use the RowWriterProcessor
.
K
- the key typerowData
- the map whose values will be used to generate a number of output recordspublic final <K> void writeStringRowsAndClose(Map<K,String[]> rowData)
Iterator.hasNext()
returns true
. Null
will be written
when a iterator has been fully read.
Note this method will not use the RowWriterProcessor
.
K
- the key typerowData
- the map whose values will be used to generate a number of output recordspublic final <K,I extends Iterable<?>> void writeRowsAndClose(Map<K,String> headerMapping, Map<K,I> rowData)
Iterator.hasNext()
returns true
. Null
will be written
when a iterator has been fully read.
Note this method will not use the RowWriterProcessor
.
K
- the key typeI
- the iterable typeheaderMapping
- a mapping associating the keys of the input map to their corresponding header names.rowData
- the map whose values will be used to generate a number of output recordspublic final <K,I extends Iterable<?>> void writeRowsAndClose(Map<K,I> rowData)
Iterator.hasNext()
returns true
. Null
will be written
when a iterator has been fully read.
Note this method will not use the RowWriterProcessor
.
K
- the key typeI
- the iterable typerowData
- the map whose values will be used to generate a number of output recordspublic final String processRecordToString(Map<?,?> rowData)
RowWriterProcessor
provided by CommonWriterSettings.getRowWriterProcessor()
and writes the result into String
formatted according to the specified output format.
A TextWritingException
will be thrown if no RowWriterProcessor
is provided by CommonWriterSettings.getRowWriterProcessor()
.
rowData
- the map whose values will be used to generate a List
of String
.String
containing the given data as a formatted String
public final void processRecord(Map<?,?> rowData)
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()
.
rowData
- the map whose values will be used to generate a List
of String
.public final <K> String processRecordToString(Map<K,String> headerMapping, Map<K,?> rowData)
RowWriterProcessor
provided by CommonWriterSettings.getRowWriterProcessor()
and writes the result into String
formatted according to the specified output format.
A TextWritingException
will be thrown if no RowWriterProcessor
is provided by CommonWriterSettings.getRowWriterProcessor()
.
K
- the key typeheaderMapping
- a mapping associating the keys of the input map to their corresponding header names.rowData
- the map whose values will be used to generate a List
of String
.String
containing the given data as a formatted String
public final <K> void processRecord(Map<K,String> headerMapping, Map<K,?> rowData)
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()
.
K
- the key typeheaderMapping
- a mapping associating the keys of the input map to their corresponding header names.rowData
- the map whose values will be used to generate a List
of String
.public final <K,I extends Iterable<?>> List<String> processRecordsToString(Map<K,I> rowData)
RowWriterProcessor
provided by CommonWriterSettings.getRowWriterProcessor()
and writes the result into a List
of String
formatted to according to the specified output format.
Each value is expected to be iterable and the result of this method will produce the number of records equal to the longest iterable.
A TextWritingException
will be thrown if no RowWriterProcessor
is provided by CommonWriterSettings.getRowWriterProcessor()
.
K
- the key typeI
- the iterable typerowData
- the map whose values will be used to generate a List
of String
.List
of formatted String
, each String
representing one successful iteration over at least one
element of the iterators in the map.public final <K,I extends Iterable<?>> void processRecords(Map<K,I> rowData)
RowWriterProcessor
provided by CommonWriterSettings.getRowWriterProcessor()
,
then writes all values to the output .
The output will remain open for further write operations.
A TextWritingException
will be thrown if no RowWriterProcessor
is provided by CommonWriterSettings.getRowWriterProcessor()
.
K
- the key typeI
- the iterable typerowData
- the map whose values will be used to generate a number of output recordspublic final <K,I extends Iterable<?>> List<String> processRecordsToString(Map<K,String> headerMapping, Map<K,I> rowData)
RowWriterProcessor
provided by CommonWriterSettings.getRowWriterProcessor()
and writes the result into a List
of String
formatted to according to the specified output format.
Each value is expected to be iterable and the result of this method will produce the number of records equal to the longest iterable.
A TextWritingException
will be thrown if no RowWriterProcessor
is provided by CommonWriterSettings.getRowWriterProcessor()
.
K
- the key typeI
- the iterable typeheaderMapping
- a mapping associating the keys of the input map to their corresponding header names.rowData
- the map whose values will be used to generate a List
of String
.List
of formatted String
, each String
representing one successful iteration over at least one
element of the iterators in the map.public final <K,I extends Iterable<?>> void processRecords(Map<K,String> headerMapping, Map<K,I> rowData)
RowWriterProcessor
provided by CommonWriterSettings.getRowWriterProcessor()
,
then writes all values to the output .
The output will remain open for further write operations.
A TextWritingException
will be thrown if no RowWriterProcessor
is provided by CommonWriterSettings.getRowWriterProcessor()
.
K
- the key typeI
- the iterable typeheaderMapping
- a mapping associating the keys of the input map to their corresponding header names.rowData
- the map whose values will be used to generate a number of output recordspublic final <K> List<String> processObjectRecordsToString(Map<K,Object[]> rowData)
RowWriterProcessor
provided by CommonWriterSettings.getRowWriterProcessor()
and writes the result into a List
of String
formatted to according to the specified output format.
Each value is expected to be iterable and the result of this method will produce the number of records equal to the longest iterable.
A TextWritingException
will be thrown if no RowWriterProcessor
is provided by CommonWriterSettings.getRowWriterProcessor()
.
K
- the key typerowData
- the map whose values will be used to generate a List
of String
.List
of formatted String
, each String
representing one successful iteration over at least one
element of the iterators in the map.public final <K> List<String> processObjectRecordsToString(Map<K,String> headerMapping, Map<K,Object[]> rowData)
RowWriterProcessor
provided by CommonWriterSettings.getRowWriterProcessor()
and writes the result into a List
of String
formatted to according to the specified output format.
Each value is expected to be iterable and the result of this method will produce the number of records equal to the longest iterable.
A TextWritingException
will be thrown if no RowWriterProcessor
is provided by CommonWriterSettings.getRowWriterProcessor()
.
K
- the key typeheaderMapping
- a mapping associating the keys of the input map to their corresponding header names.rowData
- the map whose values will be used to generate a List
of String
.List
of formatted String
, each String
representing one successful iteration over at least one
element of the iterators in the map.public final <K> void processObjectRecords(Map<K,String> headerMapping, Map<K,Object[]> rowData)
RowWriterProcessor
provided by CommonWriterSettings.getRowWriterProcessor()
,
then writes all values to the output .
The output will remain open for further write operations.
A TextWritingException
will be thrown if no RowWriterProcessor
is provided by CommonWriterSettings.getRowWriterProcessor()
.
K
- the key typeheaderMapping
- a mapping associating the keys of the input map to their corresponding header names.rowData
- the map whose values will be used to generate a number of output recordspublic final <K> void processObjectRecordsAndClose(Map<K,String> headerMapping, Map<K,Object[]> rowData)
RowWriterProcessor
provided by CommonWriterSettings.getRowWriterProcessor()
,
then writes all values to the output and closes the writer.
A TextWritingException
will be thrown if no RowWriterProcessor
is provided by CommonWriterSettings.getRowWriterProcessor()
.
K
- the key typeheaderMapping
- a mapping associating the keys of the input map to their corresponding header names.rowData
- the map whose values will be used to generate a number of output recordspublic final <K> void processObjectRecordsAndClose(Map<K,Object[]> rowData)
RowWriterProcessor
provided by CommonWriterSettings.getRowWriterProcessor()
,
then writes all values to the output and closes the writer.
A TextWritingException
will be thrown if no RowWriterProcessor
is provided by CommonWriterSettings.getRowWriterProcessor()
.
K
- the key typerowData
- the map whose values will be used to generate a number of output recordspublic final <K,I extends Iterable<?>> void processRecordsAndClose(Map<K,String> headerMapping, Map<K,I> rowData)
RowWriterProcessor
provided by CommonWriterSettings.getRowWriterProcessor()
,
then writes all values to the output and closes the writer.
Each value is expected to be iterable and the result of this method will produce the number of records equal to the longest iterable.
A new record will be created each time at least one Iterator.hasNext()
returns true
. Null
will be written
when a iterator has been fully read.
A TextWritingException
will be thrown if no RowWriterProcessor
is provided by CommonWriterSettings.getRowWriterProcessor()
.
K
- the key typeI
- the iterable typeheaderMapping
- a mapping associating the keys of the input map to their corresponding header names.rowData
- the map whose values will be used to generate a number of output recordspublic final <K,I extends Iterable<?>> void processRecordsAndClose(Map<K,I> rowData)
RowWriterProcessor
provided by CommonWriterSettings.getRowWriterProcessor()
,
then writes all values to the output and closes the writer.
Each value is expected to be iterable and the result of this method will produce the number of records equal to the longest iterable.
A new record will be created each time at least one Iterator.hasNext()
returns true
. Null
will be written
when a iterator has been fully read.
A TextWritingException
will be thrown if no RowWriterProcessor
is provided by CommonWriterSettings.getRowWriterProcessor()
.
K
- the key typeI
- the iterable typerowData
- the map whose values will be used to generate a number of output recordsCopyright © 2023 uniVocity Software Pty Ltd. All rights reserved.