Skip to main content

Discover the secrets of the Java Serialization API

Popularity Report

Total Popularity Score: 0

Loading...
Loading...
Loading...
Loading...
Loading...
Loading...

Rank

Groups (1)

  • javalovers

    java lovers

    16 members,107 bookmarks

    all about java and its key concepts

Bookmark History

Saved by 9 people (2 private), first by anonymouse user on 2006-07-15


Public Sticky notes

the object's class file and methods are not saved; only the object's state is saved.

Highlighted by cklee75

First, the object is checked to ensure it implements Serializable and then it is checked to see whether either of those private methods are provided. If they are provided, the stream class is passed as the parameter, giving the code control over its usage

Highlighted by cklee75

To stop the automatic serialization, you can once again use the private methods to just throw the NotSerializableException

Highlighted by cklee75

if the state of the written object is written and then written again, the new state will not be saved

Highlighted by cklee75

First, you could make sure to always close the stream after a write call, ensuring the new object is written out each time. Second, you could call the ObjectOutputStream.reset() method

Highlighted by cklee75

If you wish to control versioning, you simply have to provide the serialVersionUID field manually and ensure it is always the same, no matter what changes you make to the classfile.

Highlighted by cklee75

the system may not garbage collect the objects written to a stream if the stream is not closed

Highlighted by cklee75

Object serialization is the process of saving an object's state to a sequence of bytes, as well as the process of rebuilding those bytes into a live object at some future time. The Java Serialization API provides a standard mechanism for developers to handle object serialization. The API is small and easy to use, provided the classes and methods are understood.

Highlighted by harryli