Community Server-->串行化处理
来源:互联网 发布:微信数据丢失怎么恢复 编辑:程序博客网 时间:2024/06/10 19:51
这部分包括3部分:
CommunityComponents.Serializer 提供串行化服务类。
CommunityComponents.SerializerData 串行化数据结构。
CommunityComponents.ExtendedAttributes 提供串行化键值集合的基类。
1.1 串行化服务类
static Serializer()提供对二进制格式数据串行化的安全边界检查,当此允许时CanBinarySerialize=true。
static byte[] ConvertToBytes(object objectToConvert):将传入对象转为字节数组。
static bool SaveAsBinary(object objectToSave, string path):将此对象写入指定路径的文件,文件格式为二进制。
static string ConvertToString(object objectToConvert):将传入对象转为字符串。
static void SaveAsXML(object objectToConvert, string path):将此对象写入指定路径的文件,文件格式为xml
static object ConvertToObject(byte[] byteArray):将传入字节数组反串行化为对象。
static object ConvertFileToObject(string path, Type objectType):将指定路径的文件反串行化为对象。
static object ConvertToObject(string xml, Type objectType) :将指定路径的文件反串行化为XML对象。
static object LoadBinaryFile(string path) :将指定路径的文件反串行化为二进制对象。
static NameValueCollection ConvertToNameValueCollection(string keys, string values):将keys和Values的值转化和name 和 value的键值对。
static void ConvertFromNameValueCollection(NameValueCollection nvc, ref string keys, ref string values)将NameValueCollection集合中的name 和 value的键值对转化为包含所有的key的串的组合和包含所有的value对应的值的组合。
1.2 串行化数据结构
SerializerData:此结构包含两个字符串:
Keys:包含所有的key的串的组合。
Values:包含所有的value对应的值的组合。
其中Keys和Values格式定义为:keys= 键名称:+分隔特征符号:+键值开始位置:+键值长度。
Values = 所有值的直接连串。
例如:keys = “key1:S:0:3:key2:S:3:2”,Values = “12345”;
则转化为键值对为 name1=key1 value1= 123,name2 = key2 value2 = 45。
1.3 提供串行化键值集合的基类
GetExtendedAttribute(string name) 取出指定名称的属性值。
SetExtendedAttribute(string name, string value) 存指定名称的指定值。
ExtendedAttributesCount 集合大小。
GetSerializerData()获取串行化数据,此方法调用了ConvertFromNameValueCollection(NameValueCollection nvc, ref string keys, ref string values)方法用于获取数据。
SetSerializerData(SerializerData data) ,此方法调用了 ConvertToNameValueCollection(string keys, string values) 将keys和Values的值转化和name 和 value的键值对。- Community Server-->串行化处理
- Community Server-->权限处理
- Community Server-->HTTP处理
- Community Server-->搜索处理
- Community Server-->模板定制处理
- Community Server-->异常日志处理
- Community Server
- community server
- Community Server专题一:概述Community Server
- Community Server专题一:概述Community Server
- Community Server专题一:概述Community Server
- Community Server学习资料
- Community Server的问题
- Community server 杂笔
- Professional Community Server
- Professional Community Server Themes
- Community Server-->工作任务
- Community Server-->缓存
- 程序集
- Community Server-->工作任务
- HashMap及泛型实例(瞎搞的)
- 十六招成为大型软件项目的开发英雄
- Community Server-->搜索处理
- Community Server-->串行化处理
- 50个能够满足所有需要的Python模块
- Community Server-->多线程管理池
- Community Server-->缓存
- PKU 1861 最小生成树之KK算法
- Community Server-->多语言版本
- 此dos非彼dos
- Community Server-->异常日志处理
- setsockopt()用法