I've got a ByteBuffer that contains 1024 bytes.
I need to overwrite a short within the buffer at a certain offset at key times.
I know the ByteBuffer class has putShort(), but this doesn't overwrite the data, it simply adds it in, which is causing buffer overflows.
I'm guessing that there isn't a direct way of doing this using the ByteBuffer, can someone possibly suggest a way to do this?
Thanks
Thanks to everyone that replied, seemed it could be done I was just using the wrong version of putShort(). I guess that's what happens when you stare at the same piece of code for six hours.
Thanks again
ByteBufferhas twoputShortmethods:putShort(short value)andputShort(int index, short value). Are you sure you are using the right one?