Method CanRead
CanRead(Stream)
Sniffs whether a stream looks like HTML, restoring its position before returning.
public bool CanRead(Stream stream)
Parameters
streamStreamThe seekable stream to sniff.
Returns
Remarks
HTML has no magic number, so detection looks for a doctype or a recognizable element in the leading bytes. The probe is deliberately conservative: a false positive would let HTML claim a stream some other reader should have had, and this reader is registered after the ones that do have magic numbers precisely so that ordering, not this probe, is what keeps DOCX and DOC safe.
Exceptions
- ArgumentNullException
streamis null.- ArgumentException
The stream is not seekable.