Java中的序列化需求是什么? [英] What is the need of serialization in Java?

查看:43
本文介绍了Java中的序列化需求是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

谁能告诉我Java中对序列化的需求是什么,并给我一个示例场景来说明需求?(我已经了解了什么是序列化,我只想了解何时使用它.)

Can anyone tell me what is the need of Serialization in Java and give me an example scenario to explain the need? (I already understand what serialization is, I just want to understand when you'd use it).

推荐答案

在需要通过网络发送数据或存储在文件中时,通常使用序列化.数据是对象,而不是文本.

Serialization is usually used When the need arises to send your data over network or stored in files. By data I mean objects and not text.

现在的问题是您的网络基础结构和硬盘是可以理解位和字节但不能理解JAVA对象的硬件组件.

Now the problem is your Network infrastructure and your Hard disk are hardware components that understand bits and bytes but not JAVA objects.

序列化是将Java对象的值/状态转换为字节,以便通过网络发送或保存它.

Serialization is the translation of your Java object's values/states to bytes to send it over network or save it.

这类似于您的语音在PSTN电话线上的传输方式.

This is analogous to how your voice is transmitted over PSTN telephone lines.

这篇关于Java中的序列化需求是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆