Discover the secrets of the Java Serialization API
Popularity Report
![]() |
|||
![]() |
|||
![]() |
|||
![]() |
|||
![]() |
|||
![]() |
URL Tag Cloud
Groups (1)
Bookmark History
Saved by 9 people (2 private), first by anonymouse user on 2006-07-15
- Quekshuy on 2008-07-11 - Tags java , serialization , tutorial
- Bonniecpk on 2008-04-30 - Tags imported , java
- Atinsood on 2008-03-20 - Tags java , serialization , tutorials
- Bera_saroj on 2007-11-10 - Tags corejava
- Harryli on 2007-08-13 - Tags no_tag
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


Public Comment