Java - Modifying serialVersionUID of binary serialized object

前端 未结 4 782
感情败类
感情败类 2021-01-07 08:37

A few months back I serialized a java.io.Serializable object into a file. Now I need to read the contents, but since then the serialVersionUID has changed, and now I\'m get

4条回答
  •  陌清茗
    陌清茗 (楼主)
    2021-01-07 08:47

    It is documented that Serialization is not intended to be used for persisting data. In order to get that data back, you will need to downgrade your version of the JVM to the version that was used to output that data.

    For future reference, don't use serialization to persist data between sessions of the JVM.

提交回复
热议问题