@Override
    public CheckDataResult checkData(final ByteBuffer buffer) {
        if (buffer.remaining() < RECORD_MAGIC_BYTES_SIZE) {
            return CheckDataResult.CHECK_FAIL;
        }
        // Check magic
        final byte[] magic = new byte[RECORD_MAGIC_BYTES_SIZE];
        buffer.get(magic);
        if (!Arrays.equals(magic, RECORD_MAGIC_BYTES)) {
            return CheckDataResult.FILE_END;
        }
        // Check index type
        final byte indexType = buffer.get();
        if (indexType != IndexType.IndexSegment.getType() && indexType != IndexType.IndexConf.getType()) {
            return CheckDataResult.CHECK_FAIL;
        }
        if (buffer.remaining() < getIndexSize() - RECORD_MAGIC_BYTES_SIZE - 1) {
            return CheckDataResult.CHECK_FAIL;
        }
        final CheckDataResult result = CheckDataResult.CHECK_SUCCESS;
        result.setSize(getIndexSize());
        return result;
    }
Find the index entry
@param  logIndex the target log index
@return a pair holding this offset and its physical file position.
jraft-extension/java-log-storage-impl/src/main/java/com/alipay/sofa/jraft/storage/file/index/IndexFile.java