package com.manage.util;

import java.io.*;

/**
 * @ProjectName:
 * @Description:
 * @Param 传输参数
 * @Return
 * @Author: 曾文和
 * @CreateDate: 2019/11/6 10:03
 * @UpdateUser: 曾文和
 * @UpdateDate: 2019/11/6 10:03
 * @UpdateRemark: 更新说明
 * @Version: 1.0
 */
public class BeanMapperUtils {
    /**
     * 使用序列化技术实现深拷贝
     * @return
     */
    public static Object deepClone(Object object) throws IOException,ClassNotFoundException{
        //将对象写入流中
        ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
        ObjectOutputStream objectOutputStream = new ObjectOutputStream(outputStream);
        objectOutputStream.writeObject(object);
        //从流中取出
        ByteArrayInputStream inputStream = new ByteArrayInputStream(outputStream.toByteArray());
        ObjectInputStream objectInputStream = new ObjectInputStream(inputStream);
        return objectInputStream.readObject();

    }
}
