I am working on one project in which data has to read in binary format but one can put into a structure format. In java Structure is not available. I have send the data in byte array. It also has some structure.
For Example
Packet
int length
int sequence no
MessageData
MessageData MessageHeader MessageBody
MessageHeader int data1 long data2 char[] data3//2bytes char[] data4//3 bytes
Same for MessageBody
But data should be packed in byte array.
One can do in CPP as
#pragma(2) //for word alignment
struct Packet{
int length
int sequence no
MessageData msgdata
}
I have to implement in java.
for reading data I am using Preon library
But for writing data I am still using normal method for packaging data in byte array with help of some function Anybody have work on same kind project or have better idea