public class CSVPrinter
extends java.lang.Object
implements java.io.Flushable, java.io.Closeable
Constructor and Description |
---|
CSVPrinter(java.lang.Appendable out,
CSVFormat format)
Creates a printer that will print values to the given stream following the CSVFormat.
|
Modifier and Type | Method and Description |
---|---|
void |
close() |
void |
flush()
Flushes the underlying stream.
|
void |
print(java.lang.Object value)
Prints the string as the next value on the line.
|
void |
printComment(java.lang.String comment)
Prints a comment on a new line among the delimiter separated values.
|
void |
println()
Outputs the line separator.
|
void |
printRecord(java.lang.Iterable<?> values)
Prints a single line of delimiter separated values.
|
void |
printRecord(java.lang.Object... values)
Prints a single line of delimiter separated values.
|
void |
printRecords(java.lang.Iterable<?> values)
Prints all the objects in the given collection.
|
void |
printRecords(java.lang.Object[] values)
Prints all the objects in the given array.
|
void |
printRecords(java.sql.ResultSet resultSet)
Prints all the objects in the given JDBC result set.
|
public CSVPrinter(java.lang.Appendable out, CSVFormat format)
out
- stream to which to print.format
- the CSV format. If null the default format is used (CSVFormat.DEFAULT
)java.lang.IllegalArgumentException
- thrown if the parameters of the format are inconsistentpublic void println() throws java.io.IOException
java.io.IOException
public void flush() throws java.io.IOException
flush
in interface java.io.Flushable
java.io.IOException
public void printRecord(java.lang.Object... values) throws java.io.IOException
values
- values to output.java.io.IOException
public void printRecord(java.lang.Iterable<?> values) throws java.io.IOException
values
- values to output.java.io.IOException
public void printComment(java.lang.String comment) throws java.io.IOException
comment
- the comment to outputjava.io.IOException
public void print(java.lang.Object value) throws java.io.IOException
value
- value to be output.java.io.IOException
- If an I/O error occurspublic void printRecords(java.lang.Object[] values) throws java.io.IOException
values
- the values to print.java.io.IOException
- If an I/O error occurspublic void printRecords(java.lang.Iterable<?> values) throws java.io.IOException
values
- the values to print.java.io.IOException
- If an I/O error occurspublic void printRecords(java.sql.ResultSet resultSet) throws java.sql.SQLException, java.io.IOException
resultSet
- result set
the values to print.java.io.IOException
- If an I/O error occursjava.sql.SQLException
public void close() throws java.io.IOException
close
in interface java.io.Closeable
close
in interface java.lang.AutoCloseable
java.io.IOException
This software is published under the BSD license. Copyright © 2003-${build.year}, CRIXP AG, Switzerland, All rights reserved. Use is subject to license terms.