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".

%I%, %G%
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)
  • Constructor Details

  • Method Details

    • readFields

      public List<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.

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

      public void close() throws IOException
      Close the input CSV file.
      Specified by:
      close in interface AutoCloseable
      Specified by:
      close in interface Closeable
      IOException - If an error occurs while closing the file