private List<Long> parseOffsetList(long position) throws IOException {
    List<Long> blockOffset = new ArrayList<>();
    blockOffset.add(position);
    // Read the first block
    ByteBuffer byteBuffer = ByteBuffer.allocate(MAX_LENGTH);
    fileChannel.read(byteBuffer, position);
    byteBuffer.flip();
    if (byteBuffer.limit() > 0) { // This indicates that there is data at this position
      int firstInt = ReadWriteIOUtils.readInt(byteBuffer); // first int
      byteBuffer.position(0);
      if (firstInt < -1) { // This position is blockNum, the original data occupies multiple blocks
        int blockNum = -firstInt;
        int blockOffsetStoreLen =
            (((blockNum - 1) * Long.BYTES + 4) / MAX_LENGTH + 1)
                * MAX_LENGTH; // blockOffset storage length
        ByteBuffer blockBuffer = ByteBuffer.allocate(blockOffsetStoreLen);
        blockBuffer.put(byteBuffer);
        blockBuffer.position(4); // Skip blockNum

        for (int i = 1; i < blockNum; i++) {
          blockOffset.add(ReadWriteIOUtils.readLong(blockBuffer));
          // Every time you read an offset, use filechannel's read to read it
          if (MAX_LENGTH * (i + 1)
              <= blockOffsetStoreLen) { // Compared with directly reading bytebuffer, some reading
            // operations are reduced, only the content of offset is
            // read
            blockBuffer.position(MAX_LENGTH * i);
            blockBuffer.limit(MAX_LENGTH * (i + 1));
            fileChannel.read(blockBuffer, blockOffset.get(i));
            blockBuffer.position(4 + i * Long.BYTES);
          }
        }
      }
    }
    return blockOffset;
  }
Read tags and attributes from tag file.

@return tags map, attributes map
@throws IOException error occurred when reading disk
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/tag/TagLogFile.java