当前位置: 首页>>代码示例>>Java>>正文


Java ServiceRegistry.Filter方法代码示例

本文整理汇总了Java中javax.imageio.spi.ServiceRegistry.Filter方法的典型用法代码示例。如果您正苦于以下问题:Java ServiceRegistry.Filter方法的具体用法?Java ServiceRegistry.Filter怎么用?Java ServiceRegistry.Filter使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在javax.imageio.spi.ServiceRegistry的用法示例。


在下文中一共展示了ServiceRegistry.Filter方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getImageTranscoders

import javax.imageio.spi.ServiceRegistry; //导入方法依赖的package包/类
/**
 * Returns an <code>Iterator</code> containing all currently
 * registered <code>ImageTranscoder</code>s that claim to be
 * able to transcode between the metadata of the given
 * <code>ImageReader</code> and <code>ImageWriter</code>.
 *
 * @param reader an <code>ImageReader</code>.
 * @param writer an <code>ImageWriter</code>.
 *
 * @return an <code>Iterator</code> containing
 * <code>ImageTranscoder</code>s.
 *
 * @exception IllegalArgumentException if <code>reader</code> or
 * <code>writer</code> is <code>null</code>.
 */
public static Iterator<ImageTranscoder>
    getImageTranscoders(ImageReader reader, ImageWriter writer)
{
    if (reader == null) {
        throw new IllegalArgumentException("reader == null!");
    }
    if (writer == null) {
        throw new IllegalArgumentException("writer == null!");
    }
    ImageReaderSpi readerSpi = reader.getOriginatingProvider();
    ImageWriterSpi writerSpi = writer.getOriginatingProvider();
    ServiceRegistry.Filter filter =
        new TranscoderFilter(readerSpi, writerSpi);

    Iterator iter;
    // Ensure category is present
    try {
        iter = theRegistry.getServiceProviders(ImageTranscoderSpi.class,
                                        filter, true);
    } catch (IllegalArgumentException e) {
        return Collections.emptyIterator();
    }
    return new ImageTranscoderIterator(iter);
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:40,代码来源:ImageIO.java

示例2: getImageTranscoders

import javax.imageio.spi.ServiceRegistry; //导入方法依赖的package包/类
/**
 * Returns an {@code Iterator} containing all currently
 * registered {@code ImageTranscoder}s that claim to be
 * able to transcode between the metadata of the given
 * {@code ImageReader} and {@code ImageWriter}.
 *
 * @param reader an {@code ImageReader}.
 * @param writer an {@code ImageWriter}.
 *
 * @return an {@code Iterator} containing
 * {@code ImageTranscoder}s.
 *
 * @exception IllegalArgumentException if {@code reader} or
 * {@code writer} is {@code null}.
 */
public static Iterator<ImageTranscoder>
    getImageTranscoders(ImageReader reader, ImageWriter writer)
{
    if (reader == null) {
        throw new IllegalArgumentException("reader == null!");
    }
    if (writer == null) {
        throw new IllegalArgumentException("writer == null!");
    }
    ImageReaderSpi readerSpi = reader.getOriginatingProvider();
    ImageWriterSpi writerSpi = writer.getOriginatingProvider();
    ServiceRegistry.Filter filter =
        new TranscoderFilter(readerSpi, writerSpi);

    Iterator<ImageTranscoderSpi> iter;
    // Ensure category is present
    try {
        iter = theRegistry.getServiceProviders(ImageTranscoderSpi.class,
                                        filter, true);
    } catch (IllegalArgumentException e) {
        return Collections.emptyIterator();
    }
    return new ImageTranscoderIterator(iter);
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:40,代码来源:ImageIO.java

示例3: getImageTranscoders

import javax.imageio.spi.ServiceRegistry; //导入方法依赖的package包/类
/**
 * Returns an <code>Iterator</code> containing all currently registered <code>ImageTranscoder</code>s that
 * claim to be able to transcode between the metadata of the given <code>ImageReader</code> and
 * <code>ImageWriter</code>.
 * 
 * @param reader
 *            an <code>ImageReader</code>.
 * @param writer
 *            an <code>ImageWriter</code>.
 * 
 * @return an <code>Iterator</code> containing <code>ImageTranscoder</code>s.
 * 
 * @exception IllegalArgumentException
 *                if <code>reader</code> or <code>writer</code> is <code>null</code>.
 */
public static Iterator<ImageTranscoder> getImageTranscoders(ImageReader reader, ImageWriter writer) {
	if (reader == null) {
		throw new IllegalArgumentException("reader == null!");
	}
	if (writer == null) {
		throw new IllegalArgumentException("writer == null!");
	}
	ImageReaderSpi readerSpi = reader.getOriginatingProvider();
	ImageWriterSpi writerSpi = writer.getOriginatingProvider();
	ServiceRegistry.Filter filter = new TranscoderFilter(readerSpi, writerSpi);

	Iterator iter;
	// Ensure category is present
	try {
		iter = theRegistry.getServiceProviders(ImageTranscoderSpi.class, filter, true);
	} catch (IllegalArgumentException e) {
		return new HashSet().iterator();
	}
	return new ImageTranscoderIterator(iter);
}
 
开发者ID:MKLab-ITI,项目名称:multimedia-indexing,代码行数:36,代码来源:ImageIOGreyScale.java

示例4: clearImageIORegistry

import javax.imageio.spi.ServiceRegistry; //导入方法依赖的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);
            }
        }
    }
}
 
开发者ID:MyCoRe-Org,项目名称:mycore,代码行数:28,代码来源:MCRClassLoaderLeakPreventor.java

示例5: getReadersByFilter

import javax.imageio.spi.ServiceRegistry; //导入方法依赖的package包/类
private static Iterator<ImageReader> getReadersByFilter(Class<ImageReaderSpi> type,
                                                        ServiceRegistry.Filter filter,
                                                        Object readerExtension)
{
  try
    {
      Iterator<ImageReaderSpi> it
        = getRegistry().getServiceProviders(type, filter, true);
      return new ImageReaderIterator(it, readerExtension);
    }
  catch (IllegalArgumentException e)
    {
      return Collections.EMPTY_SET.iterator();
    }
}
 
开发者ID:vilie,项目名称:javify,代码行数:16,代码来源:ImageIO.java

示例6: getWritersByFilter

import javax.imageio.spi.ServiceRegistry; //导入方法依赖的package包/类
private static Iterator<ImageWriter> getWritersByFilter(Class<ImageWriterSpi> type,
                                                        ServiceRegistry.Filter filter,
                                                        Object writerExtension)
{
  try
    {
      Iterator<ImageWriterSpi> it
        = getRegistry().getServiceProviders(type, filter, true);
      return new ImageWriterIterator(it, writerExtension);
    }
  catch (IllegalArgumentException e)
    {
      return Collections.EMPTY_SET.iterator();
    }
}
 
开发者ID:vilie,项目名称:javify,代码行数:16,代码来源:ImageIO.java


注:本文中的javax.imageio.spi.ServiceRegistry.Filter方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。