raydac/java-binary-block-parser

Could you please add unsigned int32 support?

nikita-sheremet-clearscale opened this issue · 4 comments

Yes, a readme contains a link t example of defining some unsigned integer. But why do not include it? As user I have to copy this from different sources on Internet. Unsigned int is needed. You have a lot experience with JBBP - adding unsigned int32 will not take a lot of time.

could you show some use case where unsigned int32 would be useful? because in Java we don't have unsigned int and how are you going to use it?

I have to parse some data serialized by python which has such type. So for pure java there is no use case but when you parse data from another language it is useful.

We wanted to use JBBP but had to rethink because of it not being able to handle unsigned 8/16/32 bit. Many bit protocols contain unsigned variables.

Here is gist I found trying to solve it by representing uint32 as a long:
https://gist.github.com/alastairmccormack/ac1539784af7ae7569cd50135016cf2c

Another safer approach could be representing it with Guava UnsignedInteger:
https://github.com/google/guava/blob/master/guava/src/com/google/common/primitives/UnsignedInteger.java

I have added type uint which describes int32 field saved through long, you can try SNAPSHOT