Read from ByteBuffer instead of ByteArray to avoid unnecessary array copy
through read path.