Writing shorts greater than 127 to a ByteBuffer in Java
I have an application in which I’m trying to send UDP messages using TSLv5. The protocol is somewhat complicated, but to do it I need to write 16 bit values as little-endian and then send that via UDP. Here’s my code doing just that: buffer.order(ByteOrder.LITTLE_ENDIAN); buffer.putShort(SCREEN_POS, screen); buffer.putShort(INDEX_POS, index); ByteBuffer text = ByteBuffer.wrap(value.getBytes()); short textLength… Read More Writing shorts greater than 127 to a ByteBuffer in Java