epfl.io
Class VectorSimplePeriodReader

java.lang.Object
  |
  +--epfl.io.VectorSimplePeriodReader
All Implemented Interfaces:
VectorReader

public class VectorSimplePeriodReader
extends java.lang.Object
implements VectorReader

A double vector periodic reader. The period is known and specified in constructor


Constructor Summary
VectorSimplePeriodReader(VectorReader in, int period)
          Creates a new periodic reader with the given period.
VectorSimplePeriodReader(VectorReader in, int period, boolean makePeriodicCopy)
          Creates a new periodic reader with the given period
 
Method Summary
 void close()
          Closes the stream
 int period()
          Returns the stream period
 double[] read()
          Reads a vector in stream
 int size()
          Returns the stream size (vector size)
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

VectorSimplePeriodReader

public VectorSimplePeriodReader(VectorReader in,
                                int period,
                                boolean makePeriodicCopy)
                         throws java.io.IOException
Creates a new periodic reader with the given period
Parameters:
in - the underlying vector reader
period - the reader period
makePeriodicCopy - flag saying if on each period a new vector is built
Throws:
java.io.IOException - if it can not read period vectors

VectorSimplePeriodReader

public VectorSimplePeriodReader(VectorReader in,
                                int period)
                         throws java.io.IOException
Creates a new periodic reader with the given period. Each period a new vector is built
Parameters:
in - the underlying vector reader
period - the reader period
Throws:
java.io.IOException - if it can not read period vectors
Method Detail

read

public double[] read()
              throws java.io.IOException
Reads a vector in stream
Specified by:
read in interface VectorReader
Throws:
java.io.IOException - if the stream is closed or if it is unable to read size doubles

size

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

period

public int period()
Returns the stream period
Specified by:
period in interface VectorReader
Following copied from interface: epfl.io.VectorReader
Returns:
0 if the stream is not periodic

close

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