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't they both transforming objects into series of bits?
相关问题
- Json.NET deserializing contents of a JObject?
- Serializing a serialized Thrift struct to Kafka in
- GeoDjango: Distance Object is not serializable
- How do I send or save a function and recv or resto
- How to serialise Enums as both Object Shape and de
相关文章
- serializing a list of objects into a file in java
- Convert C# Object to Json Object
- When sending XML to JMS should I use TextMessage o
- Custom serialization for fields in Rails
- Do I need to expose a constructor in a WCF DataCon
- How to serialize Xml Date only from DateTime in C#
- Unwanted namespaces on SVG markup when using XMLSe
- What does “exposition only” mean? Why use it?
Marshaling refers to converting the signature and parameters of a function into a single byte array. Specifically for the purpose of RPC.
Serialization more often refers to converting an entire object / object tree into a byte array Marshaling will serialize object parameters in order to add them to the message and pass it across the network. *Serialization can also be used for storage to disk.*
From the Marshalling (computer science) Wikipedia article:
So, marshalling also saves the code of an object in the byte stream in addition to its state.
Both do one thing in common - that is serializing an Object. Serialization is used to transfer objects or to store them. But:
So Serialization is part of Marshalling.
CodeBase is information that tells the receiver of Object where the implementation of this object can be found. Any program that thinks it might ever pass an object to another program that may not have seen it before must set the codebase, so that the receiver can know where to download the code from, if it doesn't have the code available locally. The receiver will, upon deserializing the object, fetch the codebase from it and load the code from that location.
Marshalling is the rule to tell compiler how the data will be represented on another environment/system; For example;
as you can see two different string values represented as different value types.
Serialization will only convert object content, not representation (will stay same) and obey rules of serialization, (what to export or no). For example, private values will not be serialized, public values yes and object structure will stay same.
Think of them as synonyms, both have a producer that sends stuff over to a consumer... In the end fields of instances are written into a byte stream and the other end foes the reverse ands up with the same instances.
NB - java RMI also contains support for transporting classes that are missing from the recipient...