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