Size of Octet/byte RTI 6.0.0

2 posts / 0 new
Last post
Offline
Last seen: 4 years 8 months ago
Joined: 07/26/2019
Posts: 4
Size of Octet/byte RTI 6.0.0

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?

https://community.rti.com/static/documentation/connext-dds/5.3.0/doc/manuals/connext_dds/html_files/RTI_ConnextDDS_CoreLibraries_WhatsNew/index.htm#WhatsNew/WhatsNew530/WhatsNew530.htm#Ability_to_Configure_Wire_IDL_String_Encoding_and_Support_for_UTF-8_Encoding%3FTocPath%3DWhat's%2520New%2520in%25205.3.0%7C_____8

Thanks for any help

 

Offline
Last seen: 4 years 8 months ago
Joined: 07/26/2019
Posts: 4

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);