com.groupdocs.parser

Interfaces

Classes

Exceptions

com.groupdocs.parser

Class CellsMediaTypeDetector



  • public final class CellsMediaTypeDetector
    extends MediaTypeDetector

    Provides the functionality to detect the media type of a spreadsheet.


    Supported formats:

    .XLSMicrosoft Excel Spreadsheet
    .XLSXMicrosoft Office Open XML Workbook
    .XLSBMicrosoft Excel 2007 Binary Workbook
    .ODSOpenDocument spreadsheet

    Detecting the media type of a spreadsheet:

     // Create a media type detector of a spreadsheet
     CellsMediaTypeDetector detector = new CellsMediaTypeDetector();
     // Detect a media type
     String mediaType = detector.detect(stream);
      
    • Constructor Detail

      • CellsMediaTypeDetector

        public CellsMediaTypeDetector()

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