code: public static void parseHistoryFromFS(String path, Listener l, FileSystem fs)
    throws IOException{
      FSDataInputStream in = fs.open(new Path(path));
      BufferedReader reader = new BufferedReader(new InputStreamReader (in));
      try {
        String line = null; 
        StringBuffer buf = new StringBuffer(); 
        
        // Read the meta-info line. Note that this might a jobinfo line for files
        // written with older format
        line = reader.readLine();
        
        // Check if the file is empty
        if (line == null) {
          return;
        }
        
        // Get the information required for further processing
        MetaInfoManager mgr = new MetaInfoManager(line);
        boolean isEscaped = mgr.isValueEscaped();
        String lineDelim = String.valueOf(mgr.getLineDelim());  
        String escapedLineDelim = 
          StringUtils.escapeString(lineDelim, StringUtils.ESCAPE_CHAR, 
                                   mgr.getLineDelim());
        
        do {
          buf.append(line); 
          if (!line.trim().endsWith(lineDelim) 
              || line.trim().endsWith(escapedLineDelim)) {
            buf.append("\n");
            continue; 
          }
          parseLine(buf.toString(), l, isEscaped);
          buf = new StringBuffer(); 
        } while ((line = reader.readLine())!= null);
      } finally {
        try { reader.close(); } catch (IOException ex) {}
      }
    }
docs: Parses history file and invokes Listener.handle() for
  each line of history. It can be used for looking through history
  files for specific items without having to keep whole history in memory.
  @param path path to history file
  @param l Listener for history events
  @param fs FileSystem where history file is present
  @throws IOException