Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the difference between Serialization and Marshaling?

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?

Related:

What is Serialization?

What is Object Marshalling?

like image 608
Peter Avatar asked Apr 20 '09 23:04

Peter


People also ask

What is the difference between serialization and deserialization?

Serialization is a mechanism of converting the state of an object into a byte stream. Deserialization is the reverse process where the byte stream is used to recreate the actual Java object in memory.

What's the difference between serialization and encoding?

Serializing is about moving structured data over a storage/transmission medium in a way that the structure can be maintained. Encoding is more broad, like about how said data is converted to different forms, etc.

What does serialization mean?

Serialization is the process of converting a data object—a combination of code and data represented within a region of data storage—into a series of bytes that saves the state of the object in an easily transmittable form.

What is marshaling in Java?

marshalling means producing a stream of byte which contain enough information to be able to re-build the object. This has no impact on the original object, it is a read-only operation. Unmarshalling resulting in creating another, unrelated object (typically).


1 Answers

Marshaling and serialization are loosely synonymous in the context of remote procedure call, but semantically different as a matter of intent.

In particular, marshaling is about getting parameters from here to there, while serialization is about copying structured data to or from a primitive form such as a byte stream. In this sense, serialization is one means to perform marshaling, usually implementing pass-by-value semantics.

It is also possible for an object to be marshaled by reference, in which case the data "on the wire" is simply location information for the original object. However, such an object may still be amenable to value serialization.

As @Bill mentions, there may be additional metadata such as code base location or even object implementation code.

like image 185
Jeffrey Hantin Avatar answered Oct 06 '22 22:10

Jeffrey Hantin