com.sparsity.sparksee.io
Class RowReader

java.lang.Object
  extended by com.sparsity.sparksee.io.RowReader
Direct Known Subclasses:
CSVReader

public class RowReader
extends java.lang.Object

RowReader interface.

Common interface for those readers which get the data as an string array.

It works as follows: perform as many read operations as necessary and call close once at the end. Once close is called no more read operations can be executed.

Check out the 'Data import' section in the SPARKSEE User Manual for more details on this.

Author:
Sparsity Technologies http://www.sparsity-technologies.com

Method Summary
 void close()
          Closes the reader.
 int getRow()
          The row number for the current row.
 boolean read(StringList row)
          Reads the next row as a string array.
 boolean reset()
          Moves the reader to the beginning.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

close

public void close()
           throws java.io.IOException
Closes the reader.

Throws:
java.io.IOException - If the close fails.

getRow

public int getRow()
           throws java.io.IOException
The row number for the current row.

Returns:
The current row number; 0 if there is no current row.
Throws:
java.io.IOException - If it fails.

reset

public boolean reset()
              throws java.io.IOException
Moves the reader to the beginning.

Restarts the reader.

Returns:
true if the reader can be restarted, false otherwise.
Throws:
java.io.IOException - If bad things happen during the restart.

read

public boolean read(StringList row)
             throws java.io.IOException
Reads the next row as a string array.

Parameters:
row - [out] A string list with each comma-separated element as a separate entry.
Returns:
Returns true if a row had been read or false otherwise.
Throws:
java.io.IOException - If bad things happen during the read.