public static File CopyDataBase(Context context,int id,String path)
{
try
{
InputStream inputStream = context.getResources().openRawResource(id);
File file = new File(path);
FileOutputStream fos = new FileOutputStream(file );
byte[] buff = new byte[1024];
int len = -1;
//边读边写
while((len = inputStream.read(buff))!=-1)
{
fos.write(buff, 0, len);
}
fos.close();
inputStream.close();
return file;
} catch (Exception e)
{
e.printStackTrace();
return null;
}
}
文件读取
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章
python脚本简化jar操作命令
神牛003
2019-02-23 17:41:06
解压tomcat二进制包出错
隨風上升
2019-02-23 13:57:36
JavaScript input type=file 获取文件大小及类型限制
wangyong191212
2019-02-23 13:37:47
secure日志错误提示
心碎小胖子
2019-02-23 13:34:47
makefile介绍
清風徐來918
2019-02-23 00:39:16
SQL Server 2005 笔记
simyang
2019-02-23 00:38:26
异常The file cannot be validated as the XML definition "http://www.opensymphony.com/
heishu007
2019-02-23 00:23:05
保存view到本地图片
wutongkege
2019-02-23 00:20:32
linux下cat命令详解
lyong689
2019-02-23 00:19:28
Ansible5:常用模块
tianjun1990
2019-02-23 00:16:07
用户密码管理
arvinlinux
2019-02-23 00:11:30
磁盘分区及管理
arvinlinux
2019-02-23 00:11:28
ORACLE表空间管理维护
dukai1987
2019-02-23 00:10:32
.NetCore上传多文件的几种示例
神牛步行3
2019-02-23 00:05:30