public class CsvWriter extends Object implements RecordWriter
The writer also supports the following customizations:
Constructor and Description |
---|
CsvWriter(Writer out)
Constructs a new CsvWriter using default settings.
|
CsvWriter(Writer out,
CsvParserConfiguration config)
Constructs a new CsvWriter.
|
Modifier and Type | Method and Description |
---|---|
void |
close()
Closes the output stream.
|
void |
flush()
Flushes the output stream.
|
int |
getLineNumber()
Returns the last line number written to the output stream.
|
void |
write(Object value)
Writes a record object to this output stream.
|
void |
write(String[] record)
Formats and writes a record to this output stream.
|
public CsvWriter(Writer out)
out
- the output stream to write topublic CsvWriter(Writer out, CsvParserConfiguration config)
out
- the output stream to write toconfig
- the CsvParserConfiguration
public int getLineNumber()
public void write(Object value) throws IOException
RecordWriter
write
in interface RecordWriter
value
- the record object to writeIOException
- if an I/O error occurs writing the record to the streampublic void write(String[] record) throws IOException
record
- the record to writeIOException
- if an I/O error occurspublic void flush() throws IOException
RecordWriter
flush
in interface RecordWriter
IOException
- if an I/O error occurs flushing the streampublic void close() throws IOException
RecordWriter
close
in interface RecordWriter
IOException
- if an I/O error occurs closing the stream