|
BeanIO 1.2.3 | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.beanio.stream.csv.CsvWriter
public class CsvWriter
A CsvWriter is used to format and write records, of String arrays, to a CSV output stream. Using default settings, the CSV format supported is defined by specification RFC 4180.
The writer also supports the following customizations:
| Constructor Summary | |
|---|---|
CsvWriter(Writer out)
Constructs a new CsvWriter using default settings according the RFC 4180 specification. |
|
CsvWriter(Writer out,
boolean alwaysQuote,
char escapeCharacter)
Constructs a new CsvWriter. |
|
CsvWriter(Writer out,
char delimiter,
char quote,
boolean alwaysQuote,
char escapeCharacter,
String lineSeparator)
Constructs a new CsvWriter. |
|
| Method Summary | |
|---|---|
void |
close()
Closes the output stream. |
void |
flush()
Flushes the output stream. |
int |
getLineNumber()
Returns the last line number written to the output stream. |
void |
write(Object value)
Writes a record object to this output stream. |
void |
write(String[] record)
Formats and writes a record to this output stream. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public CsvWriter(Writer out)
out - the output stream to write to
public CsvWriter(Writer out,
boolean alwaysQuote,
char escapeCharacter)
out - the output stream to write toalwaysQuote - set to true if all fields are always quoted, otherwise
a field is only quoted if it contains a quotation mark, delimiter, new line
or carriage returnescapeCharacter - the character used to escape quotation marks and itself
in the output
public CsvWriter(Writer out,
char delimiter,
char quote,
boolean alwaysQuote,
char escapeCharacter,
String lineSeparator)
out - the output stream to write todelimiter - the field delimiterquote - the quotation markalwaysQuote - set to true if all fields are always quoted, otherwise
a field is only quoted if it contains a quotation mark, delimiter, line feed
or carriage returnescapeCharacter - the character used to escape quotation marks and itself
in the outputlineSeparator - the line termination character| Method Detail |
|---|
public int getLineNumber()
public void write(Object value)
throws IOException
RecordWriter
write in interface RecordWritervalue - the record object to write
IOException - if an I/O error occurs writing the record to the stream
public void write(String[] record)
throws IOException
record - the record to write
IOException - if an I/O error occurs
public void flush()
throws IOException
RecordWriter
flush in interface RecordWriterIOException - if an I/O error occurs flushing the stream
public void close()
throws IOException
RecordWriter
close in interface RecordWriterIOException - if an I/O error occurs closing the stream
|
BeanIO 1.2.3 | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||