java 实体类序列化
迷茫
迷茫 2017-04-18 09:14:06
0
2
517

一直不是很懂很多写实体类实现序列化 是干嘛 有什么好处?

迷茫
迷茫

业精于勤,荒于嬉;行成于思,毁于随。

reply all(2)
PHPzhong

When a class is written, it just lies in a text file with the .java suffix. Simply put, it is on the hard disk.
The written Java file is compiled into a .class file and then loaded and run by the Java virtual machine.
When running, classes are represented in memory. Instances generated by the new keyword also exist in memory.
Instances of classes have a certain storage format in memory (you can refer to the Java virtual machine specification, object storage format), which is different from the storage format when it is lying on the hard disk before it is run.

Serialization is to store an instance in memory on the hard disk in another storage method (refer to "Core Java"). In other words, it is called Persistence.

In this way, as long as others get the data of this serialized instance, they can restore the current state of the object through deserialization.

There are many serialization application scenarios, such as rmi and rpc. You can refer to relevant information.

巴扎黑

1.rmi (remote method invocation). When delivering messages to remote objects, object serialization is required to pass parameters and return values.
2. Implement lightweight persistence by writing the serialized object to disk and then reading it out when the program is run again.

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template