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
    void close()
    Closes the writer.
    void printComment​(java.lang.String comment)
    Prints a comment into the stream.
    void printComment​(java.lang.String comment, int row, int column)
    Prints a comment into the stream.
    void printRow​(java.lang.Object[] columns)
    Prints the columns into the table writer.
    void printRow​(java.util.Collection<?> columns)
    Prints a single row into the CSV stream.
    void printRow​(java.util.Iterator<?> columns)
    Prints a new row into the CSV stream.
    void printRow​(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.IOException
      Prints 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.IOException
      Prints 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.IOException
      Prints 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.IOException
      Prints 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.IOException
      Prints 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.IOException
      Prints a comment into the stream. Note that not all implementations support comments.
      Parameters:
      comment - comment to write
      row - index of row for comment
      column - index of column for comment
      Throws:
      java.io.IOException - when an exception occurs
    • close

      void close()
      Closes the writer.