不,没有内置方法可以做到这一点。与您要完成的工作最接近的是
transferFromfrom 的方法
FileOutputStream,如下所示:
FileChannel src = new FileInputStream(file1).getChannel(); FileChannel dest = new FileOutputStream(file2).getChannel(); dest.transferFrom(src, 0, src.size());
并且不要忘记处理异常并在一个
finally块中关闭所有内容。



