Serialization(序列化)机制<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

1. Serialization and Deserialization

Serialization is the process of converting a complex set of data, such as that which is contained in an object, into a single blob that’s often called a byte stream. The reverse, deserialization, is the process of unpacking the byte stream to re-create the complex set of data.

2. Type of Serialization

Remoting uses a type of serialization that finds all the variables contained within an object, and converts their values into a byte stream.

Web services use a different serialization scheme. Rather than copying the variables within an object, web-services serialization just scans the object to find any fields that are public in scope, and any public properties that are read-write. Read-only and write-only properties are ignored, as are any nonpublic variables.

3. [Serializable()] attribute and ISerializable

Implementing ISerializable is only necessary if the default behavior of serialization is unacceptable, which isn’t usually an issue.

4. [NonSerialized()] attribute

Once a class is marked as [Serializable()], all of its member variables will be automatically serialized into a byte stream when the object is serialized. Sometime, however, we can use [NonSerialized()] attribute marks to set some variables that shouldn’t be serialized. In most cases, these will be references to other objects.

The one caveat with doing this is that any code that interacts with the above reference object variables must assume that they could be null. If the object is serialized and deserialized, the [NonSerialzied()] reference object variable will have the value null in the newly created object.

5. Serialization mechanism

Be aware that Remoting doesn’t transfer the code, but only the data. For this mechanism to work, the DLL containing the required class must be on the client machine along with the client application. In order to deserialize the byte stream on the client, Remoting loads the DLL containing the required class, creates an empty required object, and then populates it with the deserialized data.

***

上面关于Serialization和Deserialization的阐述来自Rockford Lhotka《Expert C# Business Objects》,清楚解释了一些比较容易模糊的概念。

Serialization(序列化)机制相关推荐

  1. java序列化算法透析_Java序列化机制与原理的深入分析

    Java序列化算法透析 Serialization(序列化)是一种将对象以一连串的字节描述的过程:反序列化deserialization是一种将这些字节重建成一个对象的过程.Java序列化API提供一 ...

  2. Spark 配置Kryo序列化机制注意细节

    一.Spark 的序列化 序列化 Spark 是一个高性能.分布式的.基于内存计算的计算引擎,Spark 集群中包含多个节点,各节点之间要进行通信(比如数据传输,Spark 通过 RPC 进行节点间的 ...

  3. java序列化原理_Java序列化机制和原理

    Java序列化算法透析 Serialization(序列化)是一种将对象以一连串的字节描述的过程:反序列化deserialization是一种将这些字节重建成一个对象的过程.Java序列化API提供一 ...

  4. Java序列化机制和原理

    Java序列化算法透析 Serialization(序列化)是一种将对象以一连串的字节描述的过程:反序列化deserialization是一种将这些字节重建成一个对象的过程.Java序列化API提供一 ...

  5. Java实现序列化机制

    公众号上线啦! 搜一搜[国服冰] 使命:尽自己所能给自学后端开发的小伙伴提供一个少有弯路的平台 回复:国服冰,即可领取我为大家准备的资料,里面包含整体的Java学习路线,电子书,以及史上最全的面试题! ...

  6. 【MapReduce】Hadoop的序列化机制以及序列化案例求解每个部门工资总额

    Hadoop的序列化机制以及序列化案例求解每个部门工资总额 1 Hadoop的序列化 1.1 序列化定义 1.2 Java序列化编程 1.3 hadoop序列化编程 2 序列化求解每个部门工资总额 手 ...

  7. Strom序列化机制

    Storm 中的 tuple可以包含任何类型的对象.由于Storm 是一个分布式系统,所以在不同的任务之间传递消息时Storm必须知道怎样序列化.反序列化消息对象. Storm 使用 Kryo库对对象 ...

  8. SpringBoot高级-缓存-RedisTemplate序列化机制

    前面我们就搭建测试好了redis环境,接下来我们就来整合redis来做缓存,我们需要引入redis的starter,这个starter我们直接去官方文档去搜索就行了,我们来找到所有的starter跟r ...

  9. java对象的序列化机制详解

    Java对象的序列化机制 Java对象的序列化,是将内存中的java对象转化为二进制的字节流,然后保存到磁盘中或者在网络上.这就是序列化对象,反序列化顾名思义就是将对象的二进制字节流恢复成原来的对象. ...

  10. java 序列化 protobuf_java序列化机制之protobuf(快速高效跨语言)

    我们之前曾讲过java自带的一种序列化机制,但是这种机制效率太低,有很多缺点.因此也涌现出了很多优秀的系列化框架,比如说protobuf.protostuff.thrift.hession.kryo. ...

最新文章

  1. MapReduce DataJoin 链接多数据源
  2. Struts 2.5.20 在Eclipse配置
  3. 剑指offer之【调整数组顺序使奇数位于偶数前面】
  4. linux内核中链表代码分析---list.h头文件分析(二)【转】
  5. qt插件元数据不包含一个有效的元数据_Qt5个人软件插件使用(低级API)
  6. java 实现 tcp_java实现TCP通信
  7. 开源纯C#工控网关+组态软件(七)数据采集与归档
  8. Java 中的悲观锁、乐观锁、自旋锁、适应性自旋锁、偏向锁、轻量级锁、重量级锁、公平锁、非公平锁、可重入锁、共享锁等
  9. 7、C语言 —— 字符串常用处理函数
  10. SQL Server “Denali” ---SQL 2012 新特性
  11. DevExpress中XtraGrid控件对GridView每行的颜色设置 zt
  12. 测量在Python中经过的时间
  13. 创建图表_三种建立Excel图表的方法,谁用谁知道
  14. 计算机基础应用模拟考试软件,全国计算机等级考试全真训练模拟考试软件一级基础及MS-Office应用...
  15. C语言基础入门需多久,c语言入门基础知识
  16. 套件端口 群晖_群晖NAS的各种端口
  17. 常用颜色RGB表 色值
  18. 商汤科技VS旷视科技VS依图科技
  19. 录屏怎么录声音?注意一点轻松录制外部音源
  20. 第2章 Python 数字图像处理(DIP) --数字图像基础2 - 图像感知要素 - 图像取样和量化 - 空间分辨率和灰度分辨率

热门文章

  1. 上两周体检了,昨天回OFFICE看到结果,大喜过望,脂肪肝没了,血脂正常。
  2. 王通:SEO的六种赚钱方式
  3. java程序员基础算法_java程序员必知的十种程序算法
  4. [英语单词] cookie from chatGPT
  5. GIS的框选范围查询
  6. web小游戏开发:蜘蛛纸牌(一)
  7. [数字图像处理]频域滤波(1)--基础与低通滤波器
  8. Nexus3 部署备份与恢复
  9. 浅谈ERP项目的一把手工程
  10. CAD中图纸比较功能怎么用