Hello,
How can I take advantage of RTI's APIs in order to convert a data sample object which I read using a DataReader into a byte array and vice versa (in Java)?
I would like to save the binary serialized object to file and then be able to read it again into object.
Thanks
David
Hi,
The serialize/deserialize of a Typed object happens in code auto-generated by rtiddsgen. They are keyword public, not but part of the public API. We don't supply any documentation on how to use them.
Unfortunately, they only return a CDR Output Stream object (CdrOutputStream) and not a byte array. CdrOutputStream may have a .getBytes(...):byte[] but it isn't documented.
It should be possible using rtiddsgen2 (experimental, distributed with 5.1.0 only) to write your own serialization/deserialization stubs using the existing serialize/deserialize template as (*cough*) a template. This would then allow rtiddsgen2 to auto-generate Type-specific marshaling code for you. If I were to attempt this, I would go all in and make FooType "serializable" by implementing the java.io.Serializable interface.
rip