CompositeMediaTypeDetector Class
Provides the functionality to detect various media types.
Inheritance Hierarchy

Namespace: GroupDocs.Parser.Detectors.MediaType
Assembly: GroupDocs.Parser (in GroupDocs.Parser.dll) Version: 19.5
public sealed class CompositeMediaTypeDetector : MediaTypeDetector

The CompositeMediaTypeDetector type exposes the following members.

Public methodCompositeMediaTypeDetector
Initializes a new instance of the CompositeMediaTypeDetector class.
Public methodDetect(Stream)
Detects the media type by the content of the stream.
(Inherited from MediaTypeDetector.)
Public methodDetect(String)
Detects the media type by the fileName.
(Inherited from MediaTypeDetector.)
Public methodDetect(Stream, LoadOptions)
Detects the media type by the content of the stream.
(Inherited from MediaTypeDetector.)
Public methodEquals
Determines whether the specified Object is equal to the current Object.
(Inherited from Object.)
Public methodGetHashCode
Serves as a hash function for a particular type.
(Inherited from Object.)
Public methodGetType
Gets the type of the current instance.
(Inherited from Object.)
Public methodSupports
Detects whether the mediaType is supported by the detector.
(Inherited from MediaTypeDetector.)
Public methodToString
Returns a string that represents the current object.
(Inherited from Object.)
Public fieldStatic memberDefault
A default media type detector.

For detecting media type of any document type CompositeMediaTypeDetector is used:

// Create a composite media type detector
var detector = CompositeMediaTypeDetector.Default;
// Detect a media type
var mediaType = detector.Detect(stream);

Default property contains all supported media type detectors.

var detector = new CompositeMediaTypeDetector(
  new MediaTypeDetector[]
    new CellsMediaTypeDetector(), // media type detector of a spreadsheet
    new WordsMediaTypeDetector(), // media type detector of a text document
    new SlidesMediaTypeDetector(), // media type detector of a presentation

It detects only media type of spreadsheets, presentations and text documents.

See Also