Post

Serialization

✅ Serialization

converting the state of an object into a byte stream

  • all PCs would have different virtual memory according to their OS
  • so reference types cannot travel across a network, need to be serialized
  • transmit object data in forms of address❌ byte⭕️
  • serialized data becomes primitive data

👍🏻 Save/persist state of an object.
👍🏻 Travel an object across a network.

Screenshot 2024-07-30 at 11 20 00

🛠️ How to serialize

  • implement java.io.Serializable interface

✔️ SerialVersionUID

version number of serialization
used during Deserialization to verify that sender and receiver of a serialized object have loaded classes for that object which are compatible with respect to serialization

💡 Reference

https://soheeparklee.github.io/posts/JAVA_4serverClient/

This post is licensed under CC BY 4.0 by the author.