jhplot.io
Class ArrayReaderWriter
- java.lang.Object
-
- jhplot.io.ArrayReaderWriter
-
public class ArrayReaderWriter extends java.lang.Object
Class for reading binary data from files to multidimensional arrays and writing binary data to files from multidimensional arrays. Copyright (C) 2005 Vincent Cheung (vincent@psi.toronto.edu, http://www.psi.toronto.edu/~vincent/) This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
-
-
Constructor Summary
Constructors Constructor and Description ArrayReaderWriter()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method and Description static java.io.BufferedOutputStream
getStream(java.lang.String filename)
Create a stream to the file specified by filename.static void
main(java.lang.String[] args)
static double[]
read1DArray(java.lang.String filename)
Reads an array from a file.static boolean[]
read1DBooleanArray(java.lang.String filename)
Reads an array from a file.static float[]
read1DFloatArray(java.lang.String filename)
Reads an array from a file.static int[]
read1DIntArray(java.lang.String filename)
Reads an array from a file.static double[][]
read2DArray(java.lang.String filename)
Reads a rectangular jagged array from a file.static boolean[][]
read2DBooleanArray(java.lang.String filename)
Reads a rectangular jagged array from a file.static float[][]
read2DFloatArray(java.lang.String filename)
Reads a rectangular jagged array from a file.static int[][]
read2DIntArray(java.lang.String filename)
Reads a rectangular jagged array from a file.static double[][][]
read3DArray(java.lang.String filename)
Reads a rectangular jagged array from a file.static boolean[][][]
read3DBooleanArray(java.lang.String filename)
Reads a rectangular jagged array from a file.static float[][][]
read3DFloatArray(java.lang.String filename)
Reads a rectangular jagged array from a file.static int[][][]
read3DIntArray(java.lang.String filename)
Reads a rectangular jagged array from a file.static double[][][][]
read4DArray(java.lang.String filename)
Reads a rectangular jagged array from a file.static boolean[][][][]
read4DBooleanArray(java.lang.String filename)
Reads a rectangular jagged array from a file.static float[][][][]
read4DFloatArray(java.lang.String filename)
Reads a rectangular jagged array from a file.static int[][][][]
read4DIntArray(java.lang.String filename)
Reads a rectangular jagged array from a file.static double[][][][][]
read5DArray(java.lang.String filename)
Reads a rectangular jagged array from a file.static boolean[][][][][]
read5DBooleanArray(java.lang.String filename)
Reads a rectangular jagged array from a file.static float[][][][][]
read5DFloatArray(java.lang.String filename)
Reads a rectangular jagged array from a file.static int[][][][][]
read5DIntArray(java.lang.String filename)
Reads a rectangular jagged array from a file.static void
write(boolean[][][][][] array, java.lang.String filename)
Writes a rectangular jagged array to a file.static void
write(boolean[][][][] array, java.lang.String filename)
Writes a rectangular jagged array to a file.static void
write(boolean[][][] array, java.lang.String filename)
Writes a rectangular jagged array to a file.static void
write(boolean[][] array, java.lang.String filename)
Writes a rectangular jagged array to a file.static void
write(boolean[] array, java.lang.String filename)
Writes an array to a file.static void
write(double[][][][][] array, java.lang.String filename)
Writes a rectangular jagged array to a file.static void
write(double[][][][] array, java.lang.String filename)
Writes a rectangular jagged array to a file.static void
write(double[][][] array, java.lang.String filename)
Writes a rectangular jagged array to a file.static void
write(double[][] array, java.lang.String filename)
Writes a rectangular jagged array to a file.static void
write(double[] array, java.lang.String filename)
Writes an array to a file.static void
write(float[][][][][] array, java.lang.String filename)
Writes a rectangular jagged array to a file.static void
write(float[][][][] array, java.lang.String filename)
Writes a rectangular jagged array to a file.static void
write(float[][][] array, java.lang.String filename)
Writes a rectangular jagged array to a file.static void
write(float[][] array, java.lang.String filename)
Writes a rectangular jagged array to a file.static void
write(float[] array, java.lang.String filename)
Writes an array to a file.static void
write(int[][][][][] array, java.lang.String filename)
Writes a rectangular jagged array to a file.static void
write(int[][][][] array, java.lang.String filename)
Writes a rectangular jagged array to a file.static void
write(int[][][] array, java.lang.String filename)
Writes a rectangular jagged array to a file.static void
write(int[][] array, java.lang.String filename)
Writes a rectangular jagged array to a file.static void
write(int[] array, java.lang.String filename)
Writes an array to a file.
-
-
-
Method Detail
-
write
public static void write(double[] array, java.lang.String filename) throws java.io.IOException
Writes an array to a file. The first four bytes (an integer) in the file indicate the number of dimensions of the array. The size of the array along each of the dimensions are then written as four bytes each (integers), note that the size along each of the dimensions must remain constant The rest of the file contains the array values (double values) The 64-bit IEEE 754 floating-point "double format" bit layout is used to write the byte representation of double values to the file. All values are written to the file in little endian form. If the file already exists, then it will be overwritten.- Parameters:
array
- the array to write to the filefilename
- the name of the file to write to- Throws:
java.io.IOException
-
write
public static void write(double[][] array, java.lang.String filename) throws java.io.IOException
Writes a rectangular jagged array to a file. The first four bytes (an integer) in the file indicate the number of dimensions of the array. The size of the array along each of the dimensions are then written as four bytes each (integers), note that the size along each of the dimensions must remain constant The rest of the file contains the array values (double values) The 64-bit IEEE 754 floating-point "double format" bit layout is used to write the byte representation of double values to the file. All values are written to the file in little endian form. If the file already exists, then it will be overwritten.- Parameters:
array
- the array to write to the filefilename
- the name of the file to write to- Throws:
java.io.IOException
-
write
public static void write(double[][][] array, java.lang.String filename) throws java.io.IOException
Writes a rectangular jagged array to a file. The first four bytes (an integer) in the file indicate the number of dimensions of the array. The size of the array along each of the dimensions are then written as four bytes each (integers), note that the size along each of the dimensions must remain constant The rest of the file contains the array values (double values) The 64-bit IEEE 754 floating-point "double format" bit layout is used to write the byte representation of double values to the file. All values are written to the file in little endian form. If the file already exists, then it will be overwritten.- Parameters:
array
- the array to write to the filefilename
- the name of the file to write to- Throws:
java.io.IOException
-
write
public static void write(double[][][][] array, java.lang.String filename) throws java.io.IOException
Writes a rectangular jagged array to a file. The first four bytes (an integer) in the file indicate the number of dimensions of the array. The size of the array along each of the dimensions are then written as four bytes each (integers), note that the size along each of the dimensions must remain constant The rest of the file contains the array values (double values) The 64-bit IEEE 754 floating-point "double format" bit layout is used to write the byte representation of double values to the file. All values are written to the file in little endian form. If the file already exists, then it will be overwritten.- Parameters:
array
- the array to write to the filefilename
- the name of the file to write to- Throws:
java.io.IOException
-
write
public static void write(double[][][][][] array, java.lang.String filename) throws java.io.IOException
Writes a rectangular jagged array to a file. The first four bytes (an integer) in the file indicate the number of dimensions of the array. The size of the array along each of the dimensions are then written as four bytes each (integers), note that the size along each of the dimensions must remain constant The rest of the file contains the array values (double values) The 64-bit IEEE 754 floating-point "double format" bit layout is used to write the byte representation of double values to the file. All values are written to the file in little endian form. If the file already exists, then it will be overwritten.- Parameters:
array
- the array to write to the filefilename
- the name of the file to write to- Throws:
java.io.IOException
-
read1DArray
public static double[] read1DArray(java.lang.String filename) throws java.io.IOException
Reads an array from a file. The first four bytes (an integer) in the file indicate the number of dimensions of the array. The size of the array along each of the dimensions are then written as four bytes each (integers), note that the size along each of the dimensions must remain constant The rest of the file contains the array values (double values) The 64-bit IEEE 754 floating-point "double format" bit layout is used to write the byte representation of double values to the file. All values are written to the file in little endian form.- Parameters:
filename
- the name of the file containing the array- Returns:
- the array in the file
- Throws:
java.io.IOException
-
read2DArray
public static double[][] read2DArray(java.lang.String filename) throws java.io.IOException
Reads a rectangular jagged array from a file. The first four bytes (an integer) in the file indicate the number of dimensions of the array. The size of the array along each of the dimensions are then written as four bytes each (integers), note that the size along each of the dimensions must remain constant The rest of the file contains the array values (double values) The 64-bit IEEE 754 floating-point "double format" bit layout is used to write the byte representation of double values to the file. All values are written to the file in little endian form.- Parameters:
filename
- the name of the file containing the array- Returns:
- the array in the file
- Throws:
java.io.IOException
-
read3DArray
public static double[][][] read3DArray(java.lang.String filename) throws java.io.IOException
Reads a rectangular jagged array from a file. The first four bytes (an integer) in the file indicate the number of dimensions of the array. The size of the array along each of the dimensions are then written as four bytes each (integers), note that the size along each of the dimensions must remain constant The rest of the file contains the array values (double values) The 64-bit IEEE 754 floating-point "double format" bit layout is used to write the byte representation of double values to the file. All values are written to the file in little endian form.- Parameters:
filename
- the name of the file containing the array- Returns:
- the array in the file
- Throws:
java.io.IOException
-
read4DArray
public static double[][][][] read4DArray(java.lang.String filename) throws java.io.IOException
Reads a rectangular jagged array from a file. The first four bytes (an integer) in the file indicate the number of dimensions of the array. The size of the array along each of the dimensions are then written as four bytes each (integers), note that the size along each of the dimensions must remain constant The rest of the file contains the array values (double values) The 64-bit IEEE 754 floating-point "double format" bit layout is used to write the byte representation of double values to the file. All values are written to the file in little endian form.- Parameters:
filename
- the name of the file containing the array- Returns:
- the array in the file
- Throws:
java.io.IOException
-
read5DArray
public static double[][][][][] read5DArray(java.lang.String filename) throws java.io.IOException
Reads a rectangular jagged array from a file. The first four bytes (an integer) in the file indicate the number of dimensions of the array. The size of the array along each of the dimensions are then written as four bytes each (integers), note that the size along each of the dimensions must remain constant The rest of the file contains the array values (double values) The 64-bit IEEE 754 floating-point "double format" bit layout is used to write the byte representation of double values to the file. All values are written to the file in little endian form.- Parameters:
filename
- the name of the file containing the array- Returns:
- the array in the file
- Throws:
java.io.IOException
-
write
public static void write(float[] array, java.lang.String filename) throws java.io.IOException
Writes an array to a file. The first four bytes (an integer) in the file indicate the number of dimensions of the array. The size of the array along each of the dimensions are then written as four bytes each (integers), note that the size along each of the dimensions must remain constant The rest of the file contains the array values (double values) The 64-bit IEEE 754 floating-point "double format" bit layout is used to write the byte representation of double values to the file. All values are written to the file in little endian form. If the file already exists, then it will be overwritten.- Parameters:
array
- the array to write to the filefilename
- the name of the file to write to- Throws:
java.io.IOException
-
write
public static void write(float[][] array, java.lang.String filename) throws java.io.IOException
Writes a rectangular jagged array to a file. The first four bytes (an integer) in the file indicate the number of dimensions of the array. The size of the array along each of the dimensions are then written as four bytes each (integers), note that the size along each of the dimensions must remain constant The rest of the file contains the array values (double values) The 64-bit IEEE 754 floating-point "double format" bit layout is used to write the byte representation of double values to the file. All values are written to the file in little endian form. If the file already exists, then it will be overwritten.- Parameters:
array
- the array to write to the filefilename
- the name of the file to write to- Throws:
java.io.IOException
-
write
public static void write(float[][][] array, java.lang.String filename) throws java.io.IOException
Writes a rectangular jagged array to a file. The first four bytes (an integer) in the file indicate the number of dimensions of the array. The size of the array along each of the dimensions are then written as four bytes each (integers), note that the size along each of the dimensions must remain constant The rest of the file contains the array values (double values) The 64-bit IEEE 754 floating-point "double format" bit layout is used to write the byte representation of double values to the file. All values are written to the file in little endian form. If the file already exists, then it will be overwritten.- Parameters:
array
- the array to write to the filefilename
- the name of the file to write to- Throws:
java.io.IOException
-
write
public static void write(float[][][][] array, java.lang.String filename) throws java.io.IOException
Writes a rectangular jagged array to a file. The first four bytes (an integer) in the file indicate the number of dimensions of the array. The size of the array along each of the dimensions are then written as four bytes each (integers), note that the size along each of the dimensions must remain constant The rest of the file contains the array values (double values) The 64-bit IEEE 754 floating-point "double format" bit layout is used to write the byte representation of double values to the file. All values are written to the file in little endian form. If the file already exists, then it will be overwritten.- Parameters:
array
- the array to write to the filefilename
- the name of the file to write to- Throws:
java.io.IOException
-
write
public static void write(float[][][][][] array, java.lang.String filename) throws java.io.IOException
Writes a rectangular jagged array to a file. The first four bytes (an integer) in the file indicate the number of dimensions of the array. The size of the array along each of the dimensions are then written as four bytes each (integers), note that the size along each of the dimensions must remain constant The rest of the file contains the array values (double values) The 64-bit IEEE 754 floating-point "double format" bit layout is used to write the byte representation of double values to the file. All values are written to the file in little endian form. If the file already exists, then it will be overwritten.- Parameters:
array
- the array to write to the filefilename
- the name of the file to write to- Throws:
java.io.IOException
-
read1DFloatArray
public static float[] read1DFloatArray(java.lang.String filename) throws java.io.IOException
Reads an array from a file. The first four bytes (an integer) in the file indicate the number of dimensions of the array. The size of the array along each of the dimensions are then written as four bytes each (integers), note that the size along each of the dimensions must remain constant The rest of the file contains the array values (double values) The 64-bit IEEE 754 floating-point "double format" bit layout is used to write the byte representation of double values to the file. All values are written to the file in little endian form.- Parameters:
filename
- the name of the file containing the array- Returns:
- the array in the file
- Throws:
java.io.IOException
-
read2DFloatArray
public static float[][] read2DFloatArray(java.lang.String filename) throws java.io.IOException
Reads a rectangular jagged array from a file. The first four bytes (an integer) in the file indicate the number of dimensions of the array. The size of the array along each of the dimensions are then written as four bytes each (integers), note that the size along each of the dimensions must remain constant The rest of the file contains the array values (double values) The 64-bit IEEE 754 floating-point "double format" bit layout is used to write the byte representation of double values to the file. All values are written to the file in little endian form.- Parameters:
filename
- the name of the file containing the array- Returns:
- the array in the file
- Throws:
java.io.IOException
-
read3DFloatArray
public static float[][][] read3DFloatArray(java.lang.String filename) throws java.io.IOException
Reads a rectangular jagged array from a file. The first four bytes (an integer) in the file indicate the number of dimensions of the array. The size of the array along each of the dimensions are then written as four bytes each (integers), note that the size along each of the dimensions must remain constant The rest of the file contains the array values (double values) The 64-bit IEEE 754 floating-point "double format" bit layout is used to write the byte representation of double values to the file. All values are written to the file in little endian form.- Parameters:
filename
- the name of the file containing the array- Returns:
- the array in the file
- Throws:
java.io.IOException
-
read4DFloatArray
public static float[][][][] read4DFloatArray(java.lang.String filename) throws java.io.IOException
Reads a rectangular jagged array from a file. The first four bytes (an integer) in the file indicate the number of dimensions of the array. The size of the array along each of the dimensions are then written as four bytes each (integers), note that the size along each of the dimensions must remain constant The rest of the file contains the array values (double values) The 64-bit IEEE 754 floating-point "double format" bit layout is used to write the byte representation of double values to the file. All values are written to the file in little endian form.- Parameters:
filename
- the name of the file containing the array- Returns:
- the array in the file
- Throws:
java.io.IOException
-
read5DFloatArray
public static float[][][][][] read5DFloatArray(java.lang.String filename) throws java.io.IOException
Reads a rectangular jagged array from a file. The first four bytes (an integer) in the file indicate the number of dimensions of the array. The size of the array along each of the dimensions are then written as four bytes each (integers), note that the size along each of the dimensions must remain constant The rest of the file contains the array values (double values) The 64-bit IEEE 754 floating-point "double format" bit layout is used to write the byte representation of double values to the file. All values are written to the file in little endian form.- Parameters:
filename
- the name of the file containing the array- Returns:
- the array in the file
- Throws:
java.io.IOException
-
write
public static void write(int[] array, java.lang.String filename) throws java.io.IOException
Writes an array to a file. The first four bytes (an integer) in the file indicate the number of dimensions of the array. The size of the array along each of the dimensions are then written as four bytes each (integers), note that the size along each of the dimensions must remain constant The rest of the file contains the array values (double values) The 64-bit IEEE 754 floating-point "double format" bit layout is used to write the byte representation of double values to the file. Integers are converted to doubles. All values are written to the file in little endian form. If the file already exists, then it will be overwritten.- Parameters:
array
- the array to write to the filefilename
- the name of the file to write to- Throws:
java.io.IOException
-
write
public static void write(int[][] array, java.lang.String filename) throws java.io.IOException
Writes a rectangular jagged array to a file. The first four bytes (an integer) in the file indicate the number of dimensions of the array. The size of the array along each of the dimensions are then written as four bytes each (integers), note that the size along each of the dimensions must remain constant The rest of the file contains the array values (double values) The 64-bit IEEE 754 floating-point "double format" bit layout is used to write the byte representation of double values to the file. Integers are converted to doubles. All values are written to the file in little endian form. If the file already exists, then it will be overwritten.- Parameters:
array
- the array to write to the filefilename
- the name of the file to write to- Throws:
java.io.IOException
-
write
public static void write(int[][][] array, java.lang.String filename) throws java.io.IOException
Writes a rectangular jagged array to a file. The first four bytes (an integer) in the file indicate the number of dimensions of the array. The size of the array along each of the dimensions are then written as four bytes each (integers), note that the size along each of the dimensions must remain constant The rest of the file contains the array values (double values) The 64-bit IEEE 754 floating-point "double format" bit layout is used to write the byte representation of double values to the file. Integers are converted to doubles. All values are written to the file in little endian form. If the file already exists, then it will be overwritten.- Parameters:
array
- the array to write to the filefilename
- the name of the file to write to- Throws:
java.io.IOException
-
write
public static void write(int[][][][] array, java.lang.String filename) throws java.io.IOException
Writes a rectangular jagged array to a file. The first four bytes (an integer) in the file indicate the number of dimensions of the array. The size of the array along each of the dimensions are then written as four bytes each (integers), note that the size along each of the dimensions must remain constant The rest of the file contains the array values (double values) The 64-bit IEEE 754 floating-point "double format" bit layout is used to write the byte representation of double values to the file. Integers are converted to doubles. All values are written to the file in little endian form. If the file already exists, then it will be overwritten.- Parameters:
array
- the array to write to the filefilename
- the name of the file to write to- Throws:
java.io.IOException
-
write
public static void write(int[][][][][] array, java.lang.String filename) throws java.io.IOException
Writes a rectangular jagged array to a file. The first four bytes (an integer) in the file indicate the number of dimensions of the array. The size of the array along each of the dimensions are then written as four bytes each (integers), note that the size along each of the dimensions must remain constant The rest of the file contains the array values (double values) The 64-bit IEEE 754 floating-point "double format" bit layout is used to write the byte representation of double values to the file. Integers are converted to doubles. All values are written to the file in little endian form. If the file already exists, then it will be overwritten.- Parameters:
array
- the array to write to the filefilename
- the name of the file to write to- Throws:
java.io.IOException
-
read1DIntArray
public static int[] read1DIntArray(java.lang.String filename) throws java.io.IOException
Reads an array from a file. The first four bytes (an integer) in the file indicate the number of dimensions of the array. The size of the array along each of the dimensions are then written as four bytes each (integers), note that the size along each of the dimensions must remain constant The rest of the file contains the array values (double values) The 64-bit IEEE 754 floating-point "double format" bit layout is used to write the byte representation of double values to the file. Double values in the file are converted to integers. All values are written to the file in little endian form.- Parameters:
filename
- the name of the file containing the array- Returns:
- the array in the file
- Throws:
java.io.IOException
-
read2DIntArray
public static int[][] read2DIntArray(java.lang.String filename) throws java.io.IOException
Reads a rectangular jagged array from a file. The first four bytes (an integer) in the file indicate the number of dimensions of the array. The size of the array along each of the dimensions are then written as four bytes each (integers), note that the size along each of the dimensions must remain constant The rest of the file contains the array values (double values) The 64-bit IEEE 754 floating-point "double format" bit layout is used to write the byte representation of double values to the file. Double values in the file are converted to integers. All values are written to the file in little endian form.- Parameters:
filename
- the name of the file containing the array- Returns:
- the array in the file
- Throws:
java.io.IOException
-
read3DIntArray
public static int[][][] read3DIntArray(java.lang.String filename) throws java.io.IOException
Reads a rectangular jagged array from a file. The first four bytes (an integer) in the file indicate the number of dimensions of the array. The size of the array along each of the dimensions are then written as four bytes each (integers), note that the size along each of the dimensions must remain constant The rest of the file contains the array values (double values) The 64-bit IEEE 754 floating-point "double format" bit layout is used to write the byte representation of double values to the file. Double values in the file are converted to integers. All values are written to the file in little endian form.- Parameters:
filename
- the name of the file containing the array- Returns:
- the array in the file
- Throws:
java.io.IOException
-
read4DIntArray
public static int[][][][] read4DIntArray(java.lang.String filename) throws java.io.IOException
Reads a rectangular jagged array from a file. The first four bytes (an integer) in the file indicate the number of dimensions of the array. The size of the array along each of the dimensions are then written as four bytes each (integers), note that the size along each of the dimensions must remain constant The rest of the file contains the array values (double values) The 64-bit IEEE 754 floating-point "double format" bit layout is used to write the byte representation of double values to the file. Double values in the file are converted to integers. All values are written to the file in little endian form.- Parameters:
filename
- the name of the file containing the array- Returns:
- the array in the file
- Throws:
java.io.IOException
-
read5DIntArray
public static int[][][][][] read5DIntArray(java.lang.String filename) throws java.io.IOException
Reads a rectangular jagged array from a file. The first four bytes (an integer) in the file indicate the number of dimensions of the array. The size of the array along each of the dimensions are then written as four bytes each (integers), note that the size along each of the dimensions must remain constant The rest of the file contains the array values (double values) The 64-bit IEEE 754 floating-point "double format" bit layout is used to write the byte representation of double values to the file. Double values in the file are converted to integers. All values are written to the file in little endian form.- Parameters:
filename
- the name of the file containing the array- Returns:
- the array in the file
- Throws:
java.io.IOException
-
write
public static void write(boolean[] array, java.lang.String filename) throws java.io.IOException
Writes an array to a file. The first four bytes (an integer) in the file indicate the number of dimensions of the array. The size of the array along each of the dimensions are then written as four bytes each (integers), note that the size along each of the dimensions must remain constant The rest of the file contains the array values (double values) The 64-bit IEEE 754 floating-point "double format" bit layout is used to write the byte representation of double values to the file. Boolean "true" values are converted to 1.0 and "false" to 0.0. All values are written to the file in little endian form. If the file already exists, then it will be overwritten.- Parameters:
array
- the array to write to the filefilename
- the name of the file to write to- Throws:
java.io.IOException
-
write
public static void write(boolean[][] array, java.lang.String filename) throws java.io.IOException
Writes a rectangular jagged array to a file. The first four bytes (an integer) in the file indicate the number of dimensions of the array. The size of the array along each of the dimensions are then written as four bytes each (integers), note that the size along each of the dimensions must remain constant The rest of the file contains the array values (double values) The 64-bit IEEE 754 floating-point "double format" bit layout is used to write the byte representation of double values to the file. Boolean "true" values are converted to 1.0 and "false" to 0.0. All values are written to the file in little endian form. If the file already exists, then it will be overwritten.- Parameters:
array
- the array to write to the filefilename
- the name of the file to write to- Throws:
java.io.IOException
-
write
public static void write(boolean[][][] array, java.lang.String filename) throws java.io.IOException
Writes a rectangular jagged array to a file. The first four bytes (an integer) in the file indicate the number of dimensions of the array. The size of the array along each of the dimensions are then written as four bytes each (integers), note that the size along each of the dimensions must remain constant The rest of the file contains the array values (double values) The 64-bit IEEE 754 floating-point "double format" bit layout is used to write the byte representation of double values to the file. Boolean "true" values are converted to 1.0 and "false" to 0.0. All values are written to the file in little endian form. If the file already exists, then it will be overwritten.- Parameters:
array
- the array to write to the filefilename
- the name of the file to write to- Throws:
java.io.IOException
-
write
public static void write(boolean[][][][] array, java.lang.String filename) throws java.io.IOException
Writes a rectangular jagged array to a file. The first four bytes (an integer) in the file indicate the number of dimensions of the array. The size of the array along each of the dimensions are then written as four bytes each (integers), note that the size along each of the dimensions must remain constant The rest of the file contains the array values (double values) The 64-bit IEEE 754 floating-point "double format" bit layout is used to write the byte representation of double values to the file. Boolean "true" values are converted to 1.0 and "false" to 0.0. All values are written to the file in little endian form. If the file already exists, then it will be overwritten.- Parameters:
array
- the array to write to the filefilename
- the name of the file to write to- Throws:
java.io.IOException
-
write
public static void write(boolean[][][][][] array, java.lang.String filename) throws java.io.IOException
Writes a rectangular jagged array to a file. The first four bytes (an integer) in the file indicate the number of dimensions of the array. The size of the array along each of the dimensions are then written as four bytes each (integers), note that the size along each of the dimensions must remain constant The rest of the file contains the array values (double values) The 64-bit IEEE 754 floating-point "double format" bit layout is used to write the byte representation of double values to the file. Boolean "true" values are converted to 1.0 and "false" to 0.0. All values are written to the file in little endian form. If the file already exists, then it will be overwritten.- Parameters:
array
- the array to write to the filefilename
- the name of the file to write to- Throws:
java.io.IOException
-
read1DBooleanArray
public static boolean[] read1DBooleanArray(java.lang.String filename) throws java.io.IOException
Reads an array from a file. The first four bytes (an integer) in the file indicate the number of dimensions of the array. The size of the array along each of the dimensions are then written as four bytes each (integers), note that the size along each of the dimensions must remain constant The rest of the file contains the array values (double values) The 64-bit IEEE 754 floating-point "double format" bit layout is used to write the byte representation of double values to the file. All values are written to the file in little endian form.- Parameters:
filename
- the name of the file containing the array- Returns:
- the array in the file
- Throws:
java.io.IOException
-
read2DBooleanArray
public static boolean[][] read2DBooleanArray(java.lang.String filename) throws java.io.IOException
Reads a rectangular jagged array from a file. The first four bytes (an integer) in the file indicate the number of dimensions of the array. The size of the array along each of the dimensions are then written as four bytes each (integers), note that the size along each of the dimensions must remain constant The rest of the file contains the array values (double values) The 64-bit IEEE 754 floating-point "double format" bit layout is used to write the byte representation of double values to the file. All values are written to the file in little endian form.- Parameters:
filename
- the name of the file containing the array- Returns:
- the array in the file
- Throws:
java.io.IOException
-
read3DBooleanArray
public static boolean[][][] read3DBooleanArray(java.lang.String filename) throws java.io.IOException
Reads a rectangular jagged array from a file. The first four bytes (an integer) in the file indicate the number of dimensions of the array. The size of the array along each of the dimensions are then written as four bytes each (integers), note that the size along each of the dimensions must remain constant The rest of the file contains the array values (double values) The 64-bit IEEE 754 floating-point "double format" bit layout is used to write the byte representation of double values to the file. All values are written to the file in little endian form.- Parameters:
filename
- the name of the file containing the array- Returns:
- the array in the file
- Throws:
java.io.IOException
-
read4DBooleanArray
public static boolean[][][][] read4DBooleanArray(java.lang.String filename) throws java.io.IOException
Reads a rectangular jagged array from a file. The first four bytes (an integer) in the file indicate the number of dimensions of the array. The size of the array along each of the dimensions are then written as four bytes each (integers), note that the size along each of the dimensions must remain constant The rest of the file contains the array values (double values) The 64-bit IEEE 754 floating-point "double format" bit layout is used to write the byte representation of double values to the file. 1.0 values are converted to "true" and 0.0 to "false". All values are written to the file in little endian form.- Parameters:
filename
- the name of the file containing the array- Returns:
- the array in the file
- Throws:
java.io.IOException
-
read5DBooleanArray
public static boolean[][][][][] read5DBooleanArray(java.lang.String filename) throws java.io.IOException
Reads a rectangular jagged array from a file. The first four bytes (an integer) in the file indicate the number of dimensions of the array. The size of the array along each of the dimensions are then written as four bytes each (integers), note that the size along each of the dimensions must remain constant The rest of the file contains the array values (double values) The 64-bit IEEE 754 floating-point "double format" bit layout is used to write the byte representation of double values to the file. 1.0 values are converted to "true" and 0.0 to "false". All values are written to the file in little endian form.- Parameters:
filename
- the name of the file containing the array- Returns:
- the array in the file
- Throws:
java.io.IOException
-
getStream
public static java.io.BufferedOutputStream getStream(java.lang.String filename) throws java.io.IOException
Create a stream to the file specified by filename. If the file already exists, it is overwritten. The necessary directories are created.- Parameters:
filename
- the name of the file.- Returns:
- a stream to the file.
- Throws:
java.io.IOException
-
main
public static void main(java.lang.String[] args)
-
-
DMelt 3.0 © DataMelt by jWork.ORG