码迷,mamicode.com
首页 > 其他好文 > 详细

拷贝文件

时间:2016-10-13 14:46:57      阅读:117      评论:0      收藏:0      [点我收藏+]

标签:

private void copyBigDataToSD(String strOutFileName) throws IOException
{
File fData = new File(strOutFileName);
try{
if (!fData.exists()){ //not exist, copy
InputStream myInput;
OutputStream myOutput = new FileOutputStream(strOutFileName);
myInput = this.getAssets().open("data.bin");
byte[] buffer = new byte[1024];
int length = myInput.read(buffer);
while(length > 0)
{
myOutput.write(buffer, 0, length);
length = myInput.read(buffer);
}

myOutput.flush();
myInput.close();
myOutput.close();
}
}catch (Exception e ){
Log.e(TAG, "file data.bin ERROR!");
}
}

拷贝文件

标签:

原文地址:http://www.cnblogs.com/taily-laoduan/p/5955946.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!