JSci.io
Class TextWriter

java.lang.Object
  extended by java.io.Writer
      extended by java.io.BufferedWriter
          extended by JSci.io.TextWriter
All Implemented Interfaces:
java.io.Closeable, java.io.Flushable, java.lang.Appendable

public final class TextWriter
extends java.io.BufferedWriter

TextWriter: writes data text files/streams. This class uses buffered I/O.


Field Summary
 
Fields inherited from class java.io.Writer
lock
 
Constructor Summary
TextWriter(java.io.File file, char ch)
          Writes to a text file with the specified File object.
TextWriter(java.lang.String name, char ch)
          Writes to a text file with the specified system dependent file name.
TextWriter(java.io.Writer writer, char ch)
          Writes text data to a writer.
 
Method Summary
 void write(AbstractDoubleMatrix matrix)
          Writes a matrix.
 void write(AbstractDoubleVector vector)
          Writes a vector as a row.
 void write(AbstractIntegerMatrix matrix)
          Writes a matrix.
 void write(AbstractIntegerVector vector)
          Writes a vector as a row.
 void write(double[] data)
          Writes an array of data as a row.
 void write(double[][] data)
          Writes an array of data.
 void write(int[] data)
          Writes an array of data as a row.
 void write(int[][] data)
          Writes an array of data.
 void writeDouble(double d)
           
 void writeInt(int i)
           
 void writeTable(AbstractDoubleMatrix matrix)
          Writes a matrix as a (row,column,value) table.
 
Methods inherited from class java.io.BufferedWriter
close, flush, newLine, write, write, write
 
Methods inherited from class java.io.Writer
append, append, append, write, write
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TextWriter

public TextWriter(java.io.Writer writer,
                  char ch)
Writes text data to a writer.


TextWriter

public TextWriter(java.lang.String name,
                  char ch)
           throws java.io.IOException
Writes to a text file with the specified system dependent file name.

Parameters:
name - the system dependent file name.
ch - the character that delimits data columns.
Throws:
java.io.IOException - If the file is not found.

TextWriter

public TextWriter(java.io.File file,
                  char ch)
           throws java.io.IOException
Writes to a text file with the specified File object.

Parameters:
file - the file to be opened for writing.
ch - the character that delimits data columns.
Throws:
java.io.IOException - If the file is not found.
Method Detail

writeDouble

public void writeDouble(double d)
                 throws java.io.IOException
Throws:
java.io.IOException

writeInt

public void writeInt(int i)
              throws java.io.IOException
Throws:
java.io.IOException

write

public void write(double[] data)
           throws java.io.IOException
Writes an array of data as a row.

Parameters:
data - the data to be written.
Throws:
java.io.IOException - If an I/O error occurs.

write

public void write(double[][] data)
           throws java.io.IOException
Writes an array of data.

Parameters:
data - the data to be written.
Throws:
java.io.IOException - If an I/O error occurs.

write

public void write(int[] data)
           throws java.io.IOException
Writes an array of data as a row.

Parameters:
data - the data to be written.
Throws:
java.io.IOException - If an I/O error occurs.

write

public void write(int[][] data)
           throws java.io.IOException
Writes an array of data.

Parameters:
data - the data to be written.
Throws:
java.io.IOException - If an I/O error occurs.

write

public void write(AbstractDoubleMatrix matrix)
           throws java.io.IOException
Writes a matrix.

Parameters:
matrix - the matrix to be written.
Throws:
java.io.IOException - If an I/O error occurs.

writeTable

public void writeTable(AbstractDoubleMatrix matrix)
                throws java.io.IOException
Writes a matrix as a (row,column,value) table. Zero elements are not written.

Parameters:
matrix - the matrix to be written.
Throws:
java.io.IOException - If an I/O error occurs.

write

public void write(AbstractIntegerMatrix matrix)
           throws java.io.IOException
Writes a matrix.

Parameters:
matrix - the matrix to be written.
Throws:
java.io.IOException - If an I/O error occurs.

write

public void write(AbstractDoubleVector vector)
           throws java.io.IOException
Writes a vector as a row.

Parameters:
vector - the vector to be written.
Throws:
java.io.IOException - If an I/O error occurs.

write

public void write(AbstractIntegerVector vector)
           throws java.io.IOException
Writes a vector as a row.

Parameters:
vector - the vector to be written.
Throws:
java.io.IOException - If an I/O error occurs.