I have three agents, each is running in their own JVM. The first agent writes objects to a stream that the second reads. The second agent needs a way to read objects from a stream, and store the content of any objects not known to the JVM as a byte array so it can write the objects to the stream that the third agent (who knows of all objects) reads. The third agent can read the stream and deserialise all the objects received through it; it can do this without knowing whether the second agent did or did not know about the objects.
Hence my questions. How do I deserialise: 1. unknown objects (stream information that generates ClassNotFoundException) as byte arrays? and 2. how do I do this for class names (objects of type Class) where the named class cannot be resolved?
I found this, but it only tells me how to serialise objects as a byte array on the sending agent and deserialise them on the receiving agent; it tells me nothing about how I must control the streams in order to handle undefined objects or unknown class names.
Perhaps an agent needs to manipulate control information written to a stream so non-existent objects can be stored as an array of bytes that can be inserted at the appropriate time when the agent writes the array to an output stream as part of the usual stream data.
Any pointers to information that may give me a clue about how this is done would be appreciated.