Section 5 of the OSS (Object Serialization Spec) is some fine, light
reading.  ;-)

http://java.sun.com/j2se/1.3/docs/guide/serialization/spec/version.doc.html


-blair

Blair Wyman -- iSeries JVM -- (507) 253-2891
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
"It is a sobering thought that when Mozart was my age,
he had been dead for two years." -- Tom Lehrer



                                                                                       
                                                
                      "Zlatko                                                          
                                                
                      Kostadinov"              To:       "JDJList" 
<[EMAIL PROTECTED]>                                       
                      <zlatko@blue-edge        cc:                                     
                                                
                      .bg>                     Subject:  [jdjlist] problem with 
serizlization                                          
                                                                                       
                                                
                      08/26/2002 06:14                                                 
                                                
                      AM                                                               
                                                
                      Please respond to                                                
                                                
                      "JDJList"                                                        
                                                
                                                                                       
                                                
                                                                                       
                                                



Hi guys

I had serizlized objects in this way:

class A {
    private ArrayList data = new ArrayList();

    private void writeObject(ObjectOutputStream ous) throws IOException {
        out.writeObject(data);
    }

    private void readObject(ObjectInputStream ois) throws IOException,
ClassNotFoundException {
        data = out.readObject();
    }
}

And my program now works with objects of this type. I want to add new field
in the class so the class will be

class A {
    private ArrayList data = new ArrayList();
    private name = "name";

    private void writeObject(ObjectOutputStream ous) throws IOException {
        out.writeObject(data);
        out.writeObject(name);
    }

    private void readObject(ObjectInputStream ois) throws IOException,
ClassNotFoundException {
        data = out.readObject();
        // here is the problem - how to determine is this an instance of
the
new version or no.
        // must I read the name or not.
    }
}

Any ideas are wellcome
Regards
Zlatko


To change your JDJList options, please visit:
http://www.sys-con.com/java/list.cfm






To change your JDJList options, please visit: http://www.sys-con.com/java/list.cfm

Reply via email to