public void onRegistration(ServiceRegistry registry, Class<?> category) { super.onRegistration(registry, category); Class<ImageInputStreamSpi> targetClass = ImageInputStreamSpi.class; for (Iterator<? extends ImageInputStreamSpi> i = registry.getServiceProviders(targetClass, true); i.hasNext(); ) { ImageInputStreamSpi other = i.next(); if (this != other) registry.setOrdering(targetClass, this, other); } } /**
/** * Upon registration, this method ensures that this SPI is listed at the top * of the ImageInputStreamSpi items, so that it will be invoked before the * default FileImageInputStreamSpi * * @param registry * ServiceRegistry where this object has been registered. * @param category * a Class object indicating the registry category under which * this object has been registered. */ public void onRegistration(ServiceRegistry registry, Class<?> category) { super.onRegistration(registry, category); Class<ImageInputStreamSpi> targetClass = ImageInputStreamSpi.class; for (Iterator<? extends ImageInputStreamSpi> i = registry.getServiceProviders(targetClass, true); i.hasNext();) { ImageInputStreamSpi other = i.next(); // using class name to avoid warnings in JDK 11 if (other != null && other.getClass().getName().equals("com.sun.imageio.spi.FileImageInputStreamSpi")) registry.deregisterServiceProvider(other); if (this != other) registry.setOrdering(targetClass, this, other); } }
/** * Upon registration, this method ensures that this SPI is listed at the top * of the ImageInputStreamSpi items, so that it will be invoked before the * default FileImageInputStreamSpi * * @param registry * ServiceRegistry where this object has been registered. * @param category * a Class object indicating the registry category under which * this object has been registered. */ public void onRegistration(ServiceRegistry registry, Class<?> category) { super.onRegistration(registry, category); Class<ImageInputStreamSpi> targetClass = ImageInputStreamSpi.class; for (Iterator<? extends ImageInputStreamSpi> i = registry.getServiceProviders(targetClass, true); i.hasNext();) { ImageInputStreamSpi other = i.next(); if (other instanceof FileImageInputStreamSpi) registry.deregisterServiceProvider(other); if (this != other) registry.setOrdering(targetClass, this, other); } }