我开始与面向对象编程(OOP)和想知道:什么是序列化的意义在面向对象的说法?
当前回答
Serialization is the process of converting an object into a stream of bytes to store the object or transmit it to memory, a database, or a file. Its main purpose is to save the state of an object in order to be able to recreate it when needed. The reverse process is called deserialization. ... This illustration shows the overall process of serialization ... Through serialization, a developer can perform actions like sending the object to a remote application by means of a Web Service, passing an object from one domain to another, passing an object through a firewall as an XML string, or maintaining security or user-specific information across applications
从https://learn.microsoft.com/en-us/dotnet/csharp/programming-guide/concepts/serialization/
(强调我的)
其他回答
只要考虑一下下面的想法就能理解它。
序列化:
"hello world".split() returns ['hello', 'world']
反序列化:
" ".join(['hello', 'world']) returns "hello world"
序列化是将对象转换为可存储的位序列。
所以你可以保存这个序列到一个文件,db或通过网络发送。
稍后,您可以将其反序列化为实际对象,并在需要时重用它。
Web服务和AJAX是序列化最常见的例子。对象在向客户端发送响应之前被序列化。
序列化是将对象转换为二进制数据流的过程,这样它就可以存储在文件中或通过网络发送,在网络中它可以恢复到相同的对象。
本文档将帮助您详细理解Java序列化。
序列化是将对象转换为字节流以存储对象或将其传输到内存、数据库或文件的过程。它的主要目的是保存对象的状态,以便在需要时能够重新创建它。
什么是序列化?
图片类比解释:
简介:
序列化意味着将某物(例如我的狗Rex)转换成一系列的1和0 -可以运输/存储等。我的海外朋友可以把这些1和0翻译成小狗的完美表现(反序列化)。
类比澄清
朋友们,这是个类比。我认为你还不能连载一只小狗。您可以序列化数据结构或其他复杂对象。(我写这个答案是为了让您能够以一种有趣的方式,在不到3秒的时间内理解这个概念,而不用绞尽脑汁去理解一个核心的技术定义),但如果您更喜欢一个规范的定义,请查看维基百科关于序列化的条目。