Is java object serialization compatible between 1.5 and 1.6

前端 未结 8 1868
灰色年华
灰色年华 2020-12-18 19:48

I am wondering whether it is safe to mix jdk 1.5 and 1.6 (Java 6) object serialization (biderctional communication). I searched for an explicit statement from sun concerning

相关标签:
8条回答
  • 2020-12-18 20:18

    Note that the Java Beans specification details a version-independent serialization method which allows for strong backwards-compatibility. It also results in readable "serialized" forms. In fact a serialized object can be created pretty easily using the mechanism.

    Look up the documentation to the XMLEncoder and XMLDecoder classes.

    I wouldn't use this for passing an object over the wire necessarily (though if high performance is a requirement,I wouldn't use serialization either) but it's invaluable for persistent object storage.

    0 讨论(0)
  • 2020-12-18 20:29

    After testing with a serialized object written to a file using the ObjectOutputStream in a Java 1.5 program, then running a read with a ObjectInputStream in a Java 1.6 program I can say this worked without any issue.

    0 讨论(0)
提交回复
热议问题