serialization
8 tutorials tagged “serialization”.
- Externalizable Interface in JavaExternalizable gives a class full control over its serialized form through writeExternal and readExternal. Learn how it differs from Serializable.
- ObjectInputStream and ObjectOutputStreamObject streams write whole Java objects to a stream and read them back. Learn writeObject and readObject, the Serializable requirement, and the risks.
- Serializable Interface and serialVersionUIDSerializable marks a class as serializable, and serialVersionUID identifies its version. Learn why to declare it, with an InvalidClassException demo.
- Serialization and Deserialization in JavaSerialization turns a Java object into bytes and deserialization rebuilds it. Learn how it works, what gets saved, object graphs, and when to use it.
- Serialization with Inheritance and Object ReferencesHow serialization treats superclasses that aren't Serializable, shared references, and cycles, so each object is written once and restored correctly.
- Serialization Security Risks and AlternativesWhy deserializing untrusted data is dangerous, how ObjectInputFilter limits the risk, and why modern Java code prefers JSON and other formats.
- Serializing Records in JavaRecords serialize differently: only their components are saved, and deserialization always goes through the canonical constructor, so validation runs again.
- Transient Keyword in JavaThe transient keyword tells serialization to skip a field. Learn when to use it for passwords, caches and non-serializable objects, and how to restore it.