public List<Pair<String, Short>> getKeyOffsetList() {
    short[] offsets = getOffsets();
    List<Pair<String, Short>> res = new ArrayList<>();

    ByteBuffer buffer = this.buffer.asReadOnlyBuffer();
    buffer.clear();
    for (short offset : offsets) {
      buffer.position(offset);
      res.add(new Pair<>(ReadWriteIOUtils.readString(buffer), offset));
    }

    return res;
  }
If buffer position is set to begin of the segment, this methods extract length of it.

@param buffer
@return
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/mtree/impl/pbtree/schemafile/WrappedSegment.java