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


Java ImageWriterSpi.getFormatNames方法代码示例

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


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

示例1: filter

import javax.imageio.spi.ImageWriterSpi; //导入方法依赖的package包/类
public boolean filter(Object provider)
{
  if (provider instanceof ImageWriterSpi)
    {
      ImageWriterSpi spi = (ImageWriterSpi) provider;

      if (spi.canEncodeImage(type))
        {
          String[] formatNames = spi.getFormatNames();
          for (int i = formatNames.length - 1; i >= 0; --i)
            if (formatName.equals(formatNames[i]))
              return true;
        }
    }

  return false;
}
 
开发者ID:vilie,项目名称:javify,代码行数:18,代码来源:ImageIO.java

示例2: getWriterFormatNames

import javax.imageio.spi.ImageWriterSpi; //导入方法依赖的package包/类
/**
 * Retrieve all the informal format names supported by the
 * collection of registered image writers.
 *
 * @return an array of format names
 */
public static String[] getWriterFormatNames()
{
  try
    {
      Iterator it =
        getRegistry().getServiceProviders(ImageWriterSpi.class, true);
      ArrayList result = new ArrayList();

      while (it.hasNext())
        {
          ImageWriterSpi spi = (ImageWriterSpi) it.next();
          String[] names = spi.getFormatNames();

          for (int i = names.length - 1; i >= 0; --i)
            result.add(names[i]);
        }

      return (String[]) result.toArray(new String[result.size()]);
    }
  catch (IllegalArgumentException e)
    {
      return new String[0];
    }
}
 
开发者ID:vilie,项目名称:javify,代码行数:31,代码来源:ImageIO.java

示例3: onRegistration

import javax.imageio.spi.ImageWriterSpi; //导入方法依赖的package包/类
@Override
public void onRegistration(ServiceRegistry registry, Class< ? > category) {
    Iterator< ImageWriterSpi > others = registry.getServiceProviders(ImageWriterSpi.class, false);
    while (others.hasNext()) {
        ImageWriterSpi other = others.next();
        if (other != this) {
            for (String formatName : other.getFormatNames()) {
                if ("png".equals(formatName)) {
                    registry.setOrdering(ImageWriterSpi.class, this, other);
                    break;
                }
            }
        }
    }
}
 
开发者ID:gredler,项目名称:jdk9-png-writer-backport,代码行数:16,代码来源:PNGImageWriterSpiBackport.java


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