code: public static void waitFor(File aFile)
     
     {
        if(aFile == null)
           return;
        
        String path =aFile.getAbsolutePath();
     
        long previousSize = IO.getFileSize(path);
        long currentSize = previousSize;
        
        long sleepTime = Config.getPropertyLong("file.monitor.file.wait.time",100).longValue();
        
        while(true)
        {
           try
           {
             Thread.sleep(sleepTime);
           }
           catch(InterruptedException e){}
            
            currentSize = IO.getFileSize(path);
         
            if(currentSize == previousSize )
               return;
            
            previousSize = currentSize;
        }
     }
docs: Used to wait for transferred file's content length to stop changes for
  5 seconds
  
  @param aFile the file