posted 13 years ago
Serialization means converting a Java object that's in memory to bytes (binary data) so that you can store it (to be loaded again later) or to transmit it over the network.
In the project that I'm currently working on, we are building a system that can work in a clustered way - there can be multiple servers in the system that work together. Sometimes these servers need to share data, and we do that by serializing objects containing the data, sending the bytes to the other server over the network, and then deserializing the bytes back into a Java object on the other server.
Note that the standard Java serialization mechanism is not well suited for long-term storage of objects. Don't write a program in which the user's data is stored in files by using Java's built-in serialization mechanism. The problem is that the serialization mechanism very tightly binds your source code to the bytes that are stored in the file - if you change something to your classes in a newer version of your program, then it will not be able to load old files anymore. Also, the exact format of serialized data is not easy to understand (I guess the specifications are available somewhere, but it's not a well-known standard format). For such applications, it's much better to use a standard format (XML for example, or any other standard format).