Android复制文件
16lz
2021-12-04
/**
* 文件复制
* @author YOLANDA
* @param srcFile 原路径
* @param destFile 目标路径
* @return
*/
public static boolean copy(String srcFile, String destFile) {
try {
FileInputStream in = new FileInputStream(srcFile);
FileOutputStream out = new FileOutputStream(destFile);
byte[] bytes = new byte[1024];
int c;
while ((c = in.read(bytes)) != -1) {
out.write(bytes, 0, c);
}
in.close();
out.flush();
out.close();
return true;
} catch (Exception e) {
Log.i("发生错误:" + e.getMessage());
return false;
}
}
* 文件复制
* @author YOLANDA
* @param srcFile 原路径
* @param destFile 目标路径
* @return
*/
public static boolean copy(String srcFile, String destFile) {
try {
FileInputStream in = new FileInputStream(srcFile);
FileOutputStream out = new FileOutputStream(destFile);
byte[] bytes = new byte[1024];
int c;
while ((c = in.read(bytes)) != -1) {
out.write(bytes, 0, c);
}
in.close();
out.flush();
out.close();
return true;
} catch (Exception e) {
Log.i("发生错误:" + e.getMessage());
return false;
}
}
更多相关文章
- Android(安卓)SDK更新的问题
- android mapView
- 升级android sdk时A folder failed to be renamed or moved 错误
- Android(安卓)keytool 生成证书MD5指纹
- [zz http://www.cnblogs.com/oldfeel/archive/2012/05/15/250129
- Android: Attaching Sources to Libraries in Eclipse
- 升级android sdk时A folder failed to be renamed or moved 错误
- Error:In declare-styleable FontFamilyFont, unable to find at
- Eclpise导入android SDK自带的API demos