private void copyRawToFile(int rawResId,File outFile) throws NotFoundException {
  Resources res=mContext.getResources();
  InputStream is=null;
  try {
    is=res.openRawResource(rawResId);
  }
 catch (  NotFoundException e) {
    Log.i(LOG_TAG,"Failed to load resource with id: " + rawResId);
    throw e;
  }
  FileUtils.setPermissions(outFile.getPath(),FileUtils.S_IRWXU | FileUtils.S_IRWXG | FileUtils.S_IRWXO,-1,-1);
  assertTrue(FileUtils.copyToFile(is,outFile));
  FileUtils.setPermissions(outFile.getPath(),FileUtils.S_IRWXU | FileUtils.S_IRWXG | FileUtils.S_IRWXO,-1,-1);
}

private void copyRawToFile ( int rawResId , File outFile ) throws NotFoundException { Resources res = mContext . getResources ( ) ; InputStream is = null ; try { is = res . openRawResource ( rawResId ) ; } catch ( NotFoundException e ) { Log . i ( LOG_TAG , "Failed to load resource with id: " + rawResId ) ; throw e ; } FileUtils . setPermissions ( outFile . getPath ( ) , FileUtils . S_IRWXU | FileUtils . S_IRWXG | FileUtils . S_IRWXO , - 1 , - 1 ) ; assertTrue ( FileUtils . copyToFile ( is , outFile ) ) ; FileUtils . setPermissions ( outFile . getPath ( ) , FileUtils . S_IRWXU | FileUtils . S_IRWXG | FileUtils . S_IRWXO , - 1 , - 1 ) ; }
helper to copy a raw resource file to an actual specified file
