org.apache.mahout.utils.vectors.io
Class TextualVectorWriter

java.lang.Object
  extended by org.apache.mahout.utils.vectors.io.TextualVectorWriter
All Implemented Interfaces:
Closeable, VectorWriter

public class TextualVectorWriter
extends Object
implements VectorWriter

Write out the vectors to any Writer using Vector.asFormatString(), one per line by default.


Constructor Summary
TextualVectorWriter(Writer writer)
           
 
Method Summary
 void close()
           
protected  Writer getWriter()
           
 long write(Iterable<Vector> iterable)
          Write all values in the Iterable to the output
 long write(Iterable<Vector> iterable, long maxDocs)
          Write the first maxDocs to the output.
 void write(Vector vector)
          Write out a vector
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TextualVectorWriter

public TextualVectorWriter(Writer writer)
Method Detail

getWriter

protected Writer getWriter()

write

public long write(Iterable<Vector> iterable)
           throws IOException
Description copied from interface: VectorWriter
Write all values in the Iterable to the output

Specified by:
write in interface VectorWriter
Parameters:
iterable - The Iterable to loop over
Returns:
the number of docs written
Throws:
IOException - if there was a problem writing

write

public long write(Iterable<Vector> iterable,
                  long maxDocs)
           throws IOException
Description copied from interface: VectorWriter
Write the first maxDocs to the output.

Specified by:
write in interface VectorWriter
Parameters:
iterable - The Iterable to loop over
maxDocs - the maximum number of docs to write
Returns:
The number of docs written
Throws:
IOException - if there was a problem writing

write

public void write(Vector vector)
           throws IOException
Description copied from interface: VectorWriter
Write out a vector

Specified by:
write in interface VectorWriter
Parameters:
vector - The Vector to write
Throws:
IOException

close

public void close()
           throws IOException
Specified by:
close in interface Closeable
Throws:
IOException


Copyright © 2008–2014 The Apache Software Foundation. All rights reserved.