org.modeshape.jcr.mimetype
Class TikaMimeTypeDetector
java.lang.Object
org.modeshape.jcr.mimetype.TikaMimeTypeDetector
- All Implemented Interfaces:
- MimeTypeDetector
@Immutable
@ThreadSafe
public final class TikaMimeTypeDetector
- extends Object
- implements MimeTypeDetector
A MimeTypeDetector
that uses the Tika library.
Field Summary |
protected org.apache.tika.mime.MimeTypes |
mimetypes
|
Method Summary |
String |
mimeTypeOf(String name,
Binary binaryValue)
Returns the MIME-type of a binary value, using its supplied content and/or its supplied name, depending upon the
implementation. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
mimetypes
protected final org.apache.tika.mime.MimeTypes mimetypes
TikaMimeTypeDetector
public TikaMimeTypeDetector(ClassLoader classLoader)
mimeTypeOf
public String mimeTypeOf(String name,
Binary binaryValue)
throws RepositoryException,
IOException
- Description copied from interface:
MimeTypeDetector
- Returns the MIME-type of a binary value, using its supplied content and/or its supplied name, depending upon the
implementation. If the MIME-type cannot be determined, either a "default" MIME-type or
null
may be returned,
where the former will prevent earlier registered MIME-type detectors from being consulted.
- Specified by:
mimeTypeOf
in interface MimeTypeDetector
- Parameters:
name
- The name of the data source; may be null
.binaryValue
- The value which contains the raw data for which the mime type should be returned; may be
null
.
- Returns:
- The MIME-type of the data source, or optionally
null
if the MIME-type could not be determined.
- Throws:
RepositoryException
- if any error occurs while attempting to read the stream from the binary value
IOException
- If an error occurs reading the supplied content.
Copyright © 2008-2013 JBoss, a division of Red Hat. All Rights Reserved.