Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.mwc.sqld.db
Class CSVFileReader

    java.lang.Object
      |
      +--com.mwc.sqld.db.CSVFileReader

public class CSVFileReader
extends java.lang.Object

A class to encapsulate reading of CSV files.

Constructor Summary
`CSVFileReader(java.lang.String fileName, boolean firstLineIsNames)` Create a CSV file from a file name.

Method Summary
`void` | `close()` Close the CSV file.
`java.util.Enumeration` | `colNames()`
`java.lang.String` | `getValue(int index)` Get a value from the current record.
`java.lang.String` | `getValue(java.lang.String name)` Get a value from the current record.
`static void` | `main(java.lang.String[] args)` Test main entry point.
`void` | `open()` Open the CSV file for reading.
`boolean` | `readLine()` Read the next record.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### CSVFileReader

    public CSVFileReader(java.lang.String fileName,
                         boolean firstLineIsNames)

  Create a CSV file from a file name.
  Parameters:
    `fileName` - the file name.
    `firstLineIsNames` - is the first line of the CSV file the names of the colums.

Method Detail

### colNames

    public java.util.Enumeration colNames()

### open

    public void open()
              throws java.io.IOException

  Open the CSV file for reading.

### close

    public void close()
               throws java.io.IOException

  Close the CSV file.

### readLine

    public boolean readLine()
                     throws java.io.IOException

  Read the next record.
  Returns:
    true if the line was read; else false is returned.

### getValue

    public java.lang.String getValue(int index)

  Get a value from the current record.
  Parameters:
    `index` - the zero based index of the field.
  Returns:
    the value or null if the index is out of bounds.

### getValue

    public java.lang.String getValue(java.lang.String name)

  Get a value from the current record.
  Parameters:
    `name` - the name of a field.
  Returns:
    the value or null if the index is out of bounds.

### main

    public static void main(java.lang.String[] args)
                     throws java.io.IOException

  Test main entry point.

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD