I want to use Preon for project that communicates with a server written in C. The protocol depends on the native endianess of the machine (you can solve with thisjava.nio.ByteOrder.getNative()
under the assumption that the JVM has the same endianess as the server) and uses uint64_t
for data lenghts and int32_t
for status codes (a negative value indicates an error).
I couldn't find information about signedness in the Preon documentation. I had a quick look at the source code and found that nl.flotsam.preon.buffer.DefaultBitBuffer
uses signed shifts (<<
and >>
) and the javadoc comments of several methods in nl.flotsam.preon.buffer.BitBuffer
also indicate that it uses signed integers, but the javadoc comment nl.flotsam.preon.buffer.BitBuffer
says that BitBuffer
uses unsigned integers. This confused me.
What is the default integer format of Preon? How do I represent uint64_t
and int32_t
?