The process of writing an object into a stream is a serialization (serilization) process, but in the Java programming Circle it is also very visually called a "frozen" or "pickled pickle" process, while the parallelization (deserialization) process of reading an object from the stream is called "thawing" or "fresh". Process. It should be noted that a copy of the object is written into the stream, and the original object still exists inside the JVM, so "pickle" is just a copy of the object.
In the Java language, a deep copy of an object can often be made by implementing the Serializable interface, and then the object (actually a copy of the object) is written into a stream (pickled into pickles) and then read back from the stream to reconstruct the object.
public class Deepcopydemo implements Serializable{public Object Deepclone () throws exception{// Write the object into the stream Bytearrayoutputstream bo=new bytearrayoutputstream (); ObjectOutputStream oo=new ObjectOutputStream (bo); O O.writeobject (this);//Read the object out Bytearrayinputstream bi=new bytearrayinputstream (Bo.tobytearray ()); ObjectInputStream Oi=new ObjectInputStream (BI); return (Oi.readobject ());}}
Deep copy of Java objects----deep replication with serialization