public IncomingMessageEnvelope readNext() {
    if (!hasNext()) {
      LOG.warn("Attempting to read more data when there aren't any. ssp=" + systemStreamPartition);
      return null;
    }
    // record the next offset before we read, so when the read fails and we reconnect,
    // we seek to the same offset that we try below
    curSingleFileOffset = curReader.nextOffset();
    IncomingMessageEnvelope messageEnvelope = curReader.readNext();
    // Copy everything except for the offset. Turn the single-file style offset into a multi-file one
    return new IncomingMessageEnvelope(messageEnvelope.getSystemStreamPartition(), getCurOffset(),
      messageEnvelope.getKey(), messageEnvelope.getMessage(), messageEnvelope.getSize(),
      messageEnvelope.getEventTime(), messageEnvelope.getArrivalTime());
  }
Generate the offset based on file index and offset within single file
@param fileIndex index of the file
@param singleFileOffset offset within single file
@return the complete offset
samza-hdfs/src/main/java/org/apache/samza/system/hdfs/reader/MultiFileHdfsReader.java