com.groupdocs.parser

Interfaces

Classes

Exceptions

com.groupdocs.parser

Class FictionBookMediaTypeDetector



  • public final class FictionBookMediaTypeDetector
    extends MediaTypeDetector

    Provides the functionality to detect the media type of FB2 (FictionBook) document.

    Detecting the media type of FB2 (FictionBook) document:

     // Create a media type detector of FB2 (FictionBook) document
     MediaTypeDetector detector = new FictionBookMediaTypeDetector();
     // Detect a media type
     String mediaType = detector.detect(stream);
      
    • Constructor Detail

      • FictionBookMediaTypeDetector

        public FictionBookMediaTypeDetector()

        Initializes a new instance of the FictionBookMediaTypeDetector 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.