我开始与面向对象编程(OOP)和想知道:什么是序列化的意义在面向对象的说法?


当前回答

When instantiating (constructing) the actual object(the thing) from a class (blueprint) there is a need to save the object (thing) by serializing it (breaking it down to its basic atomic structure) to a space in memory. (Kind of like Star Treks Transporter). You break the thing down into it stream of information that can be transported somewhere and stored. Then when you want to reconstruct the thing you just pull the atomically stored instance back into the object. Different from instaniation.

其他回答

看看这个,它会给你一个很好的解释:

http://en.wikipedia.org/wiki/Serialization

我认为序列化这个术语最常见的用法是将二进制对象转换为XML(或其他字符串)表示形式,这样它就可以存储在数据库/文件中,或者在web服务调用中通过网络发送。反序列化是相反的过程——将XML/字符串转换回对象。

编辑: 您可能遇到的另一个术语是编组/解组。编组基本上是与序列化相同的概念,而解组与反序列化相同。

序列化是将无序数据(如对象)转换为一系列标记的过程,这些标记以后可用于重建原始数据。序列化形式通常是一个文本字符串,但不一定非得是这样。

序列化是将Java、c#或任何其他(OOP语言)支持的对象转换为可移植形式的过程。通过这种方式,它可以通过网络传输或存储在磁盘上。对于可序列化的类,它必须实现可序列化的接口。

When instantiating (constructing) the actual object(the thing) from a class (blueprint) there is a need to save the object (thing) by serializing it (breaking it down to its basic atomic structure) to a space in memory. (Kind of like Star Treks Transporter). You break the thing down into it stream of information that can be transported somewhere and stored. Then when you want to reconstruct the thing you just pull the atomically stored instance back into the object. Different from instaniation.

序列化只不过是将Java支持的对象转换为文件支持的形式

                         (OR)

将Java支持的形式转换为网络支持的形式..序列化的主要范围只是将数据从一层传输到另一层…只有序列化的对象,我们可以通过网络发送。