本文整理汇总了Java中javax.imageio.spi.IIOServiceProvider类的典型用法代码示例。如果您正苦于以下问题:Java IIOServiceProvider类的具体用法?Java IIOServiceProvider怎么用?Java IIOServiceProvider使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
IIOServiceProvider类属于javax.imageio.spi包,在下文中一共展示了IIOServiceProvider类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testSpi
import javax.imageio.spi.IIOServiceProvider; //导入依赖的package包/类
private void testSpi(IIOServiceProvider spi) {
if (spi.getVendorName() == null) {
error(spi + " getVendorName == null!");
}
if (spi.getVersion() == null) {
error(spi + " getVersion == null!");
}
}
示例2: check
import javax.imageio.spi.IIOServiceProvider; //导入依赖的package包/类
private static void check(IIOServiceProvider spi) {
String version = spi.getVersion();
if (!version.equals("1.0")) {
throw new RuntimeException("Provider " +
spi.getClass().getName() +
" has version " + version + "!");
}
}
示例3: clearImageIORegistry
import javax.imageio.spi.IIOServiceProvider; //导入依赖的package包/类
protected void clearImageIORegistry() {
IIORegistry registry = IIORegistry.getDefaultInstance();
Iterator<Class<?>> categories = registry.getCategories();
final ClassLoader webClassLoader = getWebApplicationClassLoader();
ServiceRegistry.Filter classLoaderFilter = provider -> {
//remove all service provider loaded by the current ClassLoader
return webClassLoader.equals(provider.getClass().getClassLoader());
};
while (categories.hasNext()) {
@SuppressWarnings("unchecked")
Class<IIOServiceProvider> category = (Class<IIOServiceProvider>) categories.next();
Iterator<IIOServiceProvider> serviceProviders = registry.getServiceProviders(category,
classLoaderFilter, true);
if (serviceProviders.hasNext()) {
info("removing service provider of category: " + category.getSimpleName());
//copy to list
LinkedList<IIOServiceProvider> serviceProviderList = new LinkedList<>();
while (serviceProviders.hasNext()) {
serviceProviderList.add(serviceProviders.next());
}
for (IIOServiceProvider serviceProvider : serviceProviderList) {
info(" - removing: " + serviceProvider.getDescription(Locale.ROOT));
registry.deregisterServiceProvider(serviceProvider);
}
}
}
}