boolean waitForFileDone(){
synchronized (waitFileSync) {
    try {
      while (!fileDone)       waitFileSync.wait();
    }
 catch (    Exception e) {
    }
  }
  return fileSuccess;
}

boolean waitForFileDone ( ) { synchronized ( waitFileSync ) { try { while ( ! fileDone ) waitFileSync . wait ( ) ; } catch ( Exception e ) { } } return fileSuccess ; }
block until file writing is done .
