I'm trying to edit a buffer, but the inputted copy (original) is read-only. The result has the same values but acts differently from the original; I'm not sure what's different. Why might this be the case?
private FloatBuffer cloneBuffer(FloatBuffer original) {
final ByteBuffer byteClone = (original.isDirect()) ?
//multiplying by 4 and adding 3 so the capacity is the same
//when converted to FloatBuffer
ByteBuffer.allocateDirect(original.capacity() *4 + 3) :
ByteBuffer.allocate(original.capacity() * 4 + 3);
final FloatBuffer clone = byteClone.asFloatBuffer();
final FloatBuffer readOnlyCopy = original.asReadOnlyBuffer();
readOnlyCopy.rewind();
clone.put(readOnlyCopy);
clone.position(original.position());
clone.limit(original.limit());
return clone;
}