I'm trying to find a reliable way to send control messages that obey a defined protocol in order to tell the server what kind of data he will receive. For example, I want to send a pure text message to invoke a remote method:
#METHOD1#CLOSE#
or I want to send a serialized object to the server:
#OBJECT# .......here comes the serialized object data....#CLOSE#
So basically I just want to send string control messages that are completely independent of the stream content that follows.
By wrapping an input stream into a Scanner object I'm able to extract strings from the input stream, but if this stream is a serialized object then the object can't be restored afterwards. Thanks for any help.