code: public void processAlignment(final SAMRecord rec) throws IOException {
  		// write an offset for the first record and for the g-th record thereafter (where
  		// g is the granularity), to be consistent with the index method
  		if (count == 0 || (count + 1) % granularity == 0) {
  			SAMFileSource fileSource = rec.getFileSource();
  			SAMFileSpan filePointer = fileSource.getFilePointer();
  			writeVirtualOffset(getPos(filePointer));
  		}
  		count++;
  	}
docs: Process the given record for the index.
  @param rec the record from the file being indexed
  @throws IOException