Ikv (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); mappedBuffer.position(position - (keyDataSize + offsetAndSizePairsDataSize)); 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); } }