4.5. Object Persistence and Object Serialization
Data that can be read or written ranges from individual bytes to primitive datatypes and strings. If you wanted to, for example, write a data structure (such as a sequence of data records, composed of individual fields) out to a file, you could do so. But what if you wanted to store an entire object, composed of a series of member variables?
To do this would require that each field of the object be written individually; then at a later time, each field would be read back and assigned to an object. This is a complicated process, particularly if some member variables are marked as private or protected. Yet saving data is one of the most important functions of software—unless you're writing trivial ...
Get Java™ Network Programming and Distributed Computing now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.