Skip to content

Reader<TInput> Methods

Provides functionality for parsing data from binary input.

ForkFrom(long, Reader<TInput>)

View source
public void ForkFrom(long position, out Reader<TInput> forked)
Creates a new reader beginning at the specified position.

Parameters

positionlong
The position in the input stream to fork from.
forkedReader<TInput>
The forked reader instance.

PeekByte

View source
public byte PeekByte()
Returns the next byte from the input without advancing the reader.

Returns

The next byte in the input.

ReadByte

View source
public byte ReadByte()
Reads a byte from the input.

Returns

The byte which was read.

ReadBytes(uint)

View source
public byte[] ReadBytes(uint count)
Reads an array of bytes from the input.

Parameters

countuint
The length of the array to read.

Returns

The array wihch was read.

ReadBytes(Span<byte>)

View source
public void ReadBytes(scoped Span<byte> destination)
Fills destination with bytes read from the input.

Parameters

destinationSpan<byte>
The destination.

ReadBytes(TBufferWriter, int)

View source
public void ReadBytes<TBufferWriter>(scoped ref TBufferWriter writer, int count)
Reads the specified number of bytes into the provided writer.

Parameters

writerTBufferWriter
countint

ReadInt32

View source
public int ReadInt32()
Reads an System.Int32 from the input.

Returns

The System.Int32 which was read.

ReadInt64

View source
public long ReadInt64()
Reads a System.Int64 from the input.

Returns

The System.Int64 which was read.

ReadUInt32

View source
public uint ReadUInt32()
Reads a System.UInt32 from the input.

Returns

The System.UInt32 which was read.

ReadUInt64

View source
public ulong ReadUInt64()
Reads a System.UInt64 from the input.

Returns

The System.UInt64 which was read.

ReadVarUInt32

View source
public uint ReadVarUInt32()
Reads a variable-width System.UInt32 from the input.

Returns

The System.UInt32 which was read.

ReadVarUInt64

View source
public ulong ReadVarUInt64()
Reads a variable-width System.UInt64 from the input.

Returns

The System.UInt64 which was read.

ResumeFrom(long)

View source
public void ResumeFrom(long position)
Resumes the reader from the specified position after forked readers are no longer in use.

Parameters

positionlong
The position to resume reading from.

Skip(long)

View source
public void Skip(long count)
Skips the specified number of bytes.

Parameters

countlong
The number of bytes to skip.

TryReadBytes(int, ReadOnlySpan<byte>)

View source
public bool TryReadBytes(int length, out ReadOnlySpan<byte> bytes)
Tries the read the specified number of bytes from the input.

Parameters

lengthint
The length.
bytesReadOnlySpan<byte>
The bytes which were read.

Returns

true if the specified number of bytes were read from the input, false otherwise.