Class MimeTypeUtil


  • public class MimeTypeUtil
    extends Object
    Utility class to detect MIME type based on data array. This class is based on Apache Tika part of the Lucene project. http://lucene.apache.org/tika/
    Author:
    iperdomo
    • Constructor Detail

      • MimeTypeUtil

        public MimeTypeUtil()
    • Method Detail

      • getInstance

        public static MimeTypeUtil getInstance()
        Returns the instance of the MimeTypeUtil class
        Returns:
        MimeTypeUtil instance
      • setInstace

        public static void setInstace​(MimeTypeUtil ins)
      • getMimeType

        @Deprecated
        public org.apache.tika.mime.MimeType getMimeType​(byte[] data)
        Deprecated.
        This method will always return null
        Returns a MimeType object based on the byte array provided as parameter
        Parameters:
        data - byte array from which we want to detect the MIME type
        Returns:
        MimeType representation
      • getMimeTypeName

        public String getMimeTypeName​(byte[] data)
        Returns the MIME type name, e.g. image/png based on the byte array passed as parameter. Returns application/octet-stream if no better match is found.
        Parameters:
        data - byte array from which we want to detect the MIME type
        Returns:
        A MIME type name, e.g. "image/png"