@ThreadSafe public final class MimeTypeDetectors extends Object implements MimeTypeDetector
MimeTypeDetector
that can be used to detect MIME types. Internally, this detector uses the
TikaMimeTypeDetector
if it is available, or the NullMimeTypeDetector
.Constructor and Description |
---|
MimeTypeDetectors() |
MimeTypeDetectors(Environment environment,
Problems problems)
Creates a new instance with a given environment and optional problems collector.
|
Modifier and Type | Method and Description |
---|---|
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.
|
public MimeTypeDetectors()
public MimeTypeDetectors(Environment environment, Problems problems)
environment
- an Environment
; possibly nullproblems
- an Problems
instance; possibly null;public String mimeTypeOf(String name, Binary binaryValue) throws RepositoryException, IOException
mimeTypeOf
in interface MimeTypeDetector
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
.null
if the MIME-type could not be determined.RepositoryException
- if any error occurs while attempting to read the stream from the binary valueIOException
- If an error occurs reading the supplied content.MimeTypeDetector.mimeTypeOf(String, javax.jcr.Binary)
Copyright © 2008-2014 JBoss, a division of Red Hat. All Rights Reserved.