Message fields on bit boundaries?

K

Ken

Hi.

I need to create a message that contains several fields of various
data types. Each field needs to be aligned on a particular bit
boundary inside the message. IOW, an integer field may need to be
from bit 0 to bit 31, then a char field may need to be from bit 32 to
bit 39, etc. I'm fairly new to Java, but I'm thinking the solution has
something to do with Buffers and/or ByteBuffers in the NIO API.

Any guidance as to where to look--and if I'm on the right track--would
be greatly appreciated.

Thanks!

Ken
 
T

Thomas Fritsch

Ken said:
Hi.

I need to create a message that contains several fields of various
data types. Each field needs to be aligned on a particular bit
boundary inside the message. IOW, an integer field may need to be
from bit 0 to bit 31, then a char field may need to be from bit 32 to
bit 39, etc. I'm fairly new to Java, but I'm thinking the solution has
something to do with Buffers and/or ByteBuffers in the NIO API.
Not necessarily. A simpler solution would be to use a DataOutputStream
and its various writeXxx(...) methods.
See the javadoc of class java.io.DataOutputStream
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,581
Members
45,057
Latest member
KetoBeezACVGummies

Latest Threads

Top