public class CsvWriter extends Object implements Closeable
| Constructor and Description |
|---|
CsvWriter(OutputStream out)
Constructs the writer using the specified
OutputStream to write the CSV file. |
CsvWriter(OutputStream out,
String charsetName)
Constructs the writer using the specified
OutputStream and the specified charset encoding to write the CSV file. |
CsvWriter(OutputStream out,
String charsetName,
char separator,
char quotechar) |
CsvWriter(Writer writer) |
CsvWriter(Writer writer,
char separator,
char quotechar) |
| Modifier and Type | Method and Description |
|---|---|
void |
close() |
void |
flush() |
List<String> |
getColumnNames() |
DateFormat |
getDateFormat() |
long |
getLinesWritten() |
boolean |
isHeadersWritten() |
protected void |
setColumnNames(String[] headers) |
void |
setDateFormat(DateFormat dateFormat) |
void |
setDateFormat(String pattern) |
void |
writeAll(FlatDataStream in) |
void |
writeHeaders(List<String> headers) |
void |
writeHeaders(String[] headers) |
void |
writeNext(FlatRecord r) |
void |
writeNext(List<String> line) |
void |
writeNext(String[] line) |
public CsvWriter(Writer writer)
public CsvWriter(Writer writer, char separator, char quotechar)
public CsvWriter(OutputStream out) throws UnsupportedEncodingException
OutputStream to write the CSV file.
The default charset encoding will be UTF_8UnsupportedEncodingExceptionpublic CsvWriter(OutputStream out, String charsetName) throws UnsupportedEncodingException
OutputStream and the specified charset encoding to write the CSV file.UnsupportedEncodingExceptionpublic CsvWriter(OutputStream out, String charsetName, char separator, char quotechar) throws UnsupportedEncodingException
UnsupportedEncodingExceptionpublic void writeAll(FlatDataStream in) throws IOException
IOExceptionpublic void flush()
throws IOException
IOExceptionpublic void close()
throws IOException
close in interface Closeableclose in interface AutoCloseableIOExceptionpublic void writeNext(FlatRecord r)
public void writeNext(String[] line)
public void writeHeaders(String[] headers)
public long getLinesWritten()
public boolean isHeadersWritten()
public DateFormat getDateFormat()
public void setDateFormat(DateFormat dateFormat)
public void setDateFormat(String pattern)
protected void setColumnNames(String[] headers)
Copyright © 2020 Open Foris. All rights reserved.