com.groupdocs.parser

Interfaces

Classes

Exceptions

com.groupdocs.parser

Class ChmMediaTypeDetector



  • public final class ChmMediaTypeDetector
    extends MediaTypeDetector

    Provides the functionality to detect the media type of CHM.

    Usage:

     // Create a media type detector
     ChmMediaTypeDetector detector = new ChmMediaTypeDetector();
     // Detect a media type by the file name
     System.out.println(detector.detect("file.chm")); // APPLICATION/VND.MS-HTMLHELP if supported or NULL otherwise
     // Detect a media type by the content
     System.out.println(detector.detect(stream)); // APPLICATION/VND.MS-HTMLHELP if supported or NULL otherwise
      
    • Constructor Detail

      • ChmMediaTypeDetector

        public ChmMediaTypeDetector()

        Initializes a new instance of the ChmMediaTypeDetector class.

    • Method Detail

      • detectByContent

        protected String detectByContent(InputStream stream)

        Detects the media type by the content of the stream.

        Overrides:
        detectByContent in class MediaTypeDetector
        Parameters:
        stream - Stream of the document.
        Returns:
        A string with the media type if the media type is detected; otherwise, null.
      • detectByExt

        protected String detectByExt(String ext)

        Detects the media type by the ext.

        Specified by:
        detectByExt in class MediaTypeDetector
        Parameters:
        ext - The extension of the file in the UPPER case.
        Returns:
        A string with the media type if the media type is detected; otherwise, null.
      • checkMediaType

        protected boolean checkMediaType(String mediaType)

        Detects whether the mediaType is supported by the detector.

        Specified by:
        checkMediaType in class MediaTypeDetector
        Parameters:
        mediaType - A string with media type in the UPPER case.
        Returns:
        A boolean true if the media type is supported; otherwise, false.