org.encog.ml.data.versatile.sources

## Class CSVDataSource

- java.lang.Object
- - org.encog.ml.data.versatile.sources.CSVDataSource

- All Implemented Interfaces:
    VersatileDataSource

      public class CSVDataSource
      extends Object
      implements VersatileDataSource

  Allow a CSV file to serve as a source for the versatile data source.

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `CSVDataSource(File file, boolean headers, char delim)` Construct a CSV source from a filename.
    `CSVDataSource(File file, boolean headers, CSVFormat format)` Construct a CSV source from a filename.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `int` | `columnIndex(String name)` Obtain the column index for the specified name.
    `String[]` | `readLine()` Read a line from the source.
    `void` | `rewind()` Rewind the source back to the beginning.

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

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

- - ### Constructor Detail

    - #### CSVDataSource

          public CSVDataSource(File file,
                       boolean headers,
                       char delim)

      Construct a CSV source from a filename. The format parameter specifies the separator character to use, as well as the number format.
      Parameters:
        `filename` - The filename.
        `headers` - The headers.
        `delim` - The delimiter.

    - #### CSVDataSource

          public CSVDataSource(File file,
                       boolean headers,
                       CSVFormat format)

      Construct a CSV source from a filename. Allows a delimiter character to be specified.
      Parameters:
        `filename` - The filename.
        `headers` - The headers.
        `format` - The format.

  - ### Method Detail

    - #### readLine

          public String[] readLine()

      Read a line from the source.
      Specified by:
        `readLine` in interface `VersatileDataSource`
      Returns:
        The values read.

    - #### rewind

          public void rewind()

      Rewind the source back to the beginning.
      Specified by:
        `rewind` in interface `VersatileDataSource`

    - #### columnIndex

          public int columnIndex(String name)

      Obtain the column index for the specified name.
      Specified by:
        `columnIndex` in interface `VersatileDataSource`
      Parameters:
        `name` - The column name.
      Returns:
        The column index, or -1 if not found.

Copyright © 2014. All Rights Reserved.