Table of Contents

Public classSealed IndexInput

Namespace
Rowles.LeanLucene.Store
Assembly
Rowles.LeanLucene.dll

Readable input over a memory-mapped file. Maintains a position cursor and uses System.Runtime.CompilerServices.Unsafe.ReadUnaligned``1(System.Byte@) for primitive reads. Acquired pointer is held for the lifetime of the accessor to avoid repeated acquire/release overhead.

public sealed class IndexInput : IDisposable
IndexInput

Public constructor IndexInput(string)

Opens a file at filePath as a memory-mapped read-only input. Acquires a native pointer for the lifetime of this instance.

Internal propertyInternal BasePointer

Base pointer for the memory-mapped region. Used for zero-copy reads.

Public property Length

Total file length in bytes.

Public property Position

Current read position within the file.

Public method CompareCharsAndAdvance(int, ReadOnlySpan<char>)

Compares charCount UTF-8-encoded chars at the current position against term using ordinal comparison. Advances position past the bytes. Zero-allocation (stackalloc for decode buffer).

Public method CompareUtf8BytesAndAdvance(int, ReadOnlySpan<byte>)

Compares charCount UTF-8-encoded chars at the current position against termUtf8 raw UTF-8 bytes. Advances position past the bytes. Zero-allocation, no char decoding needed.

Public method Dispose()

Releases the memory-mapped file view and underlying file resources.

Public method Prefetch()

Hints the OS to prefetch the mapped region for sequential access. Uses PrefetchVirtualMemory on Windows and madvise(MADV_SEQUENTIAL) on Linux. Failures are silently ignored (advisory only).

Public method ReadBoolean()

Reads the next byte and returns true if it is non-zero.

Public method ReadBoolean(ref long)

Reads the next byte using a caller-supplied cursor and returns true if it is non-zero.

Public method ReadByte()

Reads and returns the next byte, advancing the position by one.

Public method ReadByte(ref long)

Reads and returns the next byte using a caller-supplied cursor, leaving _position untouched.

Public method ReadBytes(int)

Reads exactly count bytes and returns them as a new array.

Public method ReadDouble()

Reads a 64-bit double-precision floating-point value.

Public method ReadInt32()

Reads a 32-bit signed integer written in little-endian byte order.

Public method ReadInt32(ref long)

Stateless variant of ReadInt32() using a caller-supplied cursor.

Public method ReadInt32Array(Span<int>, int)

Bulk-reads count int32 values into the destination span. Single bounds check for the entire block. Much faster than N × ReadInt32().

Public method ReadInt32Array(Span<int>, int, ref long)

Stateless variant of ReadInt32Array(Span<int>, int) using a caller-supplied cursor.

Public method ReadInt64()

Reads a 64-bit signed integer written in little-endian byte order.

Public method ReadInt64(ref long)

Stateless variant of ReadInt64() using a caller-supplied cursor.

Public method ReadLengthPrefixedString()

Reads a length-prefixed UTF-8 string as written by System.IO.BinaryWriter.Write(System.String). The length prefix uses 7-bit encoded integer format.

Public method ReadLengthPrefixedString(ref long)

Stateless variant of ReadLengthPrefixedString() using a caller-supplied cursor.

Public method ReadSingle()

Reads a 32-bit single-precision floating-point value.

Public method ReadSingle(ref long)

Stateless variant of ReadSingle() using a caller-supplied cursor.

Public method ReadSpan(int)

Returns a read-only span over the memory-mapped buffer at the current position without allocating. Advances the position by count bytes. The span is only valid while the IndexInput is not disposed.

Public method ReadSpan(int, ref long)

Stateless variant of ReadSpan(int) using a caller-supplied cursor.

Public method ReadUtf8String(int)

Reads charCount chars encoded as UTF-8 (as written by BinaryWriter.Write(char[])). Returns a newly allocated string. Used for one-time skip index loading.

Public method ReadVarInt()

Reads a variable-length encoded non-negative integer (LEB128). Small values (0–127) consume a single byte.

Public method ReadVarInt(ref long)

Stateless variant of ReadVarInt() using a caller-supplied cursor.

Internal methodInternal ReadVarIntFast()

Unrolled VarInt decoder with a single per-value bounds check. If at least 5 bytes remain, uses the branchless unrolled path. Otherwise falls back to the safe per-byte checked path. This eliminates up to 4 bounds checks per VarInt value compared to ReadVarInt().

Internal methodInternal ReadVarIntFast(ref long)

Stateless variant of ReadVarIntFast() using a caller-supplied cursor.

Public method Seek(long)

Moves the read cursor to the specified absolute byte offset.

Public method ThrowCorruptUtf8()