edu.northwestern.at.utils.csv

## Class CSVFile

- java.lang.Object
- - edu.northwestern.at.utils.csv.CSVFile

- Direct Known Subclasses:
    CSVFileReader, CSVFileWriter

      public abstract class CSVFile
      extends java.lang.Object

  CSVFile handles files containing delimiter separated entries.

  This is the abstract base clase used by `CSVFileReader` and `CSVFileWriter`.

  The following simple example converts one CSV file into another that uses a different notation for field separator and text qualifier.

        import java.util.*;
        import java.io.*;

        public class CSVFileExample
        {
            public static void main( String[] args )
                throws FileNotFoundException,IOException
            {
                CSVFileReader in = new CSVFileReader("csv_in.txt", ';', '"');
                CSVFileWriter out = new CSVFileWriter("csv_out.txt", ',', '\'');

                List fields = in.readFields();

                while( fields != null )
                {
                    out.writeFields( fields );
                    fields = in.readFields();
                }

                in.close();
                out.close();
            }
        }

  Author:
    Fabrizio Fazzino

    Modified by Philip R. Burns at Northwestern University.

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected static char` | `DEFAULT_QUALIFIER` The default char used as text qualifier
    `protected static char` | `DEFAULT_SEPARATOR` The default char used as field separator.
    `protected char` | `qualifier` The current char used as text qualifier.
    `protected char` | `separator` The current char used as field separator.

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `CSVFile()` CSVFile constructor with the default field separator and text qualifier.
    `CSVFile(char separator)` CSVFile constructor with given field separator.
    `CSVFile(char separator, char qualifier)` CSVFile constructor with given field separator and text qualifier.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `char` | `getQualifier()` Get the current text qualifier.
    `char` | `getSeparator()` Get the current field separator.
    `void` | `setQualifier(char qualifier)` Set the text qualifier.
    `void` | `setSeparator(char separator)` Set the field separator.

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

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

- - ### Field Detail

    - #### DEFAULT_SEPARATOR

          protected static final char DEFAULT_SEPARATOR

      The default char used as field separator.
      See Also:
        Constant Field Values

    - #### DEFAULT_QUALIFIER

          protected static final char DEFAULT_QUALIFIER

      The default char used as text qualifier
      See Also:
        Constant Field Values

    - #### separator

          protected char separator

      The current char used as field separator.

    - #### qualifier

          protected char qualifier

      The current char used as text qualifier.

  - ### Constructor Detail

    - #### CSVFile

          public CSVFile()

      CSVFile constructor with the default field separator and text qualifier.

    - #### CSVFile

          public CSVFile(char separator)

      CSVFile constructor with given field separator.
      Parameters:
        `separator` - The field separator.

    - #### CSVFile

          public CSVFile(char separator,
                 char qualifier)

      CSVFile constructor with given field separator and text qualifier.
      Parameters:
        `separator` - The field separator to used.
        `qualifier` - The text qualifier to be use.

  - ### Method Detail

    - #### setSeparator

          public void setSeparator(char separator)

      Set the field separator.
      Parameters:
        `separator` - The field separator to use.

    - #### setQualifier

          public void setQualifier(char qualifier)

      Set the text qualifier.
      Parameters:
        `qualifier` - The new text qualifier to use.

    - #### getSeparator

          public char getSeparator()

      Get the current field separator.
      Returns:
        The char containing the current field separator

    - #### getQualifier

          public char getQualifier()

      Get the current text qualifier.
      Returns:
        The text qualifier character.