java.io.serializable

The Serializable interface defines no methods or constants. A class should implement this interface simply to indicate that it allows itself to be serialized and deserialized with ObjectOutputStream.writeObject( ) and ObjectInputStream.readObject( ).

Objects that need special handling during serialization or deserialization may implement one or both of the following methods; note, however, that these methods are not part of the Serializable interface):

private void writeObject(java.io.ObjectOutputStream out) throws IOException;
private void readObject(java.io.ObjectInputStream in) throws IOException,
ClassNotFoundException;

Typically, the writeObject( ) method performs any necessary cleanup or preparation for serialization, invokes the defaultWriteObject( ) method of the ObjectOutputStream to serialize the nontransient fields of the class, and optionally writes any additional data that is required. Similarly, the readObject( ) method typically invokes the defaultReadObject( ) method of the ObjectInputStream, reads any additional data written by the corresponding writeObject( ) method, and performs any extra initialization required by the object. The readObject( ) method may also register an ObjectInputValidation object to validate the object once it is completely deserialized.

public interface Serializable {
}
 
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值