publicstatic<T> T clone(T obj) throws Exception {
ObjectOutputStream oos = null;
ByteArrayOutputStream bos = null;
ObjectInputStream ois = null;
bos = new ByteArrayOutputStream();
oos = new ObjectOutputStream(bos);
oos.writeObject(obj);
oos.flush();
ois = new ObjectInputStream(newByteArrayInputStream(bos.toByteArray()));
return (T) ois.readObject();
}
本文出自 “小李广之博客” 博客,请务必保留此出处http://6817977.blog.51cto.com/6807977/1585899
原文地址:http://6817977.blog.51cto.com/6807977/1585899