Serializing Object Graphs
If you have a graph of objects where each node can be serializable, the parent node can call DataOutput::writeObject to delegate the serialization responsibility to its child nodes. Similarly, your application can call DataInput::readObject to deserialize the object graph.
Serializing and Accessing Data as a Blob
If you have data that is best handled as a blob, such as structs that do not contain pointers, use the serializable type CacheableBytes . CacheableBytes is a blob class that implements the serialization for you.