JSci.io
Class TextReader

java.lang.Object
  extended by java.io.Reader
      extended by java.io.BufferedReader
          extended by JSci.io.TextReader
All Implemented Interfaces:
java.io.Closeable, java.lang.Readable

public final class TextReader
extends java.io.BufferedReader

TextReader: reads data text files/streams. This class uses buffered I/O.


Field Summary
 
Fields inherited from class java.io.Reader
lock
 
Constructor Summary
TextReader(java.io.File file)
          Reads a text file with the specified File object.
TextReader(java.io.Reader reader)
          Reads text data from a reader.
TextReader(java.lang.String name)
          Reads a text file with the specified system dependent file name.
 
Method Summary
 void read(AbstractDoubleMatrix m)
          Reads data into a matrix.
 double[][] readArray()
          Reads data to an array.
 void readTable(AbstractDoubleMatrix m)
          Reads a (row,column,value) table into a matrix.
 
Methods inherited from class java.io.BufferedReader
close, mark, markSupported, read, read, readLine, ready, reset, skip
 
Methods inherited from class java.io.Reader
read, read
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TextReader

public TextReader(java.io.Reader reader)
Reads text data from a reader.


TextReader

public TextReader(java.lang.String name)
           throws java.io.FileNotFoundException
Reads a text file with the specified system dependent file name.

Parameters:
name - the system dependent file name.
Throws:
java.io.FileNotFoundException - If the file is not found.

TextReader

public TextReader(java.io.File file)
           throws java.io.FileNotFoundException
Reads a text file with the specified File object.

Parameters:
file - the file to be opened for reading.
Throws:
java.io.FileNotFoundException - If the file is not found.
Method Detail

readArray

public double[][] readArray()
                     throws java.io.IOException
Reads data to an array. Autodetects the delimiter.

Throws:
java.io.IOException - If an I/O error occurs.

read

public void read(AbstractDoubleMatrix m)
          throws java.io.IOException
Reads data into a matrix. Autodetects the delimiter.

Throws:
java.io.IOException - If an I/O error occurs.

readTable

public void readTable(AbstractDoubleMatrix m)
               throws java.io.IOException
Reads a (row,column,value) table into a matrix. Autodetects the delimiter.

Throws:
java.io.IOException - If an I/O error occurs.