javaBean的克隆  

 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();

    }


你可能感兴趣的:(java,copy,javabean)