Environment 64 bit Java on centOS 7.x and RTI 6.0.0 evaluation version
I have the following in a Messages.idl
module binary {
struct DDSBinaryMsg {
long pubNumber; //@key
long long pubTime;
long fileIndex;
long long CRC32;
sequence<octet> image;
};
and use the following to generate to code
rtiddsgen -language Java -replace -package RTIMessages -unboundedSupport-example x64Linux3gcc4.8.2 RTIMessages.idl
In brief, I am selecting an image file for a directory and send it (along with a calculated CRC32) The jpg or png is loaded into the sequence<octet>.
Comparing the size of the file on disk, and the byte[] array lenght with DDSBinaryMsg object ddsMsg or
ddsMsg.image.size() the ddsMsg size is always twice the size on the byte array
So, may question is "What is the size (number of bits) in an octet.?"
Found this - which appears I it might be 8 bit byte vs UTF-8 typer of issue?
Thanks for any help
Never mind. solved it.
Varible declaration: DDSBinaryMsg ddsMsg = new DDSBinaryMsg();
and image is declared a ByteSeq
Incorrect code: ddsMsg.image.addAllByte (binaryElement.getBinaryData());
Correct code: ddsMsg.image.setByte(0, binaryElement.getBinaryData(), 0, imageLen);