There is no easy way to pack or unpack integers as unsigned
The Java programming language lacks support for unsigned numbers. However, it is often necessary to interoperate with systems that do support unsigned numbers. In these cases, it would be useful to be able to pack an "int" or "long" value from Java as if it were an unsigned value. This is particularly true when the "int" or "long" is simply an opaque ID rather than a counter.
Currently, Packer#write(long val) will always write out a negative number when val == -1. It would be useful to have a way to make this pack -1 as 0xffffffffffffffff.
The only workaround is to use a BigInteger and do something like this:
if (val < 0) { BigInteger TOP = new BigInteger("10000000000000000", 16); packer.write(TOP.add(BigInteger.valueOf(val))); }
This is difficult to read and inefficient. A similar issue exists for unpacking.
It would also be helpful to have a field annotation @Unsigned (or similar) when using Jackson.