I want to know if it's possible to update a byte buffer.
Say I have the below:
ByteBuffer buffer = ByteBuffer.allocate(56);
buffer.putInt(12);
buffer.putLong(34);
buffer.put(byte('A'));
Assuming I want to modify the buffer to say the that first int I put in should be 50, how do I do that.
I want something like:
public void updateByteBuffer(ByteBuffer, int position, int newValue){
// logic to change buffer.putInt(12); to buffer.putInt(50);
// So after this function, my ByteBuffer should contain(hex) 50,34 and 'A';
}