As I found, underlying OS call for the copyToFile()
is Libcore.os.read(fd, bytes, byteOffset, byteCount)
, while transferTo()
is based on memory mapped file:
MemoryBlock.mmap(fd, alignment, size + offset, mapMode);
...
buffer = map(MapMode.READ_ONLY, position, count);
return target.write(buffer);
Q1: Am I right or wrong in my findings?
Q2: Is there any reason to use FileUtils.copyFile()
as FileChannel.transferTo()
seems should be more efficient?
Thanks