Android 中文件 copy/move 的开源本机库
Open source native library for file copy/move in andorid
是否有任何易于使用、开源或免费的 android native 库用于在 android 中复制和移动 files/directories?
更新:我的意思是为了更好的性能。
示例:(其中 inputStream 是一个文件 inputStream)
OutputStream o=new FileOutputStream("path");
int bytes=IOUtils.copy(inputStream, o);
IOUtils.closeQuietly(o);
最佳!
private 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());
} finally {
inputChannel.close();
outputChannel.close();
}
}
更多:https://examples.javacodegeeks.com/core-java/io/file/4-ways-to-copy-file-in-java/
是否有任何易于使用、开源或免费的 android native 库用于在 android 中复制和移动 files/directories?
更新:我的意思是为了更好的性能。
示例:(其中 inputStream 是一个文件 inputStream)
OutputStream o=new FileOutputStream("path");
int bytes=IOUtils.copy(inputStream, o);
IOUtils.closeQuietly(o);
最佳!
private 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());
} finally {
inputChannel.close();
outputChannel.close();
}
}
更多:https://examples.javacodegeeks.com/core-java/io/file/4-ways-to-copy-file-in-java/