serialization/deserialization mechanism

后端 未结 5 954
粉色の甜心
粉色の甜心 2021-01-13 04:42

Say, I have a class X which has a field value, that is,

class X implements Serializable {
    private i         


        
5条回答
  •  情深已故
    2021-01-13 05:33

    Does deserialization fail in case the access specifier of the field changes

    No.

    OR some or all of the methods go missing in the class at the deserialization end?

    Yes, unless the receiving class has a serialVersionUID member whose value equals the value encoded in the stream.

    what is the mechanism by which fields are assigned their values during deserialization?

    Too broad, but:

    • Reflection, and
    • name matching (rather than matching by position in the class and stream).

提交回复
热议问题