public class TikaConfig
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
private static class |
TikaConfig.DetectorXmlLoader |
private static class |
TikaConfig.ExecutorServiceXmlLoader |
private static class |
TikaConfig.ParserXmlLoader |
private static class |
TikaConfig.TranslatorXmlLoader |
private static class |
TikaConfig.XmlLoader<CT,T> |
Modifier and Type | Field and Description |
---|---|
private CompositeDetector |
detector |
private java.util.concurrent.ExecutorService |
executorService |
private MimeTypes |
mimeTypes |
private CompositeParser |
parser |
private ServiceLoader |
serviceLoader |
private Translator |
translator |
Modifier | Constructor and Description |
---|---|
|
TikaConfig()
Creates a default Tika configuration.
|
|
TikaConfig(java.lang.ClassLoader loader)
Creates a Tika configuration from the built-in media type rules
and all the
Parser implementations available through the
service provider mechanism in the given
class 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) |
private |
TikaConfig(org.w3c.dom.Element element,
ServiceLoader loader) |
|
TikaConfig(java.io.File file) |
|
TikaConfig(java.io.File file,
ServiceLoader loader) |
|
TikaConfig(java.io.InputStream stream) |
|
TikaConfig(java.nio.file.Path path) |
|
TikaConfig(java.nio.file.Path path,
ServiceLoader 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) |
Modifier and Type | Method and Description |
---|---|
private static javax.xml.parsers.DocumentBuilder |
getBuilder() |
private static org.w3c.dom.Element |
getChild(org.w3c.dom.Element element,
java.lang.String name) |
private static java.io.InputStream |
getConfigInputStream(java.lang.String config,
ServiceLoader serviceLoader) |
static TikaConfig |
getDefaultConfig()
Provides a default configuration (TikaConfig).
|
protected static CompositeDetector |
getDefaultDetector(MimeTypes types,
ServiceLoader loader) |
private static ConfigurableThreadPoolExecutor |
getDefaultExecutorService() |
private static MimeTypes |
getDefaultMimeTypes(java.lang.ClassLoader loader) |
private static CompositeParser |
getDefaultParser(MimeTypes types,
ServiceLoader loader) |
private static Translator |
getDefaultTranslator(ServiceLoader loader) |
Detector |
getDetector()
Returns the configured detector instance.
|
java.util.concurrent.ExecutorService |
getExecutorService() |
MediaTypeRegistry |
getMediaTypeRegistry() |
MimeTypes |
getMimeRepository() |
Parser |
getParser()
Returns the configured parser instance.
|
Parser |
getParser(MediaType mimeType)
Deprecated.
Use the
getParser() method instead |
ServiceLoader |
getServiceLoader() |
private static java.lang.String |
getText(org.w3c.dom.Node node) |
private static java.util.List<org.w3c.dom.Element> |
getTopLevelElementChildren(org.w3c.dom.Element element,
java.lang.String parentName,
java.lang.String childrenName) |
Translator |
getTranslator()
Returns the configured translator instance.
|
private static java.util.Set<MediaType> |
mediaTypesListFromDomElement(org.w3c.dom.Element node,
java.lang.String tag) |
private static ServiceLoader |
serviceLoaderFromDomElement(org.w3c.dom.Element element,
java.lang.ClassLoader loader) |
private static MimeTypes |
typesFromDomElement(org.w3c.dom.Element element) |
private final ServiceLoader serviceLoader
private final CompositeParser parser
private final CompositeDetector detector
private final Translator translator
private final MimeTypes mimeTypes
private final java.util.concurrent.ExecutorService executorService
public TikaConfig(java.lang.String file) throws TikaException, java.io.IOException, org.xml.sax.SAXException
TikaException
java.io.IOException
org.xml.sax.SAXException
public TikaConfig(java.nio.file.Path path) throws TikaException, java.io.IOException, org.xml.sax.SAXException
TikaException
java.io.IOException
org.xml.sax.SAXException
public TikaConfig(java.nio.file.Path path, ServiceLoader loader) throws TikaException, java.io.IOException, org.xml.sax.SAXException
TikaException
java.io.IOException
org.xml.sax.SAXException
public TikaConfig(java.io.File file) throws TikaException, java.io.IOException, org.xml.sax.SAXException
TikaException
java.io.IOException
org.xml.sax.SAXException
public TikaConfig(java.io.File file, ServiceLoader loader) throws TikaException, java.io.IOException, org.xml.sax.SAXException
TikaException
java.io.IOException
org.xml.sax.SAXException
public TikaConfig(java.net.URL url) throws TikaException, java.io.IOException, org.xml.sax.SAXException
TikaException
java.io.IOException
org.xml.sax.SAXException
public TikaConfig(java.net.URL url, java.lang.ClassLoader loader) throws TikaException, java.io.IOException, org.xml.sax.SAXException
TikaException
java.io.IOException
org.xml.sax.SAXException
public TikaConfig(java.net.URL url, ServiceLoader loader) throws TikaException, java.io.IOException, org.xml.sax.SAXException
TikaException
java.io.IOException
org.xml.sax.SAXException
public TikaConfig(java.io.InputStream stream) throws TikaException, java.io.IOException, org.xml.sax.SAXException
TikaException
java.io.IOException
org.xml.sax.SAXException
public TikaConfig(org.w3c.dom.Document document) throws TikaException, java.io.IOException
TikaException
java.io.IOException
public TikaConfig(org.w3c.dom.Document document, ServiceLoader loader) throws TikaException, java.io.IOException
TikaException
java.io.IOException
public TikaConfig(org.w3c.dom.Element element) throws TikaException, java.io.IOException
TikaException
java.io.IOException
public TikaConfig(org.w3c.dom.Element element, java.lang.ClassLoader loader) throws TikaException, java.io.IOException
TikaException
java.io.IOException
private TikaConfig(org.w3c.dom.Element element, ServiceLoader loader) throws TikaException, java.io.IOException
TikaException
java.io.IOException
public TikaConfig(java.lang.ClassLoader loader) throws MimeTypeException, java.io.IOException
Parser
implementations available through the
service provider mechanism
in the given
class loader.loader
- the class loader through which parser implementations
are loaded, or null
for no parsersMimeTypeException
- if the built-in media type rules are brokenjava.io.IOException
- if the built-in media type rules can not be readpublic TikaConfig() throws TikaException, java.io.IOException
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
the service provider mechanism
in the context
class loader of the current thread.
java.io.IOException
- if the configuration can not be readTikaException
- if problem with MimeTypes or parsing XML configprivate static MimeTypes getDefaultMimeTypes(java.lang.ClassLoader loader)
protected static CompositeDetector getDefaultDetector(MimeTypes types, ServiceLoader loader)
private static CompositeParser getDefaultParser(MimeTypes types, ServiceLoader loader)
private static Translator getDefaultTranslator(ServiceLoader loader)
private static ConfigurableThreadPoolExecutor getDefaultExecutorService()
private static java.io.InputStream getConfigInputStream(java.lang.String config, ServiceLoader serviceLoader) throws TikaException, java.io.IOException
TikaException
java.io.IOException
private static java.lang.String getText(org.w3c.dom.Node node)
public Parser getParser(MediaType mimeType)
getParser()
method insteadpublic Parser getParser()
public Detector getDetector()
public Translator getTranslator()
public java.util.concurrent.ExecutorService getExecutorService()
public MimeTypes getMimeRepository()
public MediaTypeRegistry getMediaTypeRegistry()
public ServiceLoader getServiceLoader()
public static TikaConfig getDefaultConfig()
private static javax.xml.parsers.DocumentBuilder getBuilder() throws TikaException
TikaException
private static org.w3c.dom.Element getChild(org.w3c.dom.Element element, java.lang.String name)
private static java.util.List<org.w3c.dom.Element> getTopLevelElementChildren(org.w3c.dom.Element element, java.lang.String parentName, java.lang.String childrenName) throws TikaException
TikaException
private static MimeTypes typesFromDomElement(org.w3c.dom.Element element) throws TikaException, java.io.IOException
TikaException
java.io.IOException
private static java.util.Set<MediaType> mediaTypesListFromDomElement(org.w3c.dom.Element node, java.lang.String tag) throws TikaException, java.io.IOException
TikaException
java.io.IOException
private static ServiceLoader serviceLoaderFromDomElement(org.w3c.dom.Element element, java.lang.ClassLoader loader)