Add support for java.nio.Buffer

including test-suite test case and documentation
This commit is contained in:
Yuval Kashtan 2014-07-18 15:45:16 +03:00
commit 093fe2a556
4 changed files with 69 additions and 0 deletions

View file

@ -83,6 +83,25 @@ public class java_lib_various_runme {
if (byjove[i] != b[i])
throw new RuntimeException("By jove, it failed: [" + new String(b) + "]");
}
// NIOBUFFER typemap check
java.nio.ByteBuffer buf = java.nio.ByteBuffer.allocateDirect(10);
java_lib_various.niobuffer_fill_hello(buf);
if (
(char)buf.get(0) != 'h' ||
(char)buf.get(1) != 'e' ||
(char)buf.get(2) != 'l' ||
(char)buf.get(3) != 'l' ||
(char)buf.get(4) != 'o'
)
throw new RuntimeException(
"nio test failed: " +
(char)buf.get(0) +
(char)buf.get(1) +
(char)buf.get(2) +
(char)buf.get(3) +
(char)buf.get(4)
);
}
}