IIORegistry (Java SE 26 & JDK 26)
Description: declaration: module: java.desktop, package: javax.imageio.spi, class: IIORegistry
Keywords: javax.imageio.spi.IIORegistry class

# Class IIORegistry

java.lang.Object
javax.imageio.spi.ServiceRegistry
javax.imageio.spi.IIORegistry

public final class IIORegistry extends ServiceRegistry
A registry for Image I/O service provider instances. Service provider classes may be discovered at runtime by the mechanisms documented in `ServiceLoader`. The intent is that it be relatively inexpensive to load and inspect all available Image I/O service provider classes. These classes may then be used to locate and instantiate more heavyweight classes that will perform actual work, in this case instances of `ImageReader`, `ImageWriter`, `ImageTranscoder`, `ImageInputStream`, and `ImageOutputStream`. Service providers included in the Java runtime are automatically loaded as soon as this class is instantiated.

When the `registerApplicationClasspathSpis` method is called, additional service provider instances will be discovered using `ServiceLoader`.

It is also possible to manually add service providers not found automatically, as well as to remove those that are using the interfaces of the `ServiceRegistry` class. Thus the application may customize the contents of the registry as it sees fit.

For information on how to create and deploy service providers, refer to the documentation on `ServiceLoader`

- ## Nested Class Summary

  ### Nested classes/interfaces declared in class ServiceRegistry

  `ServiceRegistry.Filter`
  Modifier and Type
  Class
  Description
  `static interface`
  `ServiceRegistry.Filter`
  A simple filter interface used by `ServiceRegistry.getServiceProviders` to select providers matching an arbitrary criterion.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `static IIORegistry`
  `getDefaultInstance()`
  Returns the default `IIORegistry` instance used by the Image I/O API.
  `void`
  `registerApplicationClasspathSpis()`
  Registers all available service providers found on the application class path, using the default `ClassLoader`.

  ### Methods declared in class ServiceRegistry

  `contains, deregisterAll, deregisterAll, deregisterServiceProvider, deregisterServiceProvider, getCategories, getServiceProviderByClass, getServiceProviders, getServiceProviders, lookupProviders, lookupProviders, registerServiceProvider, registerServiceProvider, registerServiceProviders, setOrdering, unsetOrdering`
  Modifier and Type
  Method
  Description
  `boolean`
  `contains(Object provider)`
  Returns `true` if `provider` is currently registered.
  `void`
  `deregisterAll()`
  Deregisters all currently registered service providers from all categories.
  `void`
  `deregisterAll(Class<?> category)`
  Deregisters all service provider object currently registered under the given category.
  `void`
  `deregisterServiceProvider(Object provider)`
  Removes a service provider object from all categories that contain it.
  `<T> boolean`
  `deregisterServiceProvider(T provider, Class<T> category)`
  Removes a service provider object from the given category.
  `Iterator<Class<?>>`
  `getCategories()`
  Returns an `Iterator` of `Class` objects indicating the current set of categories.
  `<T> T`
  `getServiceProviderByClass(Class<T> providerClass)`
  Returns the currently registered service provider object that is of the given class type.
  `<T> Iterator<T>`
  `getServiceProviders(Class<T> category, boolean useOrdering)`
  Returns an `Iterator` containing all registered service providers in the given category.
  `<T> Iterator<T>`
  `getServiceProviders(Class<T> category, ServiceRegistry.Filter filter, boolean useOrdering)`
  Returns an `Iterator` containing service provider objects within a given category that satisfy a criterion imposed by the supplied `ServiceRegistry.Filter` object's `filter` method.
  `static <T> Iterator<T>`
  `lookupProviders(Class<T> providerClass)`
  Locates and incrementally instantiates the available providers of a given service using the context class loader.
  `static <T> Iterator<T>`
  `lookupProviders(Class<T> providerClass, ClassLoader loader)`
  Searches for implementations of a particular service class using the given class loader.
  `void`
  `registerServiceProvider(Object provider)`
  Adds a service provider object to the registry.
  `<T> boolean`
  `registerServiceProvider(T provider, Class<T> category)`
  Adds a service provider object to the registry.
  `void`
  `registerServiceProviders(Iterator<?> providers)`
  Adds a set of service provider objects, taken from an `Iterator` to the registry.
  `<T> boolean`
  `setOrdering(Class<T> category, T firstProvider, T secondProvider)`
  Sets a pairwise ordering between two service provider objects within a given category.
  `<T> boolean`
  `unsetOrdering(Class<T> category, T firstProvider, T secondProvider)`
  Sets a pairwise ordering between two service provider objects within a given category.

  ### Methods declared in class Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`
  Modifier and Type
  Method
  Description
  `protected Object`
  `clone()`
  Creates and returns a copy of this object.
  `boolean`
  `equals(Object obj)`
  Indicates whether some other object is "equal to" this one.
  `protected void`
  `finalize()`
  Deprecated, for removal: This API element is subject to removal in a future version.
  Finalization is deprecated and subject to removal in a future release.
  `final Class<?>`
  `getClass()`
  Returns the runtime class of this `Object`.
  `int`
  `hashCode()`
  Returns a hash code value for this object.
  `final void`
  `notify()`
  Wakes up a single thread that is waiting on this object's monitor.
  `final void`
  `notifyAll()`
  Wakes up all threads that are waiting on this object's monitor.
  `String`
  `toString()`
  Returns a string representation of the object.
  `final void`
  `wait()`
  Causes the current thread to wait until it is awakened, typically by being notified or interrupted.
  `final void`
  `wait(long timeoutMillis)`
  Causes the current thread to wait until it is awakened, typically by being notified or interrupted, or until a certain amount of real time has elapsed.
  `final void`
  `wait(long timeoutMillis, int nanos)`
  Causes the current thread to wait until it is awakened, typically by being notified or interrupted, or until a certain amount of real time has elapsed.

- ## Method Details

  - ### getDefaultInstance

    public static IIORegistry getDefaultInstance()
    Returns the default `IIORegistry` instance used by the Image I/O API. This instance should be used for all registry functions.
    Returns:
      the default registry for the Image I/O API

  - ### registerApplicationClasspathSpis

    public void registerApplicationClasspathSpis()
    Registers all available service providers found on the application class path, using the default `ClassLoader`. This method is typically invoked by the `ImageIO.scanForPlugins` method.
    See Also:
      - `ImageIO.scanForPlugins()`
      - `ClassLoader.getResources(String)`