epfl.io
Class TagVectorWriter

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

public class TagVectorWriter
extends java.lang.Object
implements VectorWriter

A vector writer plugged on a tag writer


Constructor Summary
TagVectorWriter(TagWriter out, java.lang.String streamName, int size, int capacity)
          Creates a new VectorWriter on the underlying TagWriter
TagVectorWriter(TagWriter out, java.lang.String streamName, int size, int capacity, TagWriter.Indent indent)
          Creates a new VectorWriter on the underlying TagWriter
 
Method Summary
 int capacity()
          Returns the stream capacity (number of vectors)
 void close()
          Closes the stream
 void flush()
          Flushes the stream
 int nWritten()
          Returns the number of vectors actually written
 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

TagVectorWriter

public TagVectorWriter(TagWriter out,
                       java.lang.String streamName,
                       int size,
                       int capacity,
                       TagWriter.Indent indent)
                throws java.io.IOException
Creates a new VectorWriter on the underlying TagWriter
Parameters:
out - the underlying TagWriter
indent - indentation in stream
streamName - the tag name enclosing the data to write
size - the stream size (vector size)
capacity - the stream capacity (number of vectors)
Throws:
java.io.IOException - if an IO error occurs

TagVectorWriter

public TagVectorWriter(TagWriter out,
                       java.lang.String streamName,
                       int size,
                       int capacity)
                throws java.io.IOException
Creates a new VectorWriter on the underlying TagWriter
Parameters:
out - the underlying TagWriter
streamName - the tag name enclosing the data to write
size - the stream size (vector size)
capacity - the stream capacity (number of vectors)
Throws:
java.io.IOException - if an IO error occurs
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

capacity

public int capacity()
Returns the stream capacity (number of vectors)

nWritten

public int nWritten()
Returns the number of vectors actually written

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