T
- The type of the Record
instances being used.AutoCloseable
, HeaderAccessor<T>
, org.refcodes.io.RowWriter<T[]>
CsvRecordWriter
, CsvStringRecordWriter
public interface RecordWriter<T> extends org.refcodes.io.RowWriter<T[]>, HeaderAccessor<T>
RecordWriter
writes data.HeaderAccessor.HeaderBuilder<T extends HeaderAccessor.HeaderBuilder<?>>, HeaderAccessor.HeaderMutator<T>, HeaderAccessor.HeaderProperty<T>
Modifier and Type | Method | Description |
---|---|---|
void |
parseHeader(String... aHeader) |
|
void |
writeHeader() |
Writes the CSV header to the (standard) output (be it a Stream or a
File).
|
void |
writeHeader(String... aHeader) |
|
void |
writeHeader(Header<T> aHeader) |
Sets and writes the provided
Header to the (standard) output (be
it a Stream or a File). . |
void |
writeNext(Record<T> aRecord) |
Directly logs the provided
String instances to the (standard)
output. |
void |
writeNext(T... aRecord) |
Directly logs the provided
String instances to the (standard)
output. |
close
getHeader
void parseHeader(String... aHeader)
Header
from the provided String
. You
must have provided a ColumnFactory
for this operation to succeed.aHeader
- The header to be created.void writeHeader(String... aHeader)
Header
from the provided String
arguments and writes the CSV header to the (standard) output (be it a
Stream or a File). You must have provided a ColumnFactory
for
this operation to succeed.aHeader
- The header to be created.void writeHeader(Header<T> aHeader)
Header
to the (standard) output (be
it a Stream or a File). .aHeader
- The header to be created.void writeHeader()
Header
for this operation to
succeed.void writeNext(T... aRecord) throws IllegalArgumentException
String
instances to the (standard)
output.writeNext
in interface org.refcodes.io.RowWriter<T>
aRecord
- The String
instances to be logged.IllegalArgumentException
- thrown in case the provided objects do
not align with the header (as of HeaderAccessor.getHeader()
).void writeNext(Record<T> aRecord) throws ColumnMismatchException, HeaderMismatchException
String
instances to the (standard)
output.aRecord
- The String
instances to be logged.HeaderMismatchException
- Thrown in case there is a mismatch
between the given HeaderMismatchException
and the
Row
, i.e. the index for the given key in the header may
be out of index of the given row or the given key does not exist
in the Header
.ColumnMismatchException
- Thrown in case a value was found in the
e.g. in a Record
of the wrong type than specified by a
provided Column
(of for example a Header
).Copyright © 2021. All rights reserved.