Skip to content

JournalBufferReader Methods

Provides access to buffered journal data read from storage.

IsNext(ReadOnlySpan<byte>, bool)

View source
public bool IsNext(ReadOnlySpan<byte> next, bool advancePast = false)
Checks whether the next bytes match next.

Parameters

nextReadOnlySpan<byte>
The bytes to compare to the next bytes.
advancePastbool
Whether to advance past the bytes if they match.

Returns

true if the next bytes match; otherwise, false.

Peek(int)

View source
public ArcBuffer Peek(int count)
Returns a pinned slice of the provided length without reading the data.

Parameters

countint
The number of bytes to read.

Returns

A pinned slice of unread data. The caller owns the returned buffer and must dispose it.

Peek(int, Span<byte>)

View source
public ReadOnlySpan<byte> Peek(int count, Span<byte> destination)
Gets a span containing the next count bytes without reading them.

Parameters

countint
The number of bytes to read.
destinationSpan<byte>
Temporary storage used if the requested bytes are not contiguous.

Returns

A span containing the requested bytes. The returned span must not be retained after the consumer returns.

Read(Span<byte>)

View source
public void Read(Span<byte> destination)
Copies the next bytes into destination and reads them.

Parameters

destinationSpan<byte>
The destination to copy to.

Skip(int)

View source
public void Skip(int count)
Skips the next count bytes.

Parameters

countint
The number of bytes to skip.

ToArray

View source
public byte[] ToArray()
Copies the remaining bytes into a new array without reading them.

Returns

A byte array containing the remaining bytes.

TryPeek(Span<byte>)

View source
public bool TryPeek(Span<byte> destination)
Attempts to copy the next bytes into destination without reading them.

Parameters

destinationSpan<byte>
The destination to copy to.

Returns

true if enough bytes were available; otherwise, false.

TryRead(Span<byte>)

View source
public bool TryRead(Span<byte> destination)
Attempts to copy the next bytes into destination and read them.

Parameters

destinationSpan<byte>
The destination to copy to.

Returns

true if enough bytes were available; otherwise, false.

TryReadTo(ArcBuffer, byte, bool)

View source
public bool TryReadTo(out ArcBuffer slice, byte delimiter, bool advancePastDelimiter = true)
Reads bytes until delimiter is found.

Parameters

sliceArcBuffer
The pinned bytes before the delimiter, if it was found. The caller owns the returned buffer and must dispose it.
delimiterbyte
The delimiter to search for.
advancePastDelimiterbool
Whether to advance past the delimiter when it is found.

Returns

true if the delimiter was found; otherwise, false.

TrySkip(int)

View source
public bool TrySkip(int count)
Attempts to skip the next count bytes.

Parameters

countint
The number of bytes to skip.

Returns

true if enough bytes were available; otherwise, false.