Package org.openforis.commons.io.csv
Class CsvWriter
- java.lang.Object
-
- org.openforis.commons.io.csv.CsvProcessor
-
- org.openforis.commons.io.flat.FlatDataWriter
-
- org.openforis.commons.io.csv.CsvWriter
-
- All Implemented Interfaces:
Closeable,AutoCloseable
public class CsvWriter extends FlatDataWriter
- Author:
- G. Miceli, S. Ricci
-
-
Field Summary
-
Fields inherited from class org.openforis.commons.io.flat.FlatDataWriter
headersWritten, linesWritten
-
-
Constructor Summary
Constructors Constructor Description CsvWriter(OutputStream out)Constructs the writer using the specifiedOutputStreamto write the CSV file.CsvWriter(OutputStream out, String charsetName)Constructs the writer using the specifiedOutputStreamand 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)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()voidflush()protected voidwriteNextInternal(Object[] values)-
Methods inherited from class org.openforis.commons.io.flat.FlatDataWriter
getLinesWritten, isHeadersWritten, writeAll, writeHeaders, writeHeaders, writeNext, writeNext, writeNext
-
Methods inherited from class org.openforis.commons.io.csv.CsvProcessor
getDateFormat, getFieldNames, getFields, setDateFormat, setDateFormat, setFieldNames, setFields, setFields
-
-
-
-
Constructor Detail
-
CsvWriter
public CsvWriter(Writer writer)
-
CsvWriter
public CsvWriter(OutputStream out) throws UnsupportedEncodingException
Constructs the writer using the specifiedOutputStreamto write the CSV file. The default charset encoding will be UTF_8- Throws:
UnsupportedEncodingException
-
CsvWriter
public CsvWriter(OutputStream out, String charsetName) throws UnsupportedEncodingException
Constructs the writer using the specifiedOutputStreamand the specified charset encoding to write the CSV file.- Throws:
UnsupportedEncodingException
-
CsvWriter
public CsvWriter(OutputStream out, String charsetName, char separator, char quotechar) throws UnsupportedEncodingException
- Throws:
UnsupportedEncodingException
-
CsvWriter
public CsvWriter(Writer writer, char separator, char quoteChar)
-
-
Method Detail
-
writeNextInternal
protected void writeNextInternal(Object[] values)
- Specified by:
writeNextInternalin classFlatDataWriter
-
flush
public void flush() throws IOException- Specified by:
flushin classFlatDataWriter- Throws:
IOException
-
close
public void close() throws IOException- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Specified by:
closein classFlatDataWriter- Throws:
IOException
-
-