public static @NotNull Ikv loadIkv(ByteBuffer mappedBuffer, int indexEndPosition) {
    final int position = indexEndPosition - Byte.BYTES - Integer.BYTES;
    int entryCount = mappedBuffer.getInt(position);
    boolean withSize = mappedBuffer.get(position + Integer.BYTES) == 1;

    int keyDataSize = entryCount * (withSize ? Long.BYTES : Integer.BYTES);
    int offsetAndSizePairsDataSize = entryCount * (withSize ? Long.BYTES : Integer.BYTES);

    int newPosition = position - (keyDataSize + offsetAndSizePairsDataSize);
    if (newPosition < 0) {
      throw new MissingIkvException("Buffer position is negative: " + newPosition);
    }
    mappedBuffer.position(newPosition);
    if (withSize) {
      long[] metadata = new long[entryCount * 2];
      mappedBuffer.asLongBuffer().get(metadata);
      return new SizeAwareIkv(metadata, mappedBuffer);
    }
    else {
      int[] metadata = new int[entryCount * 2];
      mappedBuffer.asIntBuffer().get(metadata);
      return new SizeUnawareIkv(metadata, mappedBuffer);
    }
  }
public static @NotNull Ikv loadIkv(ByteBuffer mappedBuffer, int indexEndPosition)