Class PdfMemoryRangeReader
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
dataReadOnlyMemory<byte>
Properties
BeforeRead
Called before each read (a test can delay or fail it).
public Func<long, int, ValueTask>? BeforeRead { get; init; }
Property Value
BytesRead
The bytes read so far.
public long BytesRead { get; }
Property Value
Length
The length of the file in bytes.
public long Length { get; }
Property Value
Requests
The reads so far.
public int Requests { get; }
Property Value
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
offsetlongdestinationMemory<byte>cancellationTokenCancellationToken