ReaderInputLimits
OfficeIMO.Reader
Shared input-size guard helpers for reader adapters.
Inheritance
- object
- ReaderInputLimits
Methods
public static void EnforceFileSize(string path, long? maxBytes) #Enforces maxBytes against file length when available.
Parameters
- path string
- maxBytes long?
public static void EnforceSeekableStreamSize(Stream stream, long? maxBytes) #Enforces maxBytes against stream length when seekable.
Parameters
- stream System.IO.Stream
- maxBytes long?
public static Stream EnsureSeekableReadStream(Stream stream, long? maxInputBytes, CancellationToken cancellationToken, out bool ownsStream) #Creates a seekable snapshot for parsers that require rewind/index operations. Seekable inputs are read from the beginning and restored to their original position. Non-seekable inputs are read from their current forward position.
Parameters
- stream System.IO.Stream
- maxInputBytes long?
- cancellationToken System.Threading.CancellationToken
- ownsStream bool
Returns
Streampublic static async Task<Stream> EnsureSeekableReadStreamAsync(Stream stream, long? maxInputBytes, CancellationToken cancellationToken = default) #Asynchronously creates a seekable stream snapshot for parsers that require rewind/index operations. Seekable inputs are read from the beginning and restored to their original position. Non-seekable inputs are read from their current forward position. The returned snapshot must be disposed by the caller.
Parameters
- stream System.IO.Stream
- maxInputBytes long?
- cancellationToken System.Threading.CancellationToken = default
Returns
Task<Stream>