public static boolean waitForFile ( File file ) { if ( file . isFile ( ) ) { return true ; } else { // Start waiting 10 seconds maximum long timeout = System . currentTimeMillis ( ) + FILE_WAIT_TIMEOUT ; while ( System . currentTimeMillis ( ) <= timeout ) { sleepQuietly ( 10 ) ; if ( file . isFile ( ) ) { return true ; } } } // Timeout reached return false ; }
Waits for a file to be created .