Can you please tell me what are the different ways to save an object's state other than using serialization?
There are many, many ways. Here are some of them:
- You can use XMLEncoder to write XML in a generic format
- You can use JAXB to write out a custom, specific XML format
- You can use Serialization to write a generic binary format (which you can influence by implement the Externalizable interface, making that a partially custom format).
- You can write out your data manually in a custom binary format using a DataOutputStream
- You can write out your data manually in a custom text format using Writers
It's always a trade-off between:
- amount of code to write
- ease of manipulation of the data
- human readability of the output
- size of the output file