Class CsvListWriter
java.lang.Object
org.supercsv.io.AbstractCsvWriter
org.supercsv.io.CsvListWriter
- All Implemented Interfaces:
Closeable, Flushable, AutoCloseable, ICsvListWriter, ICsvWriter
CsvListWriter is a simple writer capable of writing arrays and Lists to a CSV file.
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionCsvListWriter(Writer writer, CsvPreference preference) Constructs a new CsvListWriter with the supplied Writer and CSV preferences. -
Method Summary
Modifier and TypeMethodDescriptionvoidWrites a array of Objects as columns of a CSV file.voidWrites an array of strings as columns of a CSV file.voidWrites a List of Objects as columns of a CSV file.voidwrite(List<?> columns, CellProcessor[] processors) Writes a List of Objects as columns of a CSV file, performing any necessary processing beforehand.Methods inherited from class AbstractCsvWriter
close, flush, getLineNumber, getRowNumber, incrementRowAndLineNo, writeComment, writeHeader, writeRow, writeRow, writeRowMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface ICsvWriter
getLineNumber, getRowNumber, writeComment, writeHeader
-
Field Details
-
processedColumns
-
-
Constructor Details
-
CsvListWriter
Constructs a new CsvListWriter with the supplied Writer and CSV preferences. Note that the reader will be wrapped in a BufferedReader before accessed.- Parameters:
writer- the writerpreference- the CSV preferences- Throws:
NullPointerException- if writer or preference are null
-
-
Method Details
-
write
Writes a List of Objects as columns of a CSV file, performing any necessary processing beforehand. toString() will be called on each (processed) element prior to writing.- Specified by:
writein interfaceICsvListWriter- Parameters:
columns- the columns to writeprocessors- an array of CellProcessors used to further process data before it is written (each element in the processors array corresponds with a CSV column - the number of processors should match the number of columns). A null entry indicates no further processing is required (the value returned by toString() will be written as the column value).- Throws:
IOException- If an I/O error occurs
-
write
Writes a List of Objects as columns of a CSV file. toString() will be called on each element prior to writing.- Specified by:
writein interfaceICsvListWriter- Parameters:
columns- the columns to write- Throws:
IOException- If an I/O error occurs
-
write
Writes a array of Objects as columns of a CSV file. toString() will be called on each element prior to writing.- Specified by:
writein interfaceICsvListWriter- Parameters:
columns- the columns to write- Throws:
IOException- If an I/O error occurs
-
write
Writes an array of strings as columns of a CSV file.- Specified by:
writein interfaceICsvListWriter- Parameters:
columns- the columns to write- Throws:
IOException- If an I/O error occurs
-