I am using the Naga library to read data from a socket, which produces byte[] arrays which are received via a delegate function.
My question is, how can I convert this byte array into specific data types, knowing the alignment?
For example, if the byte array contains the following data, in order:
| byte | byte | short | byte | int | int |
How can I extract those data types (in little endian)?
I’d suggest you have a look at the
ByteBufferclass (specifically theByteBuffer.wrapmethod and the variousgetXxxmethods).Example class: