开发者

Serializable in java [duplicate]

This question already has answers here: 开发者_如何学Python Closed 10 years ago.

Possible Duplicate:

What is the difference between Serializable and Externalizable in Java?

What is the difference between Serializable and Externalizable interface?


Serializable allows an object to be written out in a standard format; there's some control over part of the process, but mostly it's automatic. Externalizable provides much more complete control (e.g., allowing an object that is a table of numbers to be written out as CSV-format data).

Serializable doesn't require you to write any methods (though it might be a good idea) since it is a marker interface. Externalizable requires the writing of methods.


Serializability of a class is enabled by the class implementing the java.io.Serializable

interface. Classes that do not implement this interface will not have any of their state serialized or deserialized.

Externalizable Only the identity of the class of an Externalizable instance is written in the serialization stream and it is the responsibility of the class to save and restore the contents of its instances.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜