doesn't FileOutStream accept a ByteBuffer? Relying on .array() seems a bit iffy since it's not guaranteed to be supported on DirectByteBuffers.