Table of Contents

Method CanRead

Namespace
DocWright.Formats.Rtf
Assembly
DocWright.Formats.Rtf.dll

CanRead(Stream)

Sniffs whether a stream looks like RTF, restoring its position before returning.

public bool CanRead(Stream stream)

Parameters

stream Stream

The seekable stream to sniff.

Returns

bool

true when the stream looks like RTF.

Remarks

RTF has a real signature — every conforming document begins {\rtf — which makes this probe both cheap and safe, unlike HTML's. Leading whitespace and a UTF-8 byte order mark are tolerated because both appear in the wild.

Exceptions

ArgumentNullException

stream is null.

ArgumentException

The stream is not seekable.