什么是“序列化"?编程中的对象? [英] What is a "serialized" object in programming?

查看:111
本文介绍了什么是“序列化"?编程中的对象?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我到处都看到过序列化"一词,但从未解释过.请解释一下这是什么意思.

I've seen the term "serialized" all over, but never explained. Please explain what that means.

推荐答案

串行化通常是指将抽象数据类型转换为字节流的过程(有时也可以序列化为文本,XML或CSV或其他格式.重要的是,它是一种简单的格式,可以在不了解数据所代表的抽象对象的情况下进行读取/写入.将数据保存到文件或通过网络传输时,不能仅存储MyClass对象,而只能存储字节.因此,您需要获取重建对象所需的所有数据,并将其转换为可以写入目标设备的字节序列,并在以后的某个时间点读回并反序列化,以重建对象.

Serialization usually refers to the process of converting an abstract datatype to a stream of bytes (You sometimes serialize to text, XML or CSV or other formats as well. The important thing is that it is a simple format that can be read/written without understanding the abstract objects that the data represents). When saving data to a file, or transmitting over a network, you can't just store a MyClass object, you're only able to store bytes. So you need to take all the data necessary to reconstruct your object, and turn that into a sequence of bytes that can be written to the destination device, and at some later point read back and deserialized, reconstructing your object.

这篇关于什么是“序列化"?编程中的对象?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆