public boolean mustRefresh(){
  try {
    if (currentSnapshot == null || sourceFile.countFiles() != currentSnapshot.size())     return true;
    if (currentOpenFile != null) {
      if (!Files.exists(currentOpenFile.getPath())) {
        LOGGER.debug("Current file {} does not exist anymore. Must refresh.",currentOpenFile.getPath());
        return true;
      }
      BasicFileAttributes newAttr=Files.readAttributes(currentOpenFile.getPath(),BasicFileAttributes.class);
      FileId newId=FileId.get(newAttr);
      if (!newId.equals(currentOpenFile.getId())) {
        LOGGER.debug("ID for current file ({}) changed from {} to {}. Must refresh.",currentOpenFile.getPath(),currentOpenFile.getId(),newId);
        return true;
      }
      if (newAttr.size() < currentOpenFile.getSize()) {
        LOGGER.debug("Current file ({}) shrunk in size from {} to {}. Must refresh.",currentOpenFile.getPath(),currentOpenFile.getSize(),newAttr.size());
        return true;
      }
    }
  }
 catch (  IOException e) {
    LOGGER.error("Error while status of current file snapshot. Must refresh.",e);
    return true;
  }
  return false;
}

public boolean mustRefresh ( ) { try { if ( currentSnapshot == null || sourceFile . countFiles ( ) != currentSnapshot . size ( ) ) return true ; if ( currentOpenFile != null ) { if ( ! Files . exists ( currentOpenFile . getPath ( ) ) ) { LOGGER . debug ( "Current file {} does not exist anymore. Must refresh." , currentOpenFile . getPath ( ) ) ; return true ; } BasicFileAttributes newAttr = Files . readAttributes ( currentOpenFile . getPath ( ) , BasicFileAttributes . class ) ; FileId newId = FileId . get ( newAttr ) ; if ( ! newId . equals ( currentOpenFile . getId ( ) ) ) { LOGGER . debug ( "ID for current file ({}) changed from {} to {}. Must refresh." , currentOpenFile . getPath ( ) , currentOpenFile . getId ( ) , newId ) ; return true ; } if ( newAttr . size ( ) < currentOpenFile . getSize ( ) ) { LOGGER . debug ( "Current file ({}) shrunk in size from {} to {}. Must refresh." , currentOpenFile . getPath ( ) , currentOpenFile . getSize ( ) , newAttr . size ( ) ) ; return true ; } } } catch ( IOException e ) { LOGGER . error ( "Error while status of current file snapshot. Must refresh." , e ) ; return true ; } return false ; }
this method performs a series of quick checks on the current open file to see if we need to refresh . this is much faster than doing a full refresh .
