Is there a way to read all the items out of an NIO Buffer into an array to pass onto JNI (or for some other purpose)?

John Zukowski

The Buffer class has an array() method added in 1.6 that allows you to get the backing buffer in a single call. This can be passed on to native code or to some method that requires an array to work with, as opposed to a Buffer. The method is optional so the hasArray() method should be called first.