Class CSVReader

Object
CSVReader

public class CSVReader extends Object
This reader was implemented in practical 4, feel free to use that version.
  • Constructor Summary

    Constructors
    Constructor
    Description
    Basic overloaded constructor that assumes the first line should be skipped.
    CSVReader(String file, boolean skipHeader)
    A constructor that requires the name of the file to open
  • Method Summary

    Modifier and Type
    Method
    Description
    Reads a line (nextLine()) and splits it into a String array by the DELIMINATOR, if the line is empty it will also return null.
    boolean
    Checks to see if the fileScanner has more lines and returns the answer.

    Methods inherited from class Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • CSVReader

      public CSVReader(String file)
      Basic overloaded constructor that assumes the first line should be skipped.
      Parameters:
      file - name of file to read
    • CSVReader

      public CSVReader(String file, boolean skipHeader)
      A constructor that requires the name of the file to open
      Parameters:
      file - filename to read
      skipHeader - true to skip header, false if it is to be read
  • Method Details

    • getNext

      public List<String> getNext()
      Reads a line (nextLine()) and splits it into a String array by the DELIMINATOR, if the line is empty it will also return null.
      Returns:
      a String List if a line exits or null if not
    • hasNext

      public boolean hasNext()
      Checks to see if the fileScanner has more lines and returns the answer.
      Returns:
      true if the file scanner has more lines (hasNext())