Details
-
Improvement
-
Status: Resolved
-
Major
-
Resolution: Invalid
-
2.2.1
-
None
-
None
Description
If we read data from FileChannel to HeapByteBuffer, there is a need to copy the data from the off-heap to the on-heap, you can see the follow code:
```java
static int read(FileDescriptor var0, ByteBuffer var1, long var2, NativeDispatcher var4) throws IOException {
if(var1.isReadOnly())
else if(var1 instanceof DirectBuffer)
{ return readIntoNativeBuffer(var0, var1, var2, var4); } else {
ByteBuffer var5 = Util.getTemporaryDirectBuffer(var1.remaining());
int var7;
try {
int var6 = readIntoNativeBuffer(var0, var5, var2, var4);
var5.flip();
if(var6 > 0)
var7 = var6;
} finally
return var7;
}
}
```