Skip to main content

Search OfficeIMO

Enter a topic, API type, or PowerShell command.

Documentation Search all OfficeIMO/
Class

ReaderInputLimits

OfficeIMO.Reader

Namespace
OfficeIMO.Reader
Assembly
OfficeIMO.Reader.Core
Source revision
0eef6a5756b9 with working tree changes
Modifiers
static

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 required
maxBytes long? required
public static void EnforceSeekableStreamSize(Stream stream, long? maxBytes) #

Enforces maxBytes against stream length when seekable.

Parameters

stream System.IO.Stream required
maxBytes long? required
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 required
maxInputBytes long? required
cancellationToken System.Threading.CancellationToken required
ownsStream bool required

Returns

Stream
public 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 required
maxInputBytes long? required
cancellationToken System.Threading.CancellationToken = default optional

Returns

Task<Stream>