@Override public LogMessage readNextLogMessage(){
  try {
    if (reader == null) {
      return null;
    }
    while (true) {
      String line=reader.readLine();
      if (line == null) {
        close();
        if (currentLog != null && matchRegex(currentLog)) {
          incrementLogCount(currentLog);
          return currentLog;
        }
        return null;
      }
      fileLineNumber++;
      LogMessage nextLog=null;
      if (parser != null) {
        nextLog=parser.parseLine(line,request);
      }
 else {
        for (        LogParser parser : parserTable) {
          nextLog=parser.parseLine(line,request);
          if (!nextLog.isContinuation()) {
            this.parser=parser;
            break;
          }
        }
        if (nextLog == null || nextLog.isContinuation()) {
          status.appendInfo(this.filePath,fileLineNumber);
          continue;
        }
      }
      if (nextLog.isContinuation()) {
        if (currentLog != null) {
          currentLog.appendMessage(LogUtil.stringToBytes(line));
        }
      }
 else       if (nextLog.isRejected()) {
        if (currentLog != null) {
          LogMessage returnedLog=currentLog;
          currentLog=null;
          if (matchRegex(returnedLog)) {
            incrementLogCount(returnedLog);
            return returnedLog;
          }
        }
      }
 else       if (nextLog.isRejectedLast()) {
        if (currentLog != null) {
          LogMessage returnedLog=currentLog;
          currentLog=null;
          if (matchRegex(returnedLog)) {
            incrementLogCount(returnedLog);
            return returnedLog;
          }
        }
        break;
      }
 else {
        if (currentLog != null) {
          LogMessage returnedLog=currentLog;
          currentLog=nextLog;
          if (returnedLog.isHeader() && currentLog.isHeader()) {
            continue;
          }
          if (matchRegex(returnedLog)) {
            incrementLogCount(returnedLog);
            return returnedLog;
          }
        }
 else {
          currentLog=nextLog;
        }
      }
    }
  }
 catch (  IOException e) {
    status.appendErrFileName(filePath);
  }
  return null;
}

@ Override public LogMessage readNextLogMessage ( ) { try { if ( reader == null ) { return null ; } while ( true ) { String line = reader . readLine ( ) ; if ( line == null ) { close ( ) ; if ( currentLog != null && matchRegex ( currentLog ) ) { incrementLogCount ( currentLog ) ; return currentLog ; } return null ; } fileLineNumber ++ ; LogMessage nextLog = null ; if ( parser != null ) { nextLog = parser . parseLine ( line , request ) ; } else { for ( LogParser parser : parserTable ) { nextLog = parser . parseLine ( line , request ) ; if ( ! nextLog . isContinuation ( ) ) { this . parser = parser ; break ; } } if ( nextLog == null || nextLog . isContinuation ( ) ) { status . appendInfo ( this . filePath , fileLineNumber ) ; continue ; } } if ( nextLog . isContinuation ( ) ) { if ( currentLog != null ) { currentLog . appendMessage ( LogUtil . stringToBytes ( line ) ) ; } } else if ( nextLog . isRejected ( ) ) { if ( currentLog != null ) { LogMessage returnedLog = currentLog ; currentLog = null ; if ( matchRegex ( returnedLog ) ) { incrementLogCount ( returnedLog ) ; return returnedLog ; } } } else if ( nextLog . isRejectedLast ( ) ) { if ( currentLog != null ) { LogMessage returnedLog = currentLog ; currentLog = null ; if ( matchRegex ( returnedLog ) ) { incrementLogCount ( returnedLog ) ; return returnedLog ; } } break ; } else { if ( currentLog != null ) { LogMessage returnedLog = currentLog ; currentLog = nextLog ; if ( returnedLog . isHeader ( ) && currentLog . isHeader ( ) ) { continue ; } if ( matchRegex ( returnedLog ) ) { incrementLogCount ( returnedLog ) ; return returnedLog ; } } else { currentLog = nextLog ; } } } } catch ( IOException e ) { status . appendErrFileName ( filePath ) ; } return null ; }
read one log message from log file
