【发布时间】:2016-05-11 05:05:01
【问题描述】:
我发现,copyToFile() 的底层操作系统调用是Libcore.os.read(fd, bytes, byteOffset, byteCount),而transferTo() 是基于内存映射文件的:
MemoryBlock.mmap(fd, alignment, size + offset, mapMode);
...
buffer = map(MapMode.READ_ONLY, position, count);
return target.write(buffer);
Q1:我的发现是对还是错?
Q2:有什么理由使用FileUtils.copyFile(),因为FileChannel.transferTo()似乎应该更有效?
谢谢
【问题讨论】:
标签: java android file-copying fileutils filechannel