public boolean next(LongWritable key, WritableWarcRecord value) throws IOException {
    DataInputStream whichStream=null;
    if (compressionInput!=null) {
      whichStream=compressionInput;
    } else if (currentFile!=null) {
      whichStream=currentFile;
    }

    if (whichStream==null) { return false; }

    WarcRecord newRecord=WarcRecord.readNextWarcRecord(whichStream);
    if (newRecord==null) {
      // try advancing the file
      if (openNextFile()) {
        newRecord=WarcRecord.readNextWarcRecord(whichStream);
      }

      if (newRecord==null) { return false; }
    }

    totalNumBytesRead += (long)newRecord.getTotalRecordLength();
    newRecord.setWarcFilePath(filePathList[currentFilePath].toString());

    // now, set our output variables
    value.setRecord(newRecord);
    key.set(recordNumber);

    recordNumber++;
    return true;
  }