private static void saveIndex(@NotNull LoaderData data, @NotNull Path indexFile) throws IOException {
    long started = System.nanoTime();
    ByteBuffer buffer = DirectByteBufferPool.DEFAULT_POOL.allocate(Short.BYTES + data.approximateSizeInBytes());
    try {
      buffer.order(ByteOrder.LITTLE_ENDIAN);

      buffer.putShort(indexFileVersion);
      data.save(buffer);
      assert buffer.remaining() == 0;
      buffer.flip();
      try (SeekableByteChannel channel = Files.newByteChannel(indexFile, WRITE_OPTIONS)) {
        do {
          channel.write(buffer);
        }
        while (buffer.hasRemaining());
      }
    }
    finally {
      DirectByteBufferPool.DEFAULT_POOL.release(buffer);
      totalSaving.addAndGet(System.nanoTime() - started);
    }
  }
private static void saveIndex(@NotNull LoaderData data, @NotNull Path indexFile)