Package org.supercsv.io
Interface ICsvResultSetWriter
-
- All Superinterfaces:
java.lang.AutoCloseable
,java.io.Closeable
,java.io.Flushable
,ICsvWriter
- All Known Implementing Classes:
CsvResultSetWriter
public interface ICsvResultSetWriter extends ICsvWriter
Interface for CSV writers writing JDBCResultSet
- Since:
- 2.4.0
- Author:
- SingularityFX
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
write(java.sql.ResultSet resultSet)
Writes a JDBCResultSet
as a CSV file.void
write(java.sql.ResultSet resultSet, CellProcessor[] cellProcessors)
Writes a JDBCResultSet
as a CSV file.-
Methods inherited from interface org.supercsv.io.ICsvWriter
getLineNumber, getRowNumber, writeComment, writeHeader
-
-
-
-
Method Detail
-
write
void write(java.sql.ResultSet resultSet) throws java.sql.SQLException, java.io.IOException
Writes a JDBCResultSet
as a CSV file. Each column in CSV file corresponds to a column inResultSet
, column order is preserved. Column names in CSV file corresponds to column names stored inResultSetMetaData
.toString
will be called on each element prior to writing.- Parameters:
resultSet
- ResultSet containing the values to write- Throws:
java.sql.SQLException
- if a database access error occurs or this method is called on a closed result setjava.io.IOException
- if an I/O error occurredjava.lang.NullPointerException
- if resultSet is nullSuperCsvException
- if there was a general exception while writing- Since:
- 2.4.0
-
write
void write(java.sql.ResultSet resultSet, CellProcessor[] cellProcessors) throws java.sql.SQLException, java.io.IOException
Writes a JDBCResultSet
as a CSV file. Each column in CSV file corresponds to a column inResultSet
, column order is preserved. Column names in CSV file corresponds to column names stored inResultSetMetaData
.toString
will be called on each (processed) element prior to writing.- Parameters:
resultSet
- ResultSet containing the values to writecellProcessors
- 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). Anull
entry indicates no further processing is required (the value returned by toString() will be written as the column value).- Throws:
java.sql.SQLException
- if a database access error occurs or this method is called on a closed result setjava.io.IOException
- if an I/O error occurredjava.lang.NullPointerException
- if resultSet or cellProcessors is nullSuperCsvConstraintViolationException
- if a CellProcessor constraint failedSuperCsvException
- if there was a general exception while writing/processing- Since:
- 2.4.0
-
-