I have never tried objects of this size, but I think you can try to wrap your array inside a class. java.io.Serializable interface:
class MyWrapper implements java.io.Serializable { Object[] myArray; }
Then, when you need to save your array to disk, you will do it simply using the interface method:
FileOutputStream fouts = new FileOutputStream("pathtofile"); // Write object with ObjectOutputStream ObjectOutputStream outobj= new ObjectOutputStream (fouts); // Write object out to disk outobj.writeObject ( myWrapperInstance );
In order of receipt
FileInputStream infile = new FileInputStream("pathtofile"); ObjectInputStream inobj = new ObjectInputStream (infile); Object obj = inobj.readObject(); MyWrapper myWrapperInstance = (MyWrapper) obj;
source share