jcuda.utils
Class FileIO

java.lang.Object
  extended by jcuda.utils.FileIO

public class FileIO
extends java.lang.Object

File I/O functions, similar to the CUTIL file functions


Method Summary
static java.lang.String readFileAsString(java.lang.String filename)
          Read the contents of the file with the given name, and return it as a String
static byte[] readFileByte(java.lang.String filename)
          Reads the file with the given name containing byte data, and returns the contents of this file as an array
static double[] readFileDouble(java.lang.String filename)
          Reads the file with the given name containing double precision floating point data, and returns the contents of this file as an array
static float[] readFileFloat(java.lang.String filename)
          Reads the file with the given name containing single precision floating point data, and returns the contents of this file as an array
static int[] readFileInt(java.lang.String filename)
          Reads the file with the given name containing integer data, and returns the contents of this file as an array
static void writeFile(java.lang.String filename, byte[] data)
          Writes the given array into a file with the given name.
static void writeFile(java.lang.String filename, double[] data, double epsilon)
          Writes the given array into a file with the given name.
static void writeFile(java.lang.String filename, float[] data, float epsilon)
          Writes the given array into a file with the given name.
static void writeFile(java.lang.String filename, int[] data)
          Writes the given array into a file with the given name.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

readFileFloat

public static float[] readFileFloat(java.lang.String filename)
Reads the file with the given name containing single precision floating point data, and returns the contents of this file as an array

Parameters:
filename - The name of the file
Returns:
The contents of the file
Throws:
jcuda.CudaException - if the file could not be read

readFileDouble

public static double[] readFileDouble(java.lang.String filename)
Reads the file with the given name containing double precision floating point data, and returns the contents of this file as an array

Parameters:
filename - The name of the file
Returns:
The contents of the file
Throws:
jcuda.CudaException - if the file could not be read

readFileInt

public static int[] readFileInt(java.lang.String filename)
Reads the file with the given name containing integer data, and returns the contents of this file as an array

Parameters:
filename - The name of the file
Returns:
The contents of the file
Throws:
jcuda.CudaException - if the file could not be read

readFileByte

public static byte[] readFileByte(java.lang.String filename)
Reads the file with the given name containing byte data, and returns the contents of this file as an array

Parameters:
filename - The name of the file
Returns:
The contents of the file
Throws:
jcuda.CudaException - if the file could not be read

writeFile

public static void writeFile(java.lang.String filename,
                             float[] data,
                             float epsilon)
Writes the given array into a file with the given name.

Parameters:
filename - The name of the file
data - The data to write
epsilon - Epsilon for comparison
Throws:
jcuda.CudaException - if the file could not be written

writeFile

public static void writeFile(java.lang.String filename,
                             double[] data,
                             double epsilon)
Writes the given array into a file with the given name.

Parameters:
filename - The name of the file
data - The data to write
epsilon - Epsilon for comparison
Throws:
jcuda.CudaException - if the file could not be written

writeFile

public static void writeFile(java.lang.String filename,
                             int[] data)
Writes the given array into a file with the given name.

Parameters:
filename - The name of the file
data - The data to write
Throws:
jcuda.CudaException - if the file could not be written

writeFile

public static void writeFile(java.lang.String filename,
                             byte[] data)
Writes the given array into a file with the given name.

Parameters:
filename - The name of the file
data - The data to write
Throws:
jcuda.CudaException - if the file could not be written

readFileAsString

public static java.lang.String readFileAsString(java.lang.String filename)
Read the contents of the file with the given name, and return it as a String

Parameters:
filename - The name of the file
Returns:
The contents of the file
Throws:
jcuda.CudaException - If the file could not be read