org.supercsv.io
Interface ICsvListReader

All Known Implementing Classes:
CsvListReader

public interface ICsvListReader

Supertype for readers reading into lists.

Author:
Kasper B. Graversen

Method Summary
 void close()
          close the stream
 String get(int N)
          Get column N of the current line This is useful for parsing e.g. first column and react by reading the line on the basis of that first argument
 String[] getCSVHeader(boolean firstLineCheck)
          This method is used to get an optional header of the csv file and move the file curser to the first row containing data (the second row from the top) The header can subsequently be used as the nameMapper for read operations.
 int getLineNumber()
          gets the current position in the file.
 int length()
          returns the length of the current line
 List<String> read()
          Plain reading a line into a list of strings.
 List<String> read(CellProcessor... processors)
          Reading a line into a string array with the possibility to process the entries first (restricted by the fact that the values must fit into a List!
 org.supercsv.io.ICsvReader setPreferences(CsvPreference preference)
          Determine how the reader reads the input source.
 org.supercsv.io.ICsvReader setTokenizer(ITokenizer tokenizer)
          Determine how the reader reads the csv file.
 

Method Detail

read

List<String> read()
                  throws IOException
Plain reading a line into a list of strings. This is the traditional and hence very low-level approach to CSV file reading and consequently should be avoided.

Returns:
null if end-of-file or a list representing the read line *
Throws:
IOException
Since:
1.0

read

List<String> read(CellProcessor... processors)
                  throws IOException
Reading a line into a string array with the possibility to process the entries first (restricted by the fact that the values must fit into a List!

Parameters:
processors - An array of processors that processes each entry. null entries denotes no processing for that cell
Returns:
null if end-of-file or a list representing the read line
Throws:
IOException
Since:
1.0

close

void close()
           throws IOException
close the stream

Throws:
IOException

get

String get(int N)
           throws IOException,
                  IndexOutOfBoundsException
Get column N of the current line This is useful for parsing e.g. first column and react by reading the line on the basis of that first argument

Throws:
IOException
IndexOutOfBoundsException
Since:
1.0

getCSVHeader

String[] getCSVHeader(boolean firstLineCheck)
                      throws IOException
This method is used to get an optional header of the csv file and move the file curser to the first row containing data (the second row from the top) The header can subsequently be used as the nameMapper for read operations.

Parameters:
firstLineCheck - denotes whether a check should be made to ensure only the first line of the file can represent a header
Throws:
IOException - if an I/O error occurs or if the method is not called as the first read operation on a source. *
Since:
1.0

getLineNumber

int getLineNumber()
gets the current position in the file. The first line of the file is line number 1

Since:
1.0

length

int length()
           throws IOException
returns the length of the current line

Throws:
IOException
Since:
1.0

setPreferences

org.supercsv.io.ICsvReader setPreferences(CsvPreference preference)
Determine how the reader reads the input source.

Since:
1.0

setTokenizer

org.supercsv.io.ICsvReader setTokenizer(ITokenizer tokenizer)
Determine how the reader reads the csv file.

Since:
1.10