Class TikaDetector

java.lang.Object
it.ozimov.springboot.mail.utils.TikaDetector

public class TikaDetector extends Object
A convenience singleton class that uses ApacheTika to guess the MIME type.
  • Method Details

    • tikaDetector

      public static TikaDetector tikaDetector()
    • detect

      public org.springframework.http.MediaType detect(InputStream inputStream, String fileName) throws IOException
      Detect the MediaType of the given input stream
      Parameters:
      inputStream - the stream for which the content has to be detected
      fileName - filename with extension
      Returns:
      the guessed media type
      Throws:
      IOException