org.apache.tika.config
Class TikaConfig

java.lang.Object
  extended by org.apache.tika.config.TikaConfig

public class TikaConfig
extends Object

Parse xml config file.


Constructor Summary
TikaConfig()
          Creates a default Tika configuration.
TikaConfig(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(Document document)
           
TikaConfig(Element element)
           
TikaConfig(Element element, ClassLoader loader)
           
TikaConfig(File file)
           
TikaConfig(InputStream stream)
           
TikaConfig(String file)
           
TikaConfig(URL url)
           
TikaConfig(URL url, ClassLoader loader)
           
 
Method Summary
static TikaConfig getDefaultConfig()
          Provides a default configuration (TikaConfig).
 Detector getDetector()
          Returns the configured detector instance.
 MediaTypeRegistry getMediaTypeRegistry()
           
 MimeTypes getMimeRepository()
           
 Parser getParser()
          Returns the configured parser instance.
 Parser getParser(MediaType mimeType)
          Deprecated. Use the getParser() method instead
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TikaConfig

public TikaConfig(String file)
           throws TikaException,
                  IOException,
                  SAXException
Throws:
TikaException
IOException
SAXException

TikaConfig

public TikaConfig(File file)
           throws TikaException,
                  IOException,
                  SAXException
Throws:
TikaException
IOException
SAXException

TikaConfig

public TikaConfig(URL url)
           throws TikaException,
                  IOException,
                  SAXException
Throws:
TikaException
IOException
SAXException

TikaConfig

public TikaConfig(URL url,
                  ClassLoader loader)
           throws TikaException,
                  IOException,
                  SAXException
Throws:
TikaException
IOException
SAXException

TikaConfig

public TikaConfig(InputStream stream)
           throws TikaException,
                  IOException,
                  SAXException
Throws:
TikaException
IOException
SAXException

TikaConfig

public TikaConfig(Document document)
           throws TikaException,
                  IOException
Throws:
TikaException
IOException

TikaConfig

public TikaConfig(Element element)
           throws TikaException,
                  IOException
Throws:
TikaException
IOException

TikaConfig

public TikaConfig(Element element,
                  ClassLoader loader)
           throws TikaException,
                  IOException
Throws:
TikaException
IOException

TikaConfig

public TikaConfig(ClassLoader loader)
           throws MimeTypeException,
                  IOException
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.

Parameters:
loader - the class loader through which parser implementations are loaded, or null for no parsers
Throws:
MimeTypeException - if the built-in media type rules are broken
IOException - if the built-in media type rules can not be read
Since:
Apache Tika 0.8

TikaConfig

public TikaConfig()
           throws TikaException,
                  IOException
Creates a default Tika configuration. First checks whether an XML config file is specified, either in
  1. System property "tika.config", or
  2. 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 the service provider mechanism in the context class loader of the current thread.

Throws:
IOException - if the configuration can not be read
TikaException - if problem with MimeTypes or parsing XML config
Method Detail

getParser

public Parser getParser(MediaType mimeType)
Deprecated. Use the getParser() 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

getMimeRepository

public MimeTypes getMimeRepository()

getMediaTypeRegistry

public MediaTypeRegistry getMediaTypeRegistry()

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


Copyright © 2007-2012 The Apache Software Foundation. All Rights Reserved.