Interface MimeTypeRegistryProvider


public interface MimeTypeRegistryProvider
This interface defines a factory for MimeTypeRegistry. An implementation of this interface should provide instances of the MimeTypeRegistry based on the way how to access the storage for MimeTypeEntries.

Jakarta Activation uses Service Provider Interface and ServiceLoader to obtain an instance of the implementation of the MimeTypeRegistryProvider.

  • Method Summary

    Modifier and Type
    Method
    Description
    Retrieve an instance of the MimeTypeRegistry based on the name of the file where the MimeTypeEntries are stored.
    Retrieve an instance of the MimeTypeRegistry based on the InputStream that is used to read data from some named resource.
    Retrieve an instance of the in-memory implementation of the MimeTypeRegistry.
  • Method Details

    • getByFileName

      MimeTypeRegistry getByFileName(String name) throws IOException
      Retrieve an instance of the MimeTypeRegistry based on the name of the file where the MimeTypeEntries are stored.
      Parameters:
      name - The name of the file that stores MimeTypeEntries.
      Returns:
      The instance of the MimeTypeRegistry, or null if none are found.
      Throws:
      IOException - If an instance of the MailcapRegistry class cannot be found or loaded.
    • getByInputStream

      MimeTypeRegistry getByInputStream(InputStream inputStream) throws IOException
      Retrieve an instance of the MimeTypeRegistry based on the InputStream that is used to read data from some named resource.
      Parameters:
      inputStream - InputStream for some resource that contains MimeTypeEntries.
      Returns:
      The instance of the MimeTypeRegistry, or null if none are found.
      Throws:
      IOException - If an instance of the MailcapRegistry class cannot be found or loaded.
    • getInMemory

      MimeTypeRegistry getInMemory()
      Retrieve an instance of the in-memory implementation of the MimeTypeRegistry. Jakarta Activation can throw NoSuchElementException or ServiceConfigurationError if no implementations were found.
      Returns:
      In-memory implementation of the MimeTypeRegistry.
      Throws:
      NoSuchElementException - If no implementations were found.
      ServiceConfigurationError - If no implementations were loaded.