de.vc.report.sources.csv

## Class CSVDataSource

- java.lang.Object
- - de.vc.report.DataSource
  - - de.vc.report.sources.csv.CSVDataSource

-     public class CSVDataSource
      extends DataSource

  The CSVDataSource delivers report data from a csv-file/stream. Each row of the csv file represents one report.

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `CSVDataSource(java.io.InputStream csvStream, java.lang.String[] keywords)` Creates a new data source from csv.
    `CSVDataSource(java.lang.String csvFile, java.lang.String[] keywords)` Creates a new data source from csv.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `addTableModel(CSVTableModel tableModel)` Adds a csv table model to this data source.
    `protected void` | `deliverData()`
    `char` | `getDelimiter()` Gets the delimiter of csv file.
    `void` | `setDelimiter(char delimiter)` Sets the delimiter of csv file.

    - ### Methods inherited from class de.vc.report.DataSource

      `deliver, getDataCount, getLogger`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### CSVDataSource

          public CSVDataSource(java.io.InputStream csvStream,
                       java.lang.String[] keywords)

      Creates a new data source from csv.
      Parameters:
        `csvStream` - CSV stream.
        `keywords` - Keywords of columns.

    - #### CSVDataSource

          public CSVDataSource(java.lang.String csvFile,
                       java.lang.String[] keywords)
                        throws java.io.IOException

      Creates a new data source from csv.
      Parameters:
        `csvFile` - CSV file.
        `keywords` - Keywords of columns.
      Throws:
        `java.io.IOException` - IOException is thrown if file is not found.

  - ### Method Detail

    - #### addTableModel

          public void addTableModel(CSVTableModel tableModel)

      Adds a csv table model to this data source. A csv table model is a little bit different to "normal" report table models because a table model must contain all columns of all reports.
      Parameters:
        `tableModel` - Table model.

    - #### deliverData

          protected void deliverData()
                              throws ReportException

      Specified by:
        `deliverData` in class `DataSource`
      Throws:
        `ReportException`

    - #### getDelimiter

          public char getDelimiter()

      Gets the delimiter of csv file.
      Returns:
        Delimiter of csv, is ',' by default.

    - #### setDelimiter

          public void setDelimiter(char delimiter)

      Sets the delimiter of csv file.
      Parameters:
        `delimiter` - Delimter of csv.

© 2003-2011 by Sascha Schmidt (vision-cloud.de). All Rights Reserved.