Archived

This forum has been archived. Please start a new discussion on GitHub.

Question about of readObject() in Streaming Interface

I would like to ask, how to implement ReadObjectCallback in java and how to use the readObject(ReadObjectCallback) to get the Object in the Ice.Inputstream ?
Does any example about this ? because i found that it only had few example about the Streaming in the Ice Book. Thanks !!!!!!:)

Comments

  • mes
    mes California
    Hi,

    We don't have any sample applications that demonstrate the readObject method, but you could look at the C++ source code for the Python and PHP extensions, both of which use it.

    The callback is necessary because of the way objects are encoded in the Ice protocol. Specifically, the object's encoded state may not be present at the point you call readObject; instead, the encoding might contain an identifier for the object, whose state is actually encoded much later in the stream. Therefore, you need to supply a callback that is notified when the object's state is eventually unmarshaled. Your callback object must implement the ReadObjectCallback interface, but the callback must also contain enough state to allow you to process the Ice object appropriately.

    This is complicated by the fact that there can be multiple references to the same object (e.g., in a sequence, or as members of a data structure, etc.). You'll have to devise a mechanism for tracking these references and updating them when the object finally becomes available, and as I mentioned you can find examples of this in the Python and PHP extensions.

    Hope that helps,
    - Mark
  • Thx

    Thanks a lot !!!:D