org.apache.tika.mime
Class MimeTypesFactory

java.lang.Object
  extended by org.apache.tika.mime.MimeTypesFactory

public class MimeTypesFactory
extends Object

Creates instances of MimeTypes.


Constructor Summary
MimeTypesFactory()
           
 
Method Summary
static MimeTypes create()
          Creates an empty instance; same as calling new MimeTypes().
static MimeTypes create(Document document)
          Creates and returns a MimeTypes instance from the specified document.
static MimeTypes create(InputStream... inputStreams)
          Creates and returns a MimeTypes instance from the specified input stream.
static MimeTypes create(InputStream stream)
           
static MimeTypes create(String filePath)
          Creates and returns a MimeTypes instance from the specified file path, as interpreted by the class loader in getResource().
static MimeTypes create(String coreFilePath, String extensionFilePath)
          Creates and returns a MimeTypes instance.
static MimeTypes create(URL... urls)
          Creates and returns a MimeTypes instance from the resource at the location specified by the URL.
static MimeTypes create(URL url)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MimeTypesFactory

public MimeTypesFactory()
Method Detail

create

public static MimeTypes create()
Creates an empty instance; same as calling new MimeTypes().

Returns:
an empty instance

create

public static MimeTypes create(Document document)
                        throws MimeTypeException
Creates and returns a MimeTypes instance from the specified document.

Throws:
MimeTypeException - if the type configuration is invalid

create

public static MimeTypes create(InputStream... inputStreams)
                        throws IOException,
                               MimeTypeException
Creates and returns a MimeTypes instance from the specified input stream. Does not close the input stream(s).

Throws:
IOException - if the stream can not be read
MimeTypeException - if the type configuration is invalid

create

public static MimeTypes create(InputStream stream)
                        throws IOException,
                               MimeTypeException
Throws:
IOException
MimeTypeException
See Also:
create(InputStream...)

create

public static MimeTypes create(URL... urls)
                        throws IOException,
                               MimeTypeException
Creates and returns a MimeTypes instance from the resource at the location specified by the URL. Opens and closes the InputStream from the URL. If multiple URLs are supplied, then they are loaded in turn.

Throws:
IOException - if the URL can not be accessed
MimeTypeException - if the type configuration is invalid

create

public static MimeTypes create(URL url)
                        throws IOException,
                               MimeTypeException
Throws:
IOException
MimeTypeException
See Also:
create(URL...)

create

public static MimeTypes create(String filePath)
                        throws IOException,
                               MimeTypeException
Creates and returns a MimeTypes instance from the specified file path, as interpreted by the class loader in getResource().

Throws:
IOException - if the file can not be accessed
MimeTypeException - if the type configuration is invalid

create

public static MimeTypes create(String coreFilePath,
                               String extensionFilePath)
                        throws IOException,
                               MimeTypeException
Creates and returns a MimeTypes instance. The core mimetypes will be loaded from the specified file path, and any custom override mimetypes found will loaded afterwards. The file paths will be interpreted by the class loader in getResource().

Parameters:
coreFilePath - The main MimeTypes file to load
extensionFilePath - The name of extension MimeType files to load afterwards
Throws:
IOException - if the file can not be accessed
MimeTypeException - if the type configuration is invalid


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