`
- 浏览:
220146 次
- 性别:
- 来自:
北京
-
java 代码
- private PersonAggregateData copyAggregate(PersonAggregateData original) throws EventsPersonManagementException {
-
- ByteArrayOutputStream outputBytes = new ByteArrayOutputStream();
- ObjectOutputStream out = null;
- ObjectInputStream in = null;
- PersonAggregateData copy;
- try {
- out = new ObjectOutputStream(outputBytes);
- ByteArrayInputStream inputBytes;
- out.writeObject(original);
-
- inputBytes = new ByteArrayInputStream(outputBytes.toByteArray());
- in = new ObjectInputStream(inputBytes);
- copy = (PersonAggregateData) in.readObject();
- } catch (IOException e) {
- throw new EventsPersonManagementException("errors occur while copying the PersonAggregateData", e);
- } catch (ClassNotFoundException e) {
- throw new EventsPersonManagementException("errors occur while copying the PersonAggregateData", e);
- } finally {
- try {
- if (out != null) {
- out.close();
- }
- if (in != null) {
- in.close();
- }
- } catch (IOException e) {
- throw new EventsPersonManagementException("errors occur while copying the PersonAggregateData", e);
- }
- }
- return copy;
- }
分享到:
Global site tag (gtag.js) - Google Analytics
相关推荐
深拷贝:指的是拷贝一个对象时,不仅仅把对象的引用进行复制,还把该对象引用的值也一起拷贝。如果引用类型里面还包含很多引用类型,或者内层引用类型的类里面又包含多层...这时我们可以用序列化来实现对象的深拷贝。
.NET框架中,System.Xml.Serialization 命名空间包含着用来将对象序列化为XML的文本或流的对象。
此压缩包包含12个项目,每个项目都着重讲解Boost::Serialization一个方面的使用技巧,有详细的代码介绍具体使用方法。
要使用.NET进行对象的序列化,必须在解决方案中添加System.Xml的引用,并且在类文件中引入System.Xml.Serialization命名空间。... 如果对XML Serialization缺少了解,请首先参考拙文:在.NET中实现对象序列化
sirenix.serialization.dll
System.Runtime.Serialization.DLL
C++11 下使用 Boost.Serialization 库实现智能指针的序列化
System.Runtime.Serialization.dll System.Runtime.Serialization.dll System.Runtime.Serialization.dll
hystrix-serialization-1.5.18.jar
kotlinx-serialization-compiler-plugin.jar
数据的序列化和反序列化 Serialization DeSerialization
- 整个代码由一个头文件组成 json.hpp,没有子项目,没有依赖关系,没有复杂的构建系统,使用起来非常方便 - 语法直观,就像写普通的c++代码 - 不止用起来似c++习惯和风格,更是使用 C++ 11 标准编写 ...
二进制序列化:对象序列化之后是二进制形式的,通过BinaryFormatter类来实现的,这个类位于System.Runtime.Serialization.Formatters.Binary命名空间下。 SOAP序列化:对象序列化之后的结果符合SOAP协议,也就是可以...
akka-kryo-serialization, 基于Kryo的Akka序列化 akka-kryo-serialization-- Scala 和Akka基于kryo的序列化程序这个库为 Scala 和Akka提供定制的基于kryo的序列化程序。 它可以用于更高效的akka远程处理。它还可以...
Kotlin cross-platform / multi-format reflectionless serialization Kotlin serialization consists of a compiler plugin, which automatically produces visitor code for classes, and runtime library, ...
Matlab序列化使用未记录的 mex 函数mxSerialize和mxDeserialize构建的 Matlab 对象序列化函数。 该函数可以将任何普通的 matlab 变量转换为 uint8 数组。 这些函数不受支持,并且可能会在未来的 Matlab 版本中随时...
.net2.0版本的json操作类 ...System.Web.Script.Serialization的json操作类,位于3.0以上的System.Web.Extensions类库中. 本项目是从System.Web.Extensions中剥离出System.Web.Script.Serialization的完整项目
一、实现深拷贝方法 using System.IO; using System.Runtime.Serialization; namespace DeepCopyExp { class DeepCopy { public static T DeepCopyByDCS(T obj) { T newObject; using (MemoryStream ...