org.mymedialite.io
Class VectorExtensions

java.lang.Object
  extended by org.mymedialite.io.VectorExtensions

public class VectorExtensions
extends java.lang.Object

Tools for vector-like data


Method Summary
static IntList readIntVector(java.io.BufferedReader reader)
          Read a collection of ints from a TextReader object.
static DoubleList readVector(java.io.BufferedReader reader)
          Read a List of doubles from a BufferedReader object
static double[] readVectorArray(java.io.BufferedReader reader)
          Read an array of doubles from a BufferedReader object
static void writeVector(java.io.PrintWriter writer, java.util.Collection<?> vector)
          Write a Collection of doubles to a PrintWriter
static void writeVectorArray(java.io.PrintWriter writer, double[] vector)
          Write an array of doubles to a PrintWriter
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

writeVector

public static void writeVector(java.io.PrintWriter writer,
                               java.util.Collection<?> vector)
Write a Collection of doubles to a PrintWriter

Parameters:
writer - a
vector - a collection of double values

writeVectorArray

public static void writeVectorArray(java.io.PrintWriter writer,
                                    double[] vector)
Write an array of doubles to a PrintWriter

Parameters:
writer - a
vector - a collection of double values

readVector

public static DoubleList readVector(java.io.BufferedReader reader)
                             throws java.io.IOException
Read a List of doubles from a BufferedReader object

Parameters:
reader - the to read from
Returns:
a collection of double values
Throws:
java.io.IOException

readVectorArray

public static double[] readVectorArray(java.io.BufferedReader reader)
                                throws java.io.IOException
Read an array of doubles from a BufferedReader object

Parameters:
reader - the to read from
Returns:
a collection of double values
Throws:
java.io.IOException

readIntVector

public static IntList readIntVector(java.io.BufferedReader reader)
                             throws java.io.IOException
Read a collection of ints from a TextReader object.

Parameters:
reader - the BufferedReader to read from
Returns:
a list of int values
Throws:
java.io.IOException
java.lang.NumberFormatException