Class CSVFileReader

  • All Implemented Interfaces:
    Closeable, AutoCloseable

    public class CSVFileReader
    extends CSVFile
    implements Closeable
    CSVFileReader is a class derived from CSVFile used to parse an existing CSV file.

    Adapted from a C++ original that is Copyright (C) 1999 Lucent Technologies.
    Excerpted from 'The Practice of Programming' by Brian Kernighan and Rob Pike.

    Included by permission of the Addison-Wesley web site, which says: "You may use this code for any purpose, as long as you leave the copyright notice and book citation attached".

    Version:
    %I%, %G%
    Author:
    Brian Kernighan and Rob Pike (C++ original), Ian F. Darwin (translation into Java and removal of I/O), Ben Ballard (rewrote handleQuotedField to handle double quotes and for readability), Fabrizio Fazzino (added integration with CSVFile, handling of variable textQualifier and Vector with explicit String type)
    • Method Detail

      • readFields

        public Vector<String> readFields()
                                  throws IOException
        Split the next line of the input CSV file into fields.

        This is currently the most important function of the package.

        Returns:
        Vector of strings containing each field from the next line of the file
        Throws:
        IOException - If an error occurs while reading the new line from the file