S
scifluent
I am serializing an arraylist using the following code:
filename = "Data.ser";
try
{
new File(filename).delete();
OutputStream file = new FileOutputStream(filename);
OutputStream buffer = new BufferedOutputStream(file);
output = new ObjectOutputStream(buffer);
output.writeObject(this.DataList);
output.close();
}
catch(IOException ex)
{
ex.printStackTrace();
}
.... and when I read it back in using the code below...I get the
correct number of elements in the ArrayList but the elements are all
nulll values. Any ideas??? (I have verified that the orginal list
has non-null element values.) Thanks!!!!
ObjectInput input = null;
try{
//use buffering
InputStream file = new FileInputStream( "Data.ser");
InputStream buffer = new BufferedInputStream( file );
input = new ObjectInputStream ( buffer );
DataListPrev = (ArrayList<Float>) input.readObject();
input.close();
}
catch(IOException ex){
ex.printStackTrace();
}
catch (ClassNotFoundException ex){
ex.printStackTrace();
}
filename = "Data.ser";
try
{
new File(filename).delete();
OutputStream file = new FileOutputStream(filename);
OutputStream buffer = new BufferedOutputStream(file);
output = new ObjectOutputStream(buffer);
output.writeObject(this.DataList);
output.close();
}
catch(IOException ex)
{
ex.printStackTrace();
}
.... and when I read it back in using the code below...I get the
correct number of elements in the ArrayList but the elements are all
nulll values. Any ideas??? (I have verified that the orginal list
has non-null element values.) Thanks!!!!
ObjectInput input = null;
try{
//use buffering
InputStream file = new FileInputStream( "Data.ser");
InputStream buffer = new BufferedInputStream( file );
input = new ObjectInputStream ( buffer );
DataListPrev = (ArrayList<Float>) input.readObject();
input.close();
}
catch(IOException ex){
ex.printStackTrace();
}
catch (ClassNotFoundException ex){
ex.printStackTrace();
}