Class IIORegistry
java.lang.Object
javax.imageio.spi.ServiceRegistry
javax.imageio.spi.IIORegistry
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 TypeClassDescriptionstatic interface
A simple filter interface used byServiceRegistry.getServiceProviders
to select providers matching an arbitrary criterion. -
Method Summary
Modifier and TypeMethodDescriptionstatic IIORegistry
Returns the defaultIIORegistry
instance used by the Image I/O API.void
Registers all available service providers found on the application class path, using the defaultClassLoader
.Methods declared in class ServiceRegistry
contains, deregisterAll, deregisterAll, deregisterServiceProvider, deregisterServiceProvider, getCategories, getServiceProviderByClass, getServiceProviders, getServiceProviders, lookupProviders, lookupProviders, registerServiceProvider, registerServiceProvider, registerServiceProviders, setOrdering, unsetOrdering
Modifier and TypeMethodDescriptionboolean
Returnstrue
ifprovider
is currently registered.void
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.Returns anIterator
ofClass
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 anIterator
containing all registered service providers in the given category.<T> Iterator
<T> getServiceProviders
(Class<T> category, ServiceRegistry.Filter filter, boolean useOrdering) Returns anIterator
containing service provider objects within a given category that satisfy a criterion imposed by the suppliedServiceRegistry.Filter
object'sfilter
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 anIterator
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 TypeMethodDescriptionprotected Object
clone()
Creates and returns a copy of this object.boolean
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 thisObject
.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
Wakes up all threads that are waiting on this object's monitor.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
Returns the defaultIIORegistry
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 defaultClassLoader
. This method is typically invoked by theImageIO.scanForPlugins
method.- See Also:
-