> OK.....and can I the write the values in a HashMap to
> a (.ser) file.....I am trying to use ObjectOutput as
> I have Objects stored in the HashMap
u can write the HashMap Object itself. like
Map map = new HashMap();
map.put(..,...);
....
ObjectOutputStream objectStream = new ObjectOutputStream(someOutputStream);
objectStream.writeObject(map);
The HashMap is Serializable.
This can fail if there is any non-transient reference type in the Object tree of the
key or value Object used in the put method
This is how i did it.....will it work.....wanna make sure because HashMap has a lot of data(Objects) and the program takes a couple of hours to run completely.
ObjectOutput out = new ObjectOutputStream(new FileOutputStream("trainingSetNew.ser"));
out.writeObject(map);
out.close();
> Lee I did that...........but I cant find the
> (TrainingSetNew.ser) file that should have been
> created...the program just ranfine
Hmmm, that would be a problem then, huh ;-)
You might try calling flush before you call close on your ObjectOutputStream. You might also make sure that you're not ignoring any Exceptions that your code might be throwing.