public class VectorIO extends Object
Vector
s and arrays to files in a
uniform manner.Modifier and Type | Method and Description |
---|---|
static double[] |
readDoubleArray(File f)
Read a double array from the specified file.
|
static String |
toString(double[] vector)
Convert a double array to a
String where values are separated by
spaces. |
static String |
toString(int[] vector)
Convert a integer array to a
String where values are separated by
spaces. |
static String |
toString(Vector vector)
Convert a
Vector to a String where values are separated
by spaces. |
static void |
writeVector(int[] vector,
File f)
Write the values of an integer array to the the specified
File . |
static void |
writeVector(int[] vector,
PrintWriter pw)
Write the values of an integer array to the destination stored by a
PrintWriter . |
static void |
writeVector(int[] vector,
String word,
File outputDir)
Creates a file using the provided word name in the given output
directory.
|
public static double[] readDoubleArray(File f) throws IOException
f
- A whitespace separated file of double values.f
.IOException
public static String toString(Vector vector)
Vector
to a String
where values are separated
by spaces.vector
- An Vector
of values to convert.String
representing vector
.public static String toString(double[] vector)
String
where values are separated by
spaces.vector
- An array of values to convert.String
representing vector
.public static String toString(int[] vector)
String
where values are separated by
spaces.vector
- An array of values to convert.String
representing vector
.public static void writeVector(int[] vector, PrintWriter pw) throws IOException
PrintWriter
.vector
- The integer array to write out.pw
- A PrintWriter
to write values to.IOException
public static void writeVector(int[] vector, File f) throws IOException
File
.vector
- The integer array to write out.f
- A PrintWriter
to write values to.IOException
public static void writeVector(int[] vector, String word, File outputDir) throws IOException
vector
- The integer array to write out.word
- The name of the file to write values to, with .vector as the
extension type.outputDir
- The directory where .vector will be created.IOException
Copyright © 2012. All Rights Reserved.