public class ObjectUtil {
public ObjectUtil() {
}public static Object deepCopy(Object orig) throws IOException, ClassNotFoundException {
ByteArrayOutputStream bos = new ByteArrayOutputStream();
ObjectOutputStream oos = new ObjectOutputStream(bos);
oos.writeObject(orig);
oos.flush();
ByteArrayInputStream bin = new ByteArrayInputStream(bos.toByteArray());
ObjectInputStream ois = new ObjectInputStream(bin);
return ois.readObject();
}
}
【深拷贝工具】
推荐阅读
- 后台|NATAPP内网穿透通过nginx实现一个端口访问多个不同端口服务
- pom.xml文件第一行报错
- 项目启动是生成超管名字和密码
- go|golang替换掉字符串里面的换行符\n
- go|安装go ------protobuf