private static synchronized File newFile(String localPath){
  final File localFile=new File(localPath);
  if (localFile.exists()) {
    localFile.delete();
  }
 else {
    File parentFile=localFile.getParentFile();
    if (parentFile != null && (parentFile.isDirectory() || parentFile.mkdirs())) {
      try {
        localFile.createNewFile();
      }
 catch (      IOException e) {
        e.printStackTrace();
      }
    }
  }
  return localFile;
}

private static synchronized File newFile ( String localPath ) { final File localFile = new File ( localPath ) ; if ( localFile . exists ( ) ) { localFile . delete ( ) ; } else { File parentFile = localFile . getParentFile ( ) ; if ( parentFile != null && ( parentFile . isDirectory ( ) || parentFile . mkdirs ( ) ) ) { try { localFile . createNewFile ( ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } } } return localFile ; }
delete file if exists , create a new file and the parent dir .
