*/
@Test
public void testCanDirectlyModifyNativeBytes()
{
byte buffer[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8 ,9 };
IBuffer buf = IBuffer.make(null, buffer, 0, buffer.length);
assertNotNull(buf);
assertEquals(buf.getBufferSize(), buffer.length);
// this give us the native bytes
java.nio.ByteBuffer nativeBytes = buf.getByteBuffer(0, buffer.length);
assertNotNull(nativeBytes);
for(int i = 0; i < buffer.length; i++)
{
nativeBytes.put(i, (byte)(9-buffer[i])); // reverse the order of the integers
}
// we can release it. no "update" method should be required. It should
// have modified the underlying C++ bytes.
nativeBytes = null;
// now, get a copy of the bytes in the IBuffer and make sure
// the order of bytes was reversed.
byte outBuffer[] = buf.getByteArray(0, buffer.length);
assertNotNull(outBuffer);
assertEquals(outBuffer.length, buffer.length);
assertNotSame(buf, outBuffer);
for(int i =0 ; i < buffer.length; i++)
{