Explain the ways to serialize the java object.- To serialize an object means to convert its state to a byte stream so that the byte stream can be reverted into a copy of the object.
- A Java object is serializable if its class or any of its superclasses implements either the java.io.Serializable interface or its subinterface, java.io.Externalizable.
- For example, the java.awt.Button class implements the Serializable interface, so it can serialize a java.awt.Button object and store that serialized state in a file.
- Later, you can read back the serialized state and deserialize into a java.awt.Button object.
Object serialization could be used in different ways:
1. Simple persistence of the object 2. Reading from and writing to files 3. RMI technology for communicating across hosts.
- The encryption and decryption is left to the network transport. SSL or the like can be used when a secured channel is needed.
|