Class CSVReader

java.lang.Object
com.espertech.esperio.csv.CSVReader

public class CSVReader extends Object
A source that processes a CSV file and returns CSV records from that file.
  • Constructor Details

    • CSVReader

      public CSVReader(AdapterInputSource adapterInputSource) throws com.espertech.esper.common.client.EPException
      Ctor.
      Parameters:
      adapterInputSource - - the source of the CSV file
      Throws:
      com.espertech.esper.common.client.EPException - in case of errors in reading the CSV file
  • Method Details

    • close

      public void close() throws com.espertech.esper.common.client.EPException
      Close the source and release the input source.
      Throws:
      com.espertech.esper.common.client.EPException - in case of error in closing resources
    • getNextRecord

      public String[] getNextRecord() throws EOFException, com.espertech.esper.common.client.EPException
      Get the next record from the CSV file.
      Returns:
      a string array containing the values of the record
      Throws:
      EOFException - in case no more records can be read (end-of-file has been reached and isLooping is false)
      com.espertech.esper.common.client.EPException - in case of error in reading the CSV file
    • setIsUsingTitleRow

      public void setIsUsingTitleRow(boolean isUsingTitleRow)
      Set the isUsingTitleRow value.
      Parameters:
      isUsingTitleRow - - true if the CSV file contains a valid title row
    • setLooping

      public void setLooping(boolean looping)
      Set the looping value.
      Parameters:
      looping - - true if processing should start over from the beginning after the end of the CSV file is reached
    • reset

      public void reset()
      Reset the source to the beginning of the file.
      Throws:
      com.espertech.esper.common.client.EPException - in case of errors in resetting the source
    • getAndClearIsReset

      public boolean getAndClearIsReset()
      Return and set to false the isReset value, which is set to true whenever the CSVReader is reset.
      Returns:
      isReset
    • isResettable

      public boolean isResettable()
      Return true if this CSVReader supports the reset() method.
      Returns:
      true if the underlying AdapterInputSource is resettable