Made reading read-only ByteBuffers work.

Also added new constructor that allows ByteBuffer reuse.

Change-Id: I9c20ea96c67533066461f4e23b0d03b9b47cd068
Tested: on OS X.
This commit is contained in:
Wouter van Oortmerssen
2014-09-03 11:03:02 -07:00
parent 8e40902d52
commit 4507594812
3 changed files with 24 additions and 3 deletions
+4 -1
View File
@@ -103,9 +103,12 @@ class JavaTest {
}
// Test it:
TestBuffer(fbb.dataBuffer(), fbb.dataStart());
// Make sure it also works with read only ByteBuffers. This is slower, since
// creating strings incurs an additional copy (see Table.__string).
TestBuffer(fbb.dataBuffer().asReadOnlyBuffer(), fbb.dataStart());
System.out.println("FlatBuffers test: completed successfully");
}