[英]Can I save object to disk without serialization?
I would like to know whether it is possible to save an instance of some class to file on my disk and then recover it without serialization.我想知道是否可以将一些 class 的实例保存到我的磁盘上的文件中,然后在没有序列化的情况下恢复它。 For example converting the instance to byte array and then saving in FileStream or something else.例如将实例转换为字节数组,然后保存在 FileStream 或其他东西中。 Honestly, I am asking since not fully understand why we need serialization if we can save objects to files without it?老实说,我问的是,如果我们可以在没有序列化的情况下将对象保存到文件中,为什么我们需要序列化?
As definition of serialization says: In computing, serialization (or serialisation) is the process of translating data structures or object state into a format that can be stored (for example, in a file or memory buffer) or transmitted (for example, across a network connection link) and reconstructed later (possibly in a different computer environment).正如序列化的定义所说:在计算中,序列化(或序列化)是将数据结构或 object state 转换为可以存储的格式(例如,在文件或 ZCD69B4957F06CD8218D7BF3D6198 缓冲区中传输)的过程网络连接链接)并在稍后重建(可能在不同的计算机环境中)。
Answer is NO, because definition of serialization.答案是否定的,因为序列化的定义。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.