简体   繁体   English

类对象上的JVM行为实现可序列化的接口

[英]JVM behaviour on the object of a class implement serializable interface

我的问题是,当我们拥有实现接口可序列化的类时,当我们通过网络发送该类的对象时,JVM是否将对象的副本复制到内存中,或者JVM如何通过“保持对象的状态”的含义进行行为。

interface serializable is a marker interface, it indicate to JVM that objects of this class (which implements serialized) can be persisted to any stream (file or pushed on network socket). interface serializable接口是标记接口,它向JVM指示可以将此类的对象(实现序列化)持久化到任何流(文件或在网络套接字上推送)。 Whenever asked for serialization JVM writes the state of that object on the given stream and original object is kept or discarded will depend of the scope (life) of that object; 每当要求进行序列化时,JVM都会在给定的流上写入该对象的状态,而原始对象的保留或丢弃将取决于该对象的范围(生存期)。 so no question of JVM making making copy in memory or not. 因此,毫无疑问,JVM是否在内存中进行复制。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 实现可序列化为实现接口的类 - Implement Serializable to a class implementing an Interface 声明class时需要实现Serializable接口吗? - It is required to implement Serializable interface when declaring a class? 可序列化对象中的所有类引用都应实现可序列化吗? - Should All Class References in a Serializable Object Implement Serializable? 我们应该在休眠状态下创建Domain Class时实现Serializable接口吗 - Should we implement Serializable interface while making Domain Class in hibernate jsonschema2pojo使生成的类实现Serializable接口 - jsonschema2pojo make generated class implement Serializable interface 为什么我们要实现Serializable接口,然后在同一类中添加readResolve - Why should we implement Serializable interface and then add readResolve in same class 如何发送 object 未在 java DatagramSocket 中实现 Serializable 接口 - How to send an object does not implement Serializable interface in java DatagramSocket 实现Serializable接口的Java类 - Java classes that implement the Serializable interface 具有可序列化和自定义接口的可序列化对象的Java RuntimeException - Java RuntimeException for serializable object with Serializable and Custom Interface 可序列化的 Object.class - Serializable Object.class
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM