Class TikaUtil


  • public class TikaUtil
    extends java.lang.Object
    Utility class for integrating with Apache Tika.
    Since:
    7.0.3
    Version:
    $Revision$ $Date$
    • Constructor Summary

      Constructors 
      Constructor Description
      TikaUtil()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static java.lang.String extractText​(java.io.File file)
      Extracts the text from the given file.
      static java.lang.String extractText​(java.io.InputStream inputStream)
      Extracts text from the given input stream.
      static java.lang.String getContentType​(java.io.File file)
      Extracts the content type from the given file.
      static java.lang.String getContentType​(java.io.InputStream inputStream)
      Extracts the content type from the given input stream.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • TikaUtil

        public TikaUtil()
    • Method Detail

      • extractText

        public static java.lang.String extractText​(java.io.File file)
                                            throws ParseException,
                                                   java.io.FileNotFoundException,
                                                   java.lang.IllegalArgumentException
        Extracts the text from the given file.
        Parameters:
        file - the file.
        Returns:
        the extracted text.
        Throws:
        ParseException - if some error occur during parsing.
        java.lang.IllegalArgumentException - if the file is null or if it does not represent a file.
        java.io.FileNotFoundException - if the file does not exist.
        Since:
        7.0.3
      • extractText

        public static java.lang.String extractText​(java.io.InputStream inputStream)
                                            throws ParseException,
                                                   java.lang.IllegalArgumentException
        Extracts text from the given input stream.
        Parameters:
        inputStream - the input stream.
        Returns:
        the extracted text.
        Throws:
        ParseException - if some error occur during parsing.
        java.lang.IllegalArgumentException - if the input stream is null.
        Since:
        7.0.3
      • getContentType

        public static java.lang.String getContentType​(java.io.File file)
                                               throws ParseException,
                                                      java.io.FileNotFoundException
        Extracts the content type from the given file.
        Parameters:
        file - the file.
        Returns:
        the content type.
        Throws:
        ParseException - if some error occur during parsing.
        java.lang.IllegalArgumentException - if the file is null or if it does not represent a file.
        java.io.FileNotFoundException - if the file does not exist.
        Since:
        7.0.3
      • getContentType

        public static java.lang.String getContentType​(java.io.InputStream inputStream)
                                               throws ParseException
        Extracts the content type from the given input stream.
        Parameters:
        inputStream - the input stream.
        Returns:
        the content type.
        Throws:
        ParseException - if some error occur during parsing.
        java.lang.IllegalArgumentException - if the input stream is null.
        Since:
        7.0.3