Breaking News
Home / Java / Java Tutorials / How to Serialize Object to File and Read Back?

How to Serialize Object to File and Read Back?

Serialization Java TutorialObject Serialization is a simple way to store the state of an object into an byte stream. This stream can stored into a file. The reverse is called Object De-Serialization, which is restoring the object to its state by reading the serialized stream. Java provides in built implementation to serialize & de-serialize the object via ObjectOutputStream and ObjectInputStream classes. However for more control on how the object serializes custom Serializer’s can be implemented.

Serialize Object to File

The following snippet shows how to Serialize a object to a file stream and then how to de-serialize the stream and reconstruct the object with the same state.

 [pb_builder]

Check Also

How to enable Java in Internet Explorer 8.0?

If the Java Plugin is not installed or enabled the applet would not run in …

Advertisment ad adsense adlogger