I have a Map:
Map<String, DistributorAdd> map= new TreeMap<String, DistributorAdd>();
and I save it in a file.txt
FileOutputStream fos = new FileOutputStream("Distrib.txt");
ObjectOutputStream oos = new ObjectOutputStream(fos);
oos.writeObject(map);
oos.close();
The problem is that Distributor who was yesterday like:
public DistributorAdd(String distributor, String
emailAdress, String name, String speciality){...}
Will be tomorrow like this:
public void ajouter(String Distributor, String EmailAdress,
String Name, String Phone, String Image) {..}
My coworker already placed a lot of info in her Distrib.txt so what I want is to be able to put a new String in the Map without destroying it.
I would like to keep Distrib.txt and my DistributorAdd function is there any easy step I could do to do that?
The kind of error I get is:
ObjectInputStream ois = new ObjectInputStream(new FileInputStream("Distrib.txt"));
VendorA = (DistributorAdd) ois.readObject();
Error:
IOException : table.java => table()java.io.StreamCorruptedException: invalid stream header: ACED0573
at java.io.ObjectInputStream.readStreamHeader(ObjectInputStream.java:780)
at java.io.ObjectInputStream.<init>(ObjectInputStream.java:277)
at car.Table.<init>(Table.java:185)
at car.Table.main(Table.java:837)
If you have any question or any more information that I need to give I will be happy to do it.