Class Tika

java.lang.Object
org.cdlib.mrt.core.Tika

public class Tika extends Object
Container class for Storage ERC content
Author:
dloy
  • Field Details

    • logger

      protected LoggerInf logger
    • detector

      protected org.apache.tika.detect.Detector detector
    • mediaType

      protected org.apache.tika.mime.MediaType mediaType
    • alternates

      protected HashMap<String,String> alternates
    • keys

      protected ArrayList<String> keys
  • Constructor Details

  • Method Details

    • getTika

      public static Tika getTika(LoggerInf logger) throws TException
      Throws:
      TException
    • getMediaType

      public org.apache.tika.mime.MediaType getMediaType(InputStream componentStream, String filenameWithExtension) throws TException
      Returns a tika Media based on the input stream and file Extension
      Parameters:
      componentStream - input stream
      filenameWithExtension - name with extension
      Returns:
      MediaType containing Mime Type
      Throws:
      TException - Note that closing the InputStream is REQUIRED (this version) - not performed by Tika
    • getMediaType

      public org.apache.tika.mime.MediaType getMediaType(File componentFile) throws TException
      Return MediaType just using File
      Parameters:
      componentFile -
      Returns:
      Throws:
      TException
    • getMimeType

      public String getMimeType(File componentFile) throws TException
      Get mime type using just a File
      Parameters:
      componentFile -
      Returns:
      MimeType
      Throws:
      TException
    • getMimeType

      public String getMimeType(InputStream componentStream, String fileID) throws TException
      Throws:
      TException
    • setTika

      public void setTika(FileComponent component, File testFile, String fileID) throws TException
      Set mime type using Tika
      Parameters:
      component - file component with componentFile set
      Throws:
      TException
    • setTika

      public void setTika(FileComponent component, InputStream stream, String fileID) throws TException
      Set mime type using Tika
      Parameters:
      component - file component with componentFile set
      Throws:
      TException