| Modifier and Type | Field and Description |
|---|---|
| protected volatile IOException | |
| private final String | |
| private ResultSetHelper | |
| private final Writer |
| Access | Constructor and Description |
|---|---|
| protected | AbstractCSVWriter(Writer
Writer used for output of csv data. writer, String String to append at end of data (either "\n" or "\r\n"). lineEnd)Constructor to initialize the common values. |
| Modifier and Type | Method and Description |
|---|---|
| public boolean | checkError()
Implements com. Flushes the buffer and checks to see if the there has been an error in the printstream. |
| public void | close()
Implements java. Closes this stream and releases any system resources associated with it. |
| public void | flush()
Implements java. Flushes this stream by writing any buffered output to the underlying stream. |
| public IOException | |
| protected final String | Returns: The line ending sequence, either "\n" or "\r\n".Retrieves the line ending sequence used when writing CSV data. |
| protected final Writer | |
| public void | resetError()
Implements com. Set the error back to null to be able to check for the next error
using |
| protected ResultSetHelper | |
| public void | setResultService(ResultSetHelper resultService)
Implements com. Sets the result service. |
| public void | writeAll(Iterable<String[]> allLines, boolean applyQuotesToAll)
Implements com. Writes iterable to a CSV file. |
| public int | writeAll(ResultSet rs, boolean includeColumnNames, boolean trim, boolean applyQuotesToAll)
Implements com. Writes the entire ResultSet to a CSV file. |
| protected void | writeColumnNames(ResultSet
ResultSet containing column names. rs, boolean Whether all header names should be quoted. applyQuotesToAll)Writes the column names. |
| public void | writeNext(String[] nextLine, boolean applyQuotesToAll)
Implements com. Writes the next line to the file. |
| protected abstract void | writeNext(String[]
a string array with each comma-separated element as a separate
entry. nextLine, boolean true if all values are to be quoted. false applies quotes only
to values which contain the separator, escape, quote or new line characters. applyQuotesToAll, Appendable Appendable used as buffer. appendable)Writes the next line to the file. |
| exception | back to summary |
|---|---|
| protected volatile IOException exception | |
| lineEnd | back to summary |
|---|---|
| private final String lineEnd | |
| resultService | back to summary |
|---|---|
| private ResultSetHelper resultService | |
| writer | back to summary |
|---|---|
| private final Writer writer | |
| AbstractCSVWriter | back to summary |
|---|---|
| protected AbstractCSVWriter(Writer writer, String lineEnd) Constructor to initialize the common values. | |
| checkError | back to summary |
|---|---|
| public boolean checkError() Implements com. Doc from com. Flushes the buffer and checks to see if the there has been an error in the printstream.
| |
| close | back to summary |
|---|---|
| public void close() throws IOException Implements java. Doc from java. Closes this stream and releases any system resources associated with it. If the stream is already closed then invoking this method has no effect. As noted in
| |
| flush | back to summary |
|---|---|
| public void flush() throws IOException Implements java. Doc from java. Flushes this stream by writing any buffered output to the underlying stream.
| |
| getException | back to summary |
|---|---|
| public IOException getException() Implements com. Doc from com. Get latest exception. Note This does not return exception which are caught by underlying writer (PrintWriter) or stream. If you are using this method then consider using a Writer class that throws exceptions.
| |
| getLineEnd | back to summary |
|---|---|
| protected final String getLineEnd() Retrieves the line ending sequence used when writing CSV data.
| |
| getWriter | back to summary |
|---|---|
| protected final Writer getWriter() Provides access to the writer used for outputting CSV data. | |
| resetError | back to summary |
|---|---|
| public void resetError() Implements com. Doc from com. Set the error back to null to be able to check for the next error
using
| |
| resultService | back to summary |
|---|---|
| protected ResultSetHelper resultService() Lazy resultSetHelper creation.
| |
| setResultService | back to summary |
|---|---|
| public void setResultService(ResultSetHelper resultService) Implements com. Doc from com. Sets the result service.
| |
| writeAll | back to summary |
|---|---|
| public void writeAll(Iterable<String[]> allLines, boolean applyQuotesToAll) Implements com. Doc from com. Writes iterable to a CSV file. The list is assumed to be a String[]
| |
| writeAll | back to summary |
|---|---|
| public int writeAll(ResultSet rs, boolean includeColumnNames, boolean trim, boolean applyQuotesToAll) throws SQLException, IOException Implements com. Doc from com. Writes the entire ResultSet to a CSV file. The caller is responsible for closing the ResultSet.
| |
| writeColumnNames | back to summary |
|---|---|
| protected void writeColumnNames(ResultSet rs, boolean applyQuotesToAll) throws SQLException Writes the column names.
| |
| writeNext | back to summary |
|---|---|
| public void writeNext(String[] nextLine, boolean applyQuotesToAll) Implements com. Doc from com. Writes the next line to the file.
| |
| writeNext | back to summary |
|---|---|
| protected abstract void writeNext(String[] nextLine, boolean applyQuotesToAll, Appendable appendable) throws IOException Writes the next line to the file. This method is a fail-fast method that will throw the IOException of the writer supplied to the CSVWriter (if the Writer does not handle the exceptions itself like the PrintWriter class).
| |