What is the difference between Serialization and Marshaling?

前端 未结 12 1497
忘了有多久
忘了有多久 2020-12-02 03:30

I know that in terms of several distributed techniques (such as RPC), the term "Marshaling" is used but don\'t understand how it differs from Serialization. Aren\'

12条回答
  •  有刺的猬
    2020-12-02 03:41

    From the Marshalling (computer science) Wikipedia article:

    The term "marshal" is considered to be synonymous with "serialize" in the Python standard library1, but the terms are not synonymous in the Java-related RFC 2713:

    To "marshal" an object means to record its state and codebase(s) in such a way that when the marshalled object is "unmarshalled", a copy of the original object is obtained, possibly by automatically loading the class definitions of the object. You can marshal any object that is serializable or remote. Marshalling is like serialization, except marshalling also records codebases. Marshalling is different from serialization in that marshalling treats remote objects specially. (RFC 2713)

    To "serialize" an object means to convert its state into a byte stream in such a way that the byte stream can be converted back into a copy of the object.

    So, marshalling also saves the codebase of an object in the byte stream in addition to its state.

提交回复
热议问题