I have a TreeeMap that i need to wite to file.
I tried this:

             File file = new File("reboot_customer_details");  
             FileOutputStream f = new FileOutputStream(file);  
             ObjectOutputStream s = new ObjectOutputStream(f);          
             s.writeObject(customerDetails);//customerDetails is the map i need to save
         catch(Exception ex)
             gui.results.setText("Error: " + ex);

When i add a key/value pair to the map this is what it saves
¬í sr java.util.TreeMapÁö>-%jæ L
comparatort Ljava/util/Comparator;xppw t GLENsr rbdeskapp.Customer„ÀýËwz L namet Ljava/lang/String;L phoneq ~ L postq ~ L repairst Ljava/util/List;L streetq ~ L townq ~ xpt glent t sr java.util.ArrayListxÒ™Ça I sizexp w
sr rbdeskapp.Repair9¸B¹AªÎ L newlineq ~ L notesq ~ xpt
t NOTESxt llt x

What do I need to do?

That looks OK.
writeObject writes the Map and its contents in a binary format that only readObject understands.
If you want a readable version that can be used to write and read such Objects, take a look at XMLEncoder/XMLDecoder.
If you ust want a fully human-readable version then use ordinary print methods.

Edited 4 Years Ago by JamesCherrill

This question has already been answered. Start a new discussion instead.