'fos , oos, fis, ois are all javaobjects
Dim fname As String = "C:/temp/testdata.dat" 'name of file for data
fos.InitializeNewInstance("java.io.FileOutputStream",Array(fname))
oos.InitializeNewInstance("java.io.ObjectOutputStream",Array(fos))
' ar in the next line is the 2 dimensional Double array
' I just made it (2,3) but anysize should work
oos.RunMethod("writeObject",Array(ar)) ' write the data
oos.RunMethod("close",Null) ' close output object stream
fos.RunMethod("flush",Null) ' flush the file output buffer
fos.RunMethod("close",Null) ' close output file
' these lines read it back into new array (to prove it works)
fis.InitializeNewInstance("java.io.FileInputStream",Array(fname))
ois.InitializeNewInstance("java.io.ObjectInputStream",Array(fis))
Dim yy(2,3) As Double ' the new array for the data from file
yy = ois.RunMethod("readObject",Null) ' read the object
ois.RunMethod("close",Null) ' close the object input stream
fos.RunMethod("close",Null) ' close the file input stream
' this just shows the data read from the file
For a = 0 To 1
For b = 0 To 2
Log("("&a&","&b&") "&yy(a,b))
Next
Next