Package org.apache.tika.config
Class TikaConfig
- java.lang.Object
-
- org.apache.tika.config.TikaConfig
-
public class TikaConfig extends java.lang.Object
Parse xml config file.
-
-
Constructor Summary
Constructors Constructor Description TikaConfig()
Creates a default Tika configuration.TikaConfig(java.io.File file)
TikaConfig(java.io.File file, ServiceLoader loader)
TikaConfig(java.io.InputStream stream)
TikaConfig(java.lang.ClassLoader loader)
Creates a Tika configuration from the built-in media type rules and all theParser
implementations available through theservice provider mechanism
in the given class loader.TikaConfig(java.lang.String file)
TikaConfig(java.net.URL url)
TikaConfig(java.net.URL url, java.lang.ClassLoader loader)
TikaConfig(java.net.URL url, ServiceLoader loader)
TikaConfig(java.nio.file.Path path)
TikaConfig(java.nio.file.Path path, ServiceLoader loader)
TikaConfig(org.w3c.dom.Document document)
TikaConfig(org.w3c.dom.Document document, ServiceLoader loader)
TikaConfig(org.w3c.dom.Element element)
TikaConfig(org.w3c.dom.Element element, java.lang.ClassLoader loader)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description static TikaConfig
getDefaultConfig()
Provides a default configuration (TikaConfig).Detector
getDetector()
Returns the configured detector instance.EncodingDetector
getEncodingDetector()
Returns the configured encoding detector instancejava.util.concurrent.ExecutorService
getExecutorService()
MediaTypeRegistry
getMediaTypeRegistry()
MimeTypes
getMimeRepository()
Parser
getParser()
Returns the configured parser instance.Parser
getParser(MediaType mimeType)
Deprecated.Use thegetParser()
method insteadServiceLoader
getServiceLoader()
Translator
getTranslator()
Returns the configured translator instance.
-
-
-
Constructor Detail
-
TikaConfig
public TikaConfig(java.lang.String file) throws TikaException, java.io.IOException, org.xml.sax.SAXException
- Throws:
TikaException
java.io.IOException
org.xml.sax.SAXException
-
TikaConfig
public TikaConfig(java.nio.file.Path path) throws TikaException, java.io.IOException, org.xml.sax.SAXException
- Throws:
TikaException
java.io.IOException
org.xml.sax.SAXException
-
TikaConfig
public TikaConfig(java.nio.file.Path path, ServiceLoader loader) throws TikaException, java.io.IOException, org.xml.sax.SAXException
- Throws:
TikaException
java.io.IOException
org.xml.sax.SAXException
-
TikaConfig
public TikaConfig(java.io.File file) throws TikaException, java.io.IOException, org.xml.sax.SAXException
- Throws:
TikaException
java.io.IOException
org.xml.sax.SAXException
-
TikaConfig
public TikaConfig(java.io.File file, ServiceLoader loader) throws TikaException, java.io.IOException, org.xml.sax.SAXException
- Throws:
TikaException
java.io.IOException
org.xml.sax.SAXException
-
TikaConfig
public TikaConfig(java.net.URL url) throws TikaException, java.io.IOException, org.xml.sax.SAXException
- Throws:
TikaException
java.io.IOException
org.xml.sax.SAXException
-
TikaConfig
public TikaConfig(java.net.URL url, java.lang.ClassLoader loader) throws TikaException, java.io.IOException, org.xml.sax.SAXException
- Throws:
TikaException
java.io.IOException
org.xml.sax.SAXException
-
TikaConfig
public TikaConfig(java.net.URL url, ServiceLoader loader) throws TikaException, java.io.IOException, org.xml.sax.SAXException
- Throws:
TikaException
java.io.IOException
org.xml.sax.SAXException
-
TikaConfig
public TikaConfig(java.io.InputStream stream) throws TikaException, java.io.IOException, org.xml.sax.SAXException
- Throws:
TikaException
java.io.IOException
org.xml.sax.SAXException
-
TikaConfig
public TikaConfig(org.w3c.dom.Document document) throws TikaException, java.io.IOException
- Throws:
TikaException
java.io.IOException
-
TikaConfig
public TikaConfig(org.w3c.dom.Document document, ServiceLoader loader) throws TikaException, java.io.IOException
- Throws:
TikaException
java.io.IOException
-
TikaConfig
public TikaConfig(org.w3c.dom.Element element) throws TikaException, java.io.IOException
- Throws:
TikaException
java.io.IOException
-
TikaConfig
public TikaConfig(org.w3c.dom.Element element, java.lang.ClassLoader loader) throws TikaException, java.io.IOException
- Throws:
TikaException
java.io.IOException
-
TikaConfig
public TikaConfig(java.lang.ClassLoader loader) throws MimeTypeException, java.io.IOException
Creates a Tika configuration from the built-in media type rules and all theParser
implementations available through theservice provider mechanism
in the given class loader.- Parameters:
loader
- the class loader through which parser implementations are loaded, ornull
for no parsers- Throws:
MimeTypeException
- if the built-in media type rules are brokenjava.io.IOException
- if the built-in media type rules can not be read- Since:
- Apache Tika 0.8
-
TikaConfig
public TikaConfig() throws TikaException, java.io.IOException
Creates a default Tika configuration. First checks whether an XML config file is specified, either in- System property "tika.config", or
- Environment variable TIKA_CONFIG
If one of these have a value, try to resolve it relative to file system or classpath.
If XML config is not specified, initialize from the built-in media type rules and all the
Parser
implementations available through theservice provider mechanism
in the context class loader of the current thread.- Throws:
java.io.IOException
- if the configuration can not be readTikaException
- if problem with MimeTypes or parsing XML config
-
-
Method Detail
-
getParser
public Parser getParser(MediaType mimeType)
Deprecated.Use thegetParser()
method instead
-
getParser
public Parser getParser()
Returns the configured parser instance.- Returns:
- configured parser
-
getDetector
public Detector getDetector()
Returns the configured detector instance.- Returns:
- configured detector
-
getEncodingDetector
public EncodingDetector getEncodingDetector()
Returns the configured encoding detector instance- Returns:
- configured encoding detector
-
getTranslator
public Translator getTranslator()
Returns the configured translator instance.- Returns:
- configured translator
-
getExecutorService
public java.util.concurrent.ExecutorService getExecutorService()
-
getMimeRepository
public MimeTypes getMimeRepository()
-
getMediaTypeRegistry
public MediaTypeRegistry getMediaTypeRegistry()
-
getServiceLoader
public ServiceLoader getServiceLoader()
-
getDefaultConfig
public static TikaConfig getDefaultConfig()
Provides a default configuration (TikaConfig). Currently creates a new instance each time it's called; we may be able to have it return a shared instance once it is completely immutable.- Returns:
- default configuration
-
-