com.espertech.esperio.csv
Class CSVReader

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

public class CSVReader
extends java.lang.Object

A source that processes a CSV file and returns CSV records from that file.


Constructor Summary
CSVReader(AdapterInputSource adapterInputSource)
          Ctor.
 
Method Summary
 void close()
          Close the source and release the input source.
 boolean getAndClearIsReset()
          Return and set to false the isReset value, which is set to true whenever the CSVReader is reset.
 java.lang.String[] getNextRecord()
          Get the next record from the CSV file.
 boolean isResettable()
          Return true if this CSVReader supports the reset() method.
 void reset()
          Reset the source to the beginning of the file.
 void setIsUsingTitleRow(boolean isUsingTitleRow)
          Set the isUsingTitleRow value.
 void setLooping(boolean looping)
          Set the looping value.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CSVReader

public CSVReader(AdapterInputSource adapterInputSource)
          throws com.espertech.esper.client.EPException
Ctor.

Parameters:
adapterInputSource - - the source of the CSV file
Throws:
com.espertech.esper.client.EPException - in case of errors in reading the CSV file
Method Detail

close

public void close()
           throws com.espertech.esper.client.EPException
Close the source and release the input source.

Throws:
com.espertech.esper.client.EPException - in case of error in closing resources

getNextRecord

public java.lang.String[] getNextRecord()
                                 throws java.io.EOFException,
                                        com.espertech.esper.client.EPException
Get the next record from the CSV file.

Returns:
a string array containing the values of the record
Throws:
java.io.EOFException - in case no more records can be read (end-of-file has been reached and isLooping is false)
com.espertech.esper.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.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

© 2006-2016 EsperTech Inc.
All rights reserved.
Visit us at espertech.com