public class CopyUtil { public static void copyFileUsingFileChannels(File source, File dest) throws IOException { FileChannel inputChannel = null; FileChannel outputChannel = null; try { inputChannel = new FileInputStream(source).getChannel(); outputChannel = new FileOutputStream(dest).getChannel(); outputChannel.transferFrom(inputChannel, 0, inputChannel.size()); inputChannel.close(); outputChannel.close(); } catch (Exception e){ Log.e("info",e.getMessage()); } } }
使用fileChannel拷贝文件的工具类
最新推荐文章于 2022-08-04 18:41:09 发布