Package csv
Interface TableWriter
- All Known Implementing Classes:
AbstractStreamTableWriter,AbstractTableWriter,CSVWriter,ExcelWriter,HtmlWriter,XmlWriter
public interface TableWriter
Introduces an interface for other implementations
of table writing interfaces.
- Author:
- RalphSchuster
-
Method Summary
Modifier and Type Method Description voidclose()Closes the writer.voidprintComment(java.lang.String comment)Prints a comment into the stream.voidprintComment(java.lang.String comment, int row, int column)Prints a comment into the stream.voidprintRow(java.lang.Object[] columns)Prints the columns into the table writer.voidprintRow(java.util.Collection<?> columns)Prints a single row into the CSV stream.voidprintRow(java.util.Iterator<?> columns)Prints a new row into the CSV stream.voidprintRow(java.util.Iterator<?> columns, int size)Prints a single row into the CSV stream.
-
Method Details
-
printRow
void printRow(java.lang.Object[] columns) throws java.io.IOExceptionPrints the columns into the table writer.- Parameters:
columns- columns to be written in row- Throws:
java.io.IOException- when an exception occurs
-
printRow
void printRow(java.util.Collection<?> columns) throws java.io.IOExceptionPrints a single row into the CSV stream. The columns are written to the CSV stream as the are delivered by the collection's iterator.- Parameters:
columns- collection of column values. An iterator will be used to retrieve values from the collection.- Throws:
java.io.IOException- when an exception occurs
-
printRow
void printRow(java.util.Iterator<?> columns, int size) throws java.io.IOExceptionPrints a single row into the CSV stream. The columns are written to the CSV stream as delivered by the iterator.- Parameters:
columns- iterator that returns column values.size- number of values to retrieve from iterator. Method will abort at this size.- Throws:
java.io.IOException- when an exception occurs
-
printRow
void printRow(java.util.Iterator<?> columns) throws java.io.IOExceptionPrints a new row into the CSV stream. The columns are written to the CSV stream as delivered by the iterator.- Parameters:
columns- iterator that returns column values.- Throws:
java.io.IOException- when an exception occurs
-
printComment
void printComment(java.lang.String comment) throws java.io.IOExceptionPrints a comment into the stream. Note that not all implementations support comments.- Parameters:
comment- comment to write- Throws:
java.io.IOException- when an exception occurs
-
printComment
void printComment(java.lang.String comment, int row, int column) throws java.io.IOExceptionPrints a comment into the stream. Note that not all implementations support comments.- Parameters:
comment- comment to writerow- index of row for commentcolumn- index of column for comment- Throws:
java.io.IOException- when an exception occurs
-
close
void close()Closes the writer.
-