序列化 serialization

2018-07-03 15:47 更新

Serialization is a mechanism by which you can save the state of an object by converting it to a byte stream.

JAVA中實現(xiàn)serialization主要靠兩個類:

  • ObjectOuputStream
  • ObjectInputStream

他們是JAVA IO系統(tǒng)里的OutputStream和InputStream的子類

自定義序列化的作用如下:

  1. Persist only meaningful data.
  2. Manage serialization between different versions of your class.
  3. Avoid exposing the serialization mechanism to client API.

Reference

以上內容是否對您有幫助:
在線筆記
App下載
App下載

掃描二維碼

下載編程獅App

公眾號
微信公眾號

編程獅公眾號