private String getTempFilePath ( File eFile ) { String pathStr = this . tempPath + File . separator + eFile . getName ( ) + ".tmp" ; for ( int i = 1 ; i < 5 ; ++ i ) { File f = new File ( pathStr ) ; if ( ! f . exists ( ) ) { break ; } pathStr = this . tempPath + File . separator + eFile . getName ( ) + "-" + i + ".tmp" ; } return pathStr ; }
Get a path for a temporary file for a given File . The temporary file is NOT created . The algorithm attempts to handle filename collisions so that the name is unique .