拷贝文件

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!");
}
}
posted @ 2016-10-13 11:48  Taily_老段  阅读(140)  评论(0编辑  收藏  举报