org.modeshape.jcr.mimetype

## Interface MimeTypeDetector

- All Known Implementing Classes:
    MimeTypeDetectors, NullMimeTypeDetector, TikaMimeTypeDetector

      public interface MimeTypeDetector

  MIME-type detection libraries must provide thread-safe implementations of this interface to enable ModeShape to use the libraries to return MIME-types for data sources. Implementors are expected to have a public, no-arg constructor.

- - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `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.

- - ### Method Detail

    - #### mimeTypeOf

          String mimeTypeOf(String name,
                          Binary binaryValue)
                            throws RepositoryException,
                                   IOException

      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.
      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:
        `IOException` - If an error occurs reading the supplied content.
        `RepositoryException` - if any error occurs while attempting to read the stream from the binary value

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