View Javadoc
1   package org.csveed.row;
2   
3   import java.util.List;
4   
5   import org.csveed.api.Header;
6   import org.csveed.api.Row;
7   
8   /**
9   * LineReaders reads rows from the CSV file and returns those all at once, or one by one if desired.
10  * @author Robert Bor
11  */
12  public interface RowReader {
13  
14      /**
15      * Reads all rows from the file and returns them as a List. After this, the RowReader will be finished
16      * @return all Rows read from the Reader
17      */
18      List<Row> readRows();
19  
20      /**
21      * Reads a single row from the file and returns this. The RowReader will keep track of its state.
22      * @return Row read from the Reader
23      */
24      Row readRow();
25  
26      /**
27      * Returns the line from which the row was read. Note that a line is seen as a legitimate CSV row, not
28      * necessarily a printable line (unless multi-lines are used, these values are the same).
29      * @return current line number
30      */
31      int getCurrentLine();
32  
33      /**
34      * States whether the Reader is done with the file
35      * @return true if file is finished
36      */
37      boolean isFinished();
38  
39      /**
40      * Returns the first readable line of the CSV file as header, regardless if useHeader==true.
41      * @return header
42      */
43      Header readHeader();
44  
45      /**
46      * Returns the header of the CSV file. Only possibly returns a value when useHeader==true
47      * @return header or null if the useHeader==false
48      */
49      Header getHeader();
50  
51      /**
52      * The set of instructions for dealing with rows
53      * @return row instructions
54      */
55      RowInstructions getRowInstructions();
56  
57  }