com.elasticpath.persistence
Interface CsvFileReader

All Known Implementing Classes:
CsvFileReaderImpl

public interface CsvFileReader

Represent a csv file reader and writer.


Method Summary
 void close()
          Close the csv file.
 java.util.List getTopLines(int lines)
          Read the top lines with the give number.
 void open(java.lang.String csvFileName)
          Open a csv file.
 void open(java.lang.String csvFileName, char colDelimeter, char textQualifier)
          Open a csv file with the given column delimeter and text qualifier.
 java.lang.String[] readNext()
          Read the next line.
 

Method Detail

close

void close()
           throws EpPersistenceException
Close the csv file.

Throws:
EpPersistenceException - in case of any IO error happens

getTopLines

java.util.List getTopLines(int lines)
                           throws EpPersistenceException
Read the top lines with the give number. Notice: the file read cursor is moved to the line right after lines read.

Parameters:
lines - the number of lines to read
Returns:
a list contains top lines with the give number.
Throws:
EpPersistenceException - in case of error

open

void open(java.lang.String csvFileName)
          throws EpPersistenceException
Open a csv file.

Parameters:
csvFileName - the csv file name
Throws:
EpPersistenceException - if the given file doesn't exist

open

void open(java.lang.String csvFileName,
          char colDelimeter,
          char textQualifier)
          throws EpPersistenceException
Open a csv file with the given column delimeter and text qualifier.

Parameters:
csvFileName - the csv file name
colDelimeter - the column delimeter
textQualifier - the text qualifer
Throws:
EpPersistenceException - if the given file doesn't exist

readNext

java.lang.String[] readNext()
                            throws EpPersistenceException
Read the next line.

Returns:
the next line if it's available, otherwise null at the end of file
Throws:
EpPersistenceException - in case of any IO error happens