public boolean next(WordOffset key, Text value) throws IOException {
      if (count >= split.getNumPaths()) return false;

      /* Read from file, fill in key and value, if we reach the end of file,
       * then open the next file and continue from there until all files are
       * consumed.
       */
      String line;
      do {
        line = currentReader.readLine();
        if (line == null) {
          // close the file
          currentReader.close();
          offset += split.getLength(count);

          if (++count >= split.getNumPaths()) // if we are done
          return false;

          // open a new file
          Path file = paths[count];
          currentStream = fs.open(file);
          currentReader = new BufferedReader(new InputStreamReader(currentStream));
          key.fileName = file.getName();
        }
      } while (line == null);
      // update the key and value
      key.offset = currentStream.getPos();
      value.set(line);

      return true;
    }
 public WordOffset createKey() {
   WordOffset wo = new WordOffset();
   wo.fileName = paths[0].toString(); // set as the first file
   return wo;
 }