Skip to content

Latest commit

 

History

History

example-02-java-serialization

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 

SE325 Example 02 - Java Serialization

This project contains an example of how to serialize instances of Java classes, and how to send serialized data over a TCP connection.

The Employee, Manager, and EmployeeRequest classes (in the employees package) each implement the Serializable interface (or in the case of Manager, extend from a class which does). This tags them as being eligible for serialization.

Each member (instance variable) within these classes is also serializable. Therefore, we can serialize (marshall) and deserialize (unmarshall) instances of these classes using ObjectOutputStream and ObjectInputStream, respectively. This is demonstrated in the Client and Server classes in the tcp package, and also in the TestEmployees unit test.