Top Description Fields Constructors Methods
com.opencsv

public Class CSVParserWriter

extends AbstractCSVWriter
Class Inheritance
Imports
java.io.IOException, .Writer

The CSVParserWriter is a replacement for the CSVWriter that allows you to pass in a ICSVParser to handle the task of converting a string array to a line of CSV data. This way you have the same class creating the data as reading it.
Author
Scott Conway
Since
4.2

Field Summary

Modifier and TypeField and Description
protected final ICSVParser
Inherited from com.opencsv.AbstractCSVWriter:
exception

Constructor Summary

AccessConstructor and Description
public
CSVParserWriter(Writer
- The writer to an underlying CSV source.
writer
,
ICSVParser
- ICSVParser to convert the String array to csv formatted string.
parser
,
String
- Desired line end String (either "\n" or "\r\n").
lineEnd
)

Constructor for the CSVParserWriter.

Method Summary

Modifier and TypeMethod and Description
protected void
writeNext(String[] nextLine, boolean applyQuotesToAll, Appendable appendable)

Implements abstract com.opencsv.AbstractCSVWriter.writeNext.

Writes the next line to the file.

Inherited from com.opencsv.AbstractCSVWriter:
checkErrorcloseflushgetExceptiongetLineEndgetWriterresetErrorresultServicesetResultServicewriteAllwriteAllwriteColumnNameswriteNext

Field Detail

parserback to summary
protected final ICSVParser parser

Constructor Detail

CSVParserWriterback to summary
public CSVParserWriter(Writer writer, ICSVParser parser, String lineEnd)

Constructor for the CSVParserWriter.

Parameters
writer:Writer

- The writer to an underlying CSV source.

parser:ICSVParser

- ICSVParser to convert the String array to csv formatted string.

lineEnd:String

- Desired line end String (either "\n" or "\r\n").

Method Detail

writeNextback to summary
protected void writeNext(String[] nextLine, boolean applyQuotesToAll, Appendable appendable) throws IOException

Implements abstract com.opencsv.AbstractCSVWriter.writeNext.

Doc from com.opencsv.AbstractCSVWriter.writeNext.

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).

Annotations
@Override
Exceptions
IOException:
Exceptions thrown by the writer supplied to CSVWriter.