首页 > 其他 > 详细

拷贝文件

时间:2016-10-13 14:44:32      阅读: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
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!