@Override
    public void add(byte[] firstKey, long blockOffset, int onDiskDataSize,
      long curTotalNumSubEntries) {
      // Record the offset for the secondary index
      secondaryIndexOffsetMarks.add(curTotalNonRootEntrySize);
      curTotalNonRootEntrySize += SECONDARY_INDEX_ENTRY_OVERHEAD + firstKey.length;

      curTotalRootSize += Bytes.SIZEOF_LONG + Bytes.SIZEOF_INT
        + WritableUtils.getVIntSize(firstKey.length) + firstKey.length;

      blockKeys.add(firstKey);
      blockOffsets.add(blockOffset);
      onDiskDataSizes.add(onDiskDataSize);

      if (curTotalNumSubEntries != -1) {
        numSubEntriesAt.add(curTotalNumSubEntries);

        // Make sure the parallel arrays are in sync.
        if (numSubEntriesAt.size() != blockKeys.size()) {
          throw new IllegalStateException("Only have key/value count " + "stats for "
            + numSubEntriesAt.size() + " block index " + "entries out of " + blockKeys.size());
        }
      }
    }
Adds a new entry to this block index chunk.
@param firstKey              the first key in the block pointed to by this entry
@param blockOffset           the offset of the next-level block pointed to by this entry
@param onDiskDataSize        the on-disk data of the block pointed to by this entry,
                             including header size
@param curTotalNumSubEntries if this chunk is the root index chunk under construction, this
                             specifies the current total number of sub-entries in all
                             leaf-level chunks, including the one corresponding to the
                             second-level entry being added.
hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/HFileBlockIndex.java