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!"); }}
转载于:https://www.cnblogs.com/taily-laoduan/p/5955946.html