private byte[] encodeData(final int offset, final int position, final byte logType) {
        final ByteBuffer buffer = ByteBuffer.allocate(getIndexSize());
        // Magics
        buffer.put(RECORD_MAGIC_BYTES);
        // logType (segmentLog or conf)
        buffer.put(logType);
        // offset from FirstLogIndex
        buffer.putInt(offset);
        // phyPosition in segmentFile
        buffer.putInt(position);
        buffer.flip();
        return buffer.array();
    }
Write the index entry
 @param logIndex the log index
@param position the physical position
@param logType [1] means logEntry , [2] means confEntry
jraft-extension/java-log-storage-impl/src/main/java/com/alipay/sofa/jraft/storage/file/index/IndexFile.java