public class CSVWriter
extends java.lang.Object
implements java.io.Closeable
Modifier and Type | Field and Description |
---|---|
static char |
DEFAULT_ESCAPE_CHARACTER
The default character used for escaping quotes.
|
static java.lang.String |
DEFAULT_LINE_END
Default line terminator uses platform encoding.
|
static char |
DEFAULT_QUOTE_CHARACTER
The default quote character to use if none is supplied to the
constructor.
|
static char |
DEFAULT_SEPARATOR
The default separator to use if none is supplied to the constructor.
|
static char |
NO_ESCAPE_CHARACTER
The escape constant to use when you wish to suppress all escaping.
|
static char |
NO_QUOTE_CHARACTER
The quote constant to use when you wish to suppress all quoting.
|
Constructor and Description |
---|
CSVWriter(java.io.Writer writer)
Constructs CSVWriter using a comma for the separator.
|
CSVWriter(java.io.Writer writer,
char separator)
Constructs CSVWriter with supplied separator.
|
CSVWriter(java.io.Writer writer,
char separator,
char quotechar)
Constructs CSVWriter with supplied separator and quote char.
|
CSVWriter(java.io.Writer writer,
char separator,
char quotechar,
char escapechar)
Constructs CSVWriter with supplied separator and quote char.
|
CSVWriter(java.io.Writer writer,
char separator,
char quotechar,
char escapechar,
java.lang.String lineEnd)
Constructs CSVWriter with supplied separator and quote char.
|
CSVWriter(java.io.Writer writer,
char separator,
char quotechar,
java.lang.String lineEnd)
Constructs CSVWriter with supplied separator and quote char.
|
Modifier and Type | Method and Description |
---|---|
void |
close()
Close the underlying stream writer flushing any buffered content.
|
void |
writeNext(java.lang.String[] nextLine,
boolean quoteall)
Writes the next line to the file.
|
public static final char DEFAULT_ESCAPE_CHARACTER
public static final char NO_ESCAPE_CHARACTER
public static final char DEFAULT_SEPARATOR
public static final char DEFAULT_QUOTE_CHARACTER
public static final char NO_QUOTE_CHARACTER
public static final java.lang.String DEFAULT_LINE_END
public CSVWriter(java.io.Writer writer)
writer
- the writer to an underlying CSV source.public CSVWriter(java.io.Writer writer, char separator)
writer
- the writer to an underlying CSV source.separator
- the delimiter to use for separating entries.public CSVWriter(java.io.Writer writer, char separator, char quotechar)
writer
- the writer to an underlying CSV source.separator
- the delimiter to use for separating entriesquotechar
- the character to use for quoted elementspublic CSVWriter(java.io.Writer writer, char separator, char quotechar, char escapechar)
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 escapingpublic CSVWriter(java.io.Writer writer, char separator, char quotechar, java.lang.String lineEnd)
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 escapingpublic CSVWriter(java.io.Writer writer, char separator, char quotechar, char escapechar, java.lang.String lineEnd)
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 usepublic void writeNext(java.lang.String[] nextLine, boolean quoteall) throws java.io.IOException
nextLine
- a string array with each comma-separated element as a separate
entry.java.io.IOException
- if I/O error occurspublic void close() throws java.io.IOException
close
in interface java.io.Closeable
close
in interface java.lang.AutoCloseable
java.io.IOException
- if bad things happenCopyright © Copyright 2006-2019 The Scriptella Project Team.