java - 序列化的疑惑
高洛峰
高洛峰 2017-04-18 09:29:38
0
2
458

1.为什么序列化可以保存对象的状态?
2.为什么网络传输要用序列化的对象,不序列化会怎么样?
3.除了objectoutputstream类中,有对序列化接口的判断,还有哪些类中有判断,为什么实现了序列化接口就可以序列化

高洛峰
高洛峰

拥有18年软件开发和IT教学经验。曾任多家上市公司技术总监、架构师、项目经理、高级软件工程师等职务。 网络人气名人讲师,...

reply all(2)
大家讲道理

The process of serialization is the process of saving the information of the object in the memory to a file or other storage medium. Normally, what serialization exports is the object information and all the values ​​​​that make up the object variables in the current memory.
Two machines connected through the network cannot share memory information. After converting the object information into a data stream through serialization, it can be transmitted through the network.
In Java, the serialization interface is only used to mark whether an object accepts serialization. The serialization process has been completed by Java, so serialization can be achieved by implementing the serialization interface.

伊谢尔伦

Serialization is to save data according to its own rules so that people can exchange the data with each other.
Network transmission does not require serialized objects. For example, if the client uses Java, but the server uses PHP, serialization is meaningless because PHP cannot parse it at all. Another situation is that your client and server are both Java, but the Bean package names are different and they cannot be resolved. The meaning of serialization is to be able to cross platforms.
Personal humble opinion.

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