NIO IOUtils Direct vs Heap

Jon V. sybersnake at
Sun Jul 31 11:25:34 UTC 2016

Hello everyone,

As I’m sure we are all aware that all HeapBuffers must be copied to
DirectBuffers in order to be written to NIO.  IOUtils provides the
necessary automation for writing to the FD and working with the BufferCache.

My question is this:  Since we know that byte[] can be passed to JNI and
safely copied to native memory. (exactly how the heap is copied to the
native)  Why can’t byte[] be written directly to the FD and bypass all the
nastiness of copying to native memory.


More information about the jdk8u-dev mailing list