Table of Contents

Class PdfMemoryRangeReader

Namespace
PdfEngine.Vector.Parsing
Assembly
PdfEngine.Vector.dll

An IPdfRangeReader over bytes in memory, for tests and for hosts that already have the file.

public sealed class PdfMemoryRangeReader : IPdfRangeReader
Inheritance
PdfMemoryRangeReader
Implements
Inherited Members

Constructors

PdfMemoryRangeReader(ReadOnlyMemory<byte>)

public PdfMemoryRangeReader(ReadOnlyMemory<byte> data)

Parameters

data ReadOnlyMemory<byte>

Properties

BeforeRead

Called before each read (a test can delay or fail it).

public Func<long, int, ValueTask>? BeforeRead { get; init; }

Property Value

Func<long, int, ValueTask>

BytesRead

The bytes read so far.

public long BytesRead { get; }

Property Value

long

Length

The length of the file in bytes.

public long Length { get; }

Property Value

long

Requests

The reads so far.

public int Requests { get; }

Property Value

int

Methods

ReadAsync(long, Memory<byte>, CancellationToken)

Reads exactly destination.Length bytes from offset. The range is always inside the file. Throws when the bytes cannot be read.

public ValueTask ReadAsync(long offset, Memory<byte> destination, CancellationToken cancellationToken)

Parameters

offset long
destination Memory<byte>
cancellationToken CancellationToken

Returns

ValueTask