gpt4 book ai didi

java - 当 serialVersionId 未存储在序列化对象中时,反序列化过程如何知道序列化对象的 serialVersionId?

转载 作者:行者123 更新时间:2023-11-29 04:57:19 25 4
gpt4 key购买 nike

当 serialVersionId 未存储在序列化对象中时,反序列化过程如何知道序列化对象的 serialVersionId,这需要与将要转换为的类的序列版本 ID 进行比较,以检查它是否兼容?

最佳答案

This article描述了 Java 对象的序列化形式:

AC ED: STREAM_MAGIC. Specifies that this is a serialization protocol.
00 05: STREAM_VERSION. The serialization version.
0x73: TC_OBJECT. Specifies that this is a new Object.
0x72: TC_CLASSDESC. Specifies that this is a new class.
00 0A: Length of the class name.
53 65 72 69 61 6c 54 65 73 74: SerialTest, the name of the class.
05 52 81 5A AC 66 02 F6: SerialVersionUID, the serial version identifier of this class.
(fields omitted)

关于java - 当 serialVersionId 未存储在序列化对象中时,反序列化过程如何知道序列化对象的 serialVersionId?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33309567/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com