Package scriptella.driver.csv.opencsv
Class CSVWriter
java.lang.Object
scriptella.driver.csv.opencsv.CSVWriter
- All Implemented Interfaces:
Closeable,AutoCloseable
A very simple CSV writer released under a commercial-friendly license.
- Author:
- Glen Smith, Fyodor Kupolov, Sean Summers
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final charThe default character used for escaping quotes.static final StringDefault line terminator uses platform encoding.static final charThe default quote character to use if none is supplied to the constructor.static final charThe default separator to use if none is supplied to the constructor.static final charThe escape constant to use when you wish to suppress all escaping.static final charThe quote constant to use when you wish to suppress all quoting. -
Constructor Summary
ConstructorsConstructorDescriptionConstructs CSVWriter using a comma for the separator.Constructs CSVWriter with supplied separator.Constructs CSVWriter with supplied separator and quote char.Constructs CSVWriter with supplied separator and quote char.Constructs CSVWriter with supplied separator and quote char.Constructs CSVWriter with supplied separator and quote char. -
Method Summary
-
Field Details
-
DEFAULT_ESCAPE_CHARACTER
public static final char DEFAULT_ESCAPE_CHARACTERThe default character used for escaping quotes.- See Also:
-
NO_ESCAPE_CHARACTER
public static final char NO_ESCAPE_CHARACTERThe escape constant to use when you wish to suppress all escaping.- See Also:
-
DEFAULT_SEPARATOR
public static final char DEFAULT_SEPARATORThe default separator to use if none is supplied to the constructor.- See Also:
-
DEFAULT_QUOTE_CHARACTER
public static final char DEFAULT_QUOTE_CHARACTERThe default quote character to use if none is supplied to the constructor.- See Also:
-
NO_QUOTE_CHARACTER
public static final char NO_QUOTE_CHARACTERThe quote constant to use when you wish to suppress all quoting.- See Also:
-
DEFAULT_LINE_END
Default line terminator uses platform encoding.- See Also:
-
-
Constructor Details
-
CSVWriter
Constructs CSVWriter using a comma for the separator.- Parameters:
writer- the writer to an underlying CSV source.
-
CSVWriter
Constructs CSVWriter with supplied separator.- Parameters:
writer- the writer to an underlying CSV source.separator- the delimiter to use for separating entries.
-
CSVWriter
Constructs CSVWriter with supplied separator and quote char.- Parameters:
writer- the writer to an underlying CSV source.separator- the delimiter to use for separating entriesquotechar- the character to use for quoted elements
-
CSVWriter
Constructs CSVWriter with supplied separator and quote char.- Parameters:
writer- the writer to an underlying CSV source.separator- the delimiter to use for separating entriesquotechar- the character to use for quoted elementsescapechar- the character to use for escaping
-
CSVWriter
Constructs CSVWriter with supplied separator and quote char.- Parameters:
writer- the writer to an underlying CSV source.separator- the delimiter to use for separating entriesquotechar- the character to use for quoted elementslineEnd- the line feed terminator to use
-
CSVWriter
Constructs CSVWriter with supplied separator and quote char.- Parameters:
writer- the writer to an underlying CSV source.separator- the delimiter to use for separating entriesquotechar- the character to use for quoted elementslineEnd- the line feed terminator to use
-
-
Method Details
-
writeNext
Writes the next line to the file.- Parameters:
nextLine- a string array with each comma-separated element as a separate entry.- Throws:
IOException- if I/O error occurs
-
close
Close the underlying stream writer flushing any buffered content.- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Throws:
IOException- if bad things happen
-