ModeShape Distribution 3.2.0.Final

org.modeshape.jcr.mimetype
Class MimeTypeDetectors

java.lang.Object
  extended by org.modeshape.jcr.mimetype.MimeTypeDetectors
All Implemented Interfaces:
MimeTypeDetector

@ThreadSafe
public final class MimeTypeDetectors
extends Object
implements MimeTypeDetector

Implementation of MimeTypeDetector that can be used to detect MIME types. Internally, this detector uses the TikaMimeTypeDetector if it is available, or the NullMimeTypeDetector.


Constructor Summary
MimeTypeDetectors()
           
MimeTypeDetectors(Environment environment)
           
 
Method Summary
 String mimeTypeOf(String name, Binary binaryValue)
          Returns the first non-null result of iterating over the registered MIME-type detectors If the MIME-type cannot be determined by any registered detector, "text/plain" or "application/octet-stream" will be returned, the former only if it is determined the stream contains no nulls.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MimeTypeDetectors

public MimeTypeDetectors()

MimeTypeDetectors

public MimeTypeDetectors(Environment environment)
Method Detail

mimeTypeOf

public String mimeTypeOf(String name,
                         Binary binaryValue)
                  throws RepositoryException,
                         IOException
Returns the first non-null result of iterating over the registered MIME-type detectors If the MIME-type cannot be determined by any registered detector, "text/plain" or "application/octet-stream" will be returned, the former only if it is determined the stream contains no nulls.

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.
See Also:
MimeTypeDetector.mimeTypeOf(String, javax.jcr.Binary)

ModeShape Distribution 3.2.0.Final

Copyright © 2008-2013 JBoss, a division of Red Hat. All Rights Reserved.