@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 len
        if (buffer.remaining() < RECORD_DATA_LENGTH_SIZE) {
            return CheckDataResult.CHECK_FAIL;
        }
        final int dataLen = buffer.getInt();
        if (buffer.remaining() < dataLen) {
            return CheckDataResult.CHECK_FAIL;
        }
        final CheckDataResult result = CheckDataResult.CHECK_SUCCESS;
        result.setSize(RECORD_MAGIC_BYTES_SIZE + RECORD_DATA_LENGTH_SIZE + dataLen);
        return result;
    }
Read data from the position
@param pos      the position to read
@return read data
jraft-extension/java-log-storage-impl/src/main/java/com/alipay/sofa/jraft/storage/file/segment/SegmentFile.java