深度copy的实现方法
来源:互联网 发布:snmp 监控windows 编辑:程序博客网 时间:2024/05/24 06:13
public Object deepCopy(Object src) throws IOException, ClassNotFoundException{ ByteArrayOutputStream byteOut = new ByteArrayOutputStream(); ObjectOutputStream out = new ObjectOutputStream(byteOut); out.writeObject(src); ByteArrayInputStream byteIn = new ByteArrayInputStream(byteOut.toByteArray()); ObjectInputStream in =new ObjectInputStream(byteIn); Object dest = in.readObject(); return dest; }
这个方法有点耗时,不大推荐使用,建议如果不是特别复杂的话,还是直接新建对象赋值吧,虽然比较笨.
- 深度copy的实现方法
- 对象的深度copy
- Excel 宏的自动 Copy实现方法
- Lua实现深度拷贝(Deep Copy)
- Copy文件的方法
- UIImage的copy方法
- copy的set方法
- 对不同类型assgin,retain,和copy内部实现的方法
- ios对象copy的方法,要实现nscopy协议
- copy constructor的实现
- String copy的实现
- Copy的简单实现
- copy 的实现
- python的copy.copy()和copy.deepcopy()方法
- surface copy 的几个方法
- copy一个数组的方法
- object-c的copy方法
- 无缓冲的copy实现
- 【优化&大师级代码欣赏】Codeforces Round #137 (Div. 2) / 222B Cosmic Tables (矩阵)
- C++ STL 算法精选之查找篇
- sdut 1248
- ZOJ 1221 最短路
- shell脚本调试
- 深度copy的实现方法
- 关于button会提交表单的原因及解决办法
- 制作LOGO的35种方法
- ScreenShot获取指定Activity的截屏,保存到png文件
- hdu2608 0 or 1
- POJ 3164 最小树形图
- 【xtku】设置电脑自动关机 省时省事省心
- win7下oracle命令启动 发生系统错误 5
- java通过JDBC连接数据库.