epfl.io
Class VectorPrinter

java.lang.Object
  |
  +--epfl.io.VectorPrinter
All Implemented Interfaces:
VectorWriter

public class VectorPrinter
extends java.lang.Object
implements VectorWriter

A vector writer plugged on a PrintWriter. One vector per line is written.


Constructor Summary
VectorPrinter(java.io.PrintWriter out, int size)
          Creates a new vector printer
 
Method Summary
 void close()
          Closes the stream
 void flush()
          Flushes the stream
 int size()
          Returns the stream size (vector size)
 void write(double[] v)
          Writes a vector in stream
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

VectorPrinter

public VectorPrinter(java.io.PrintWriter out,
                     int size)
Creates a new vector printer
Parameters:
out - the underlying print writer
size - the output stream size (vector size)
Method Detail

write

public void write(double[] v)
           throws java.io.IOException
Writes a vector in stream
Specified by:
write in interface VectorWriter
Parameters:
v - vector to write; the vector is truncated if necessary, or completed with 0.0
Throws:
java.io.IOException - if an IO error occurs

size

public int size()
Returns the stream size (vector size)
Specified by:
size in interface VectorWriter

flush

public void flush()
           throws java.io.IOException
Flushes the stream
Specified by:
flush in interface VectorWriter
Throws:
java.io.IOException - if an IO error occurs

close

public void close()
           throws java.io.IOException
Closes the stream
Specified by:
close in interface VectorWriter
Throws:
java.io.IOException - if an IO error occurs