- 浏览: 727869 次
- 性别:
- 来自: 上海
文章分类
- 全部博客 (419)
- 杂软粉墨 (2)
- 创意灵感 (3)
- 经验记录 (137)
- 开源轨迹 (2)
- sip-communicator (2)
- 闲侃杂谈 (8)
- 问题交流 (24)
- 概念模式 (32)
- 难点备案 (5)
- JwChat (1)
- 中国象棋 (1)
- 教育探索 (6)
- 英语研究 (58)
- 星际争霸 (1)
- 电信知识 (1)
- 软件架构 (3)
- 哲学探索 (26)
- 算法灵魂 (8)
- 近视探索 (6)
- 数学数学 (3)
- 牛角钻尖 (23)
- 至强文言 (3)
- 数据结构 (1)
- 宇宙物理 (2)
- 网络架构 (3)
- 游戏领域 (4)
- 图形处理 (2)
- 修炼之路 (8)
- 读书天地 (20)
- 编解乱码 (2)
- 概念探索 (8)
- 格物致知 (1)
- 其它语言 (1)
- 测试领域 (3)
- 文化风流 (1)
- JQuery (1)
- 網頁領域 (1)
- Unix/Linux (1)
- Inside JVM (1)
- 异常分析 (1)
最新评论
-
suyujie:
引用
HTML <a> 标签灰显禁用 -
suyujie:
HTML <a> 标签灰显禁用 -
suyujie:
HTML <a> 标签灰显禁用 -
suyujie:
HTML <a> 标签灰显禁用 -
iamzhoug37:
您能说一下"局部变量不受文本顺序限制" 是 ...
声明前为什么能赋值却不能输出,都是使用
static public Object deepCopy(Object oldObj) { ObjectOutputStream oos = null; ObjectInputStream ois = null; try { ByteArrayOutputStream bos = new ByteArrayOutputStream(); oos = new ObjectOutputStream(bos); // serialize and pass the object oos.writeObject(oldObj); oos.flush(); ByteArrayInputStream bin = new ByteArrayInputStream(bos.toByteArray()); ois = new ObjectInputStream(bin); // return the new object return ois.readObject(); } catch (Exception e) { System.out.println("Exception in ObjectCloner = " + e); return null; } finally { try { oos.close(); ois.close(); } catch (Exception e) { return null; } } }
as you see, it's the way of making deep copy, just by streams of input and out, first output and then input and last the product object.
here, one problem, why is the parameter of the first constructor of the inputstream chain the bos but oos?
cuz bos locates in the end part of the outputstream chain, it's the most out part of the decorator, right!?
发表评论
-
NullPointerException in ternary operator
2013-01-19 00:01 1070java代码: Integer i = null; ... -
why concrete class must implement abstract method while abstract class need not
2011-05-11 13:27 1470yes, just as the title...why co ... -
Enum singleton - Elvis Stealer
2011-04-26 14:41 1602import java.io.ByteArrayInputSt ... -
why can inner class be instantiated in this way?
2011-04-06 10:24 967public class Outer { pub ... -
into native source code
2011-03-23 23:09 907once there was a problem occurr ... -
about Thread.join method
2011-03-23 08:09 1227import java.util.Timer; import ... -
why is static inner class singleton thread safe?
2011-03-15 09:03 1416http://en.wikipedia.org/wiki/In ... -
why string concatenation yields no interned one
2011-03-14 16:48 1080public class Test { public st ... -
why can bit mask suppress sign extention
2011-03-10 09:16 1139yes, bit mask can suppress sign ... -
About gc two objects which are inter referenced to each other
2011-03-08 11:00 995my workmate told me such a sena ... -
circumvents exception checking
2011-03-03 11:02 924import java.io.IOException; ... -
关于维基中singleton pattern的一段
2011-02-24 10:00 1062Another notable difference is t ... -
why List hasn't clone method but the ArrayList has
2011-02-16 15:27 1121List list = new ArrayList(); ... -
Java is Pass-by-Value
2011-02-14 13:28 1028This often heard saying is not ... -
不是说字符串不可变吗
2011-02-14 11:28 865from csdn: http://topic.csdn.ne ... -
没有实现抽象方法的具体类居然编译通过了
2011-02-04 22:29 932来自csdn: http://topic.csdn.net/ ... -
关于iterator的fail-fast
2011-01-20 11:15 954是使用集合的iterator后,再改变就可能抛出这个异常 ... -
生成几个String的问题
2011-01-11 16:26 979public class Test extends java. ... -
无符号右移>>>
2011-01-11 15:46 2303public class Test { public st ... -
Struts2之log信息不出的问题
2010-12-30 11:18 2966刚开始学习Struts2的时候,用的是maven方式,但是却不 ...
相关推荐
android 浅复制和深复制-Java Generic Deep Copy 篇
10_numpy的_copy_&_deep_copy_(教学教程)
浅拷贝和深拷贝深入理解(shallow copy VS deep copy) 本文重点讨论引用类型变量的拷贝机制和实现
php-myclabs-deep-copy-1.10.1-1.el7.remi.noarch.rpm
接触python有一段时间了,一直没有系统的学习过,也对copy,deepcoy傻傻的分不清,故抽出时间来理一下。 下面这篇文章主要给大家介绍了关于python中copy()与deepcopy()的区别的相关资料,需要的朋友可以参考下
真是软磨硬泡啊,印象最深的就是作者讲解deep copy and shadow copy 还有 const come in serial area,太棒了,本书初版发行于2000年,是以C++99为标准的。 Core C++ A Software Engineering Approach Victor Shtern...
1.Difference between shallow copy and deep copy? 浅复制和深复制的区别? 答案:浅层复制:只复制指向对象的指针,而不复制引用对象本身。 深层复制:复制引用对象本身。 意思就是说我有个A对象,复制一份...
在Python中,浅拷贝(shallow copy)和深拷贝(deep copy)是用于创建对象副本的两种常见方式。它们可以应用于不同类型的对象,如列表、字典、集合等。下面是对浅拷贝和深拷贝的描述: 浅拷贝:浅拷贝是创建一个新...
Deep Copy, page 459 Solution to Programming Project 10.5, page 469 Chapter 11 Avoiding Multiple Defi nitions with #ifndef, page 484 Solution to Programming Project 11.5, page 512 Chapter 12 Walk...
One step at a time, you'll build and extend your skills--even mastering advanced techniques such as complex model migration, deep copy, background processing, and integration with Dropbox, StackMob, ...
One step at a time, you'll build and extend your skills--even mastering advanced techniques such as complex model migration, deep copy, background processing, and integration with Dropbox, StackMob, ...
One step at a time, you’ll build and extend your skills--even mastering advanced techniques such as complex model migration, deep copy, background processing, and integration with Dropbox, StackMob,...
3.9. * copy ——Shallow and deep copy operations 18 4. 函数 20 4.1. 什么是函数? 20 4.2. 函数的用处 20 4.3. 函数中的参数传递 20 4.4. 默认参数 20 4.5. 不定长参数 21 4.6. 递归函数 21 4.7. 拓展知识:...
深度复制基于TypeScript的Deep-copy(aka克隆)实用程序功能。 在探索。安装npm i deep-copy-ts用法import { deepCopy } from "deep-copy-ts" ;const obj = { // Primitive value a : 1 , b : "b" , c : { a : [ { a...
if (deep && copy && (isPlainObject(copy) || (copyIsArray = isArray(copy)))) { if (copyIsArray) { copyIsArray = false; clone = src && isArray(src) ? src : []; } else { ...
deep-copy-all 一种快速,紧凑且强大的方法来深度复制所有JavaScript数据类型 深度复制所有JavaScript对象深度克隆器是: 快速–在普通基准速度测试中排名很高 紧凑–约5k(最小) 强大–正确处理所有标准...
json-deep-copy JSON样式对象的快速深层复制。 特征 简化的lodash.deepClone,复制许多已编译的对象时可能快15倍。 仅支持带有数字,字符串,数组,布尔值的普通对象 用 npm i json-deep-copy const deepCopy = ...
<param name="bRecurseIntoSubClasses">A boolean flag that when true performs a deep copy of the parameters, otherwise a shallow copy is performed.</param> <returns>An object that represents the ...
You can also define whether lists can give away, give and keep a copy (`clone`), and receive elements. * name: `String` — group name * pull: `true|false|'clone'|function` — ability to move from ...