How to read/write objects from/to streams.