本页地址:http://blog.csdn.net/lpy3654321/article/details/43054557
java 深clone对象的另一种方法
public static <T> T deepCopy(T 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); T dest = (T) in.readObject(); return dest; }
转载:http://blog.csdn.net/applepop/article/details/5702432
原文地址:http://blog.csdn.net/lpy3654321/article/details/43054557