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


Java ImageIO.getReaderFormatNames方法代码示例

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


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

示例1: findImageFiles

import javax.imageio.ImageIO; //导入方法依赖的package包/类
private String[] findImageFiles (File root) {
    String[] formats = ImageIO.getReaderFormatNames();
    Set set = new HashSet();
    findImageFiles (root, set);
    String[] result = new String[set.size()];
    result = (String[]) set.toArray(result);
    return result;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:9,代码来源:CacheWriter.java

示例2: FormatFilenameFilter

import javax.imageio.ImageIO; //导入方法依赖的package包/类
public FormatFilenameFilter () {
    formats = ImageIO.getReaderFormatNames();
    String[] s = new String[formats.length + 2];
    System.arraycopy (formats, 0, s, 2, formats.length);
    s[0] = "GIF";
    s[1] = "gif";
    formats = s;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:9,代码来源:CacheWriter.java

示例3: isImage

import javax.imageio.ImageIO; //导入方法依赖的package包/类
public static boolean isImage(String fileName) {
  final String[] readerFormatNames = ImageIO.getReaderFormatNames();
  for (@NonNls String format : readerFormatNames) {
    final String ext = format.toLowerCase();
    if (fileName.endsWith(ext)) {
      return true;
    }
  }
  return false;
}
 
开发者ID:medvector,项目名称:educational-plugin,代码行数:11,代码来源:EduUtils.java

示例4: DeregisterAllSpiTest

import javax.imageio.ImageIO; //导入方法依赖的package包/类
public DeregisterAllSpiTest() throws Exception {
    ImageReaderSpi BMPSpi = new BMPImageReaderSPI();
    IIORegistry.getDefaultInstance().registerServiceProvider(BMPSpi);

    System.out.println("Reader Format Names available in the registry");
    String formatNames[] = ImageIO.getReaderFormatNames();
    if( formatNames == null || formatNames.length <= 0) {
        throw new RuntimeException("No registered ImageReaders!");
    }
    for (int x=0; x < formatNames.length; x++) {
        System.out.println("format "+formatNames[x]);
    }

    IIORegistry.getDefaultInstance().deregisterAll();

    System.out.println("\nReader Format Names after deregistering all SPIs");
    formatNames = ImageIO.getReaderFormatNames();
    if(formatNames.length == 0) {
        System.out.println("No readers available\n");
    } else {
        throw new RuntimeException("Some providers was not deregistered!");
    }

    IIORegistry.getDefaultInstance().registerServiceProvider(BMPSpi);
    System.out.println("Reader Format Names after re-register of BMP Plugin");
    formatNames = ImageIO.getReaderFormatNames();
    if(formatNames.length == 0) {
        throw new RuntimeException("Unable to register new SPI after deregisterAll()!");
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:31,代码来源:DeregisterAllSpiTest.java

示例5: main

import javax.imageio.ImageIO; //导入方法依赖的package包/类
public static void main(String[] args) {
    SecurityManager sm = System.getSecurityManager();
    System.out.println("Sm is " + sm);

    String formatNames[] = ImageIO.getReaderFormatNames();
    String readerMimeTypes[] = ImageIO.getReaderMIMETypes();

    if (!isPresent(dummyformatNames, formatNames) ||
        !isPresent(dummymimeType, readerMimeTypes)) {
        throw new RuntimeException("No test plugin available!");
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:13,代码来源:IIOPluginTest.java

示例6: testGetReaderFormatNames

import javax.imageio.ImageIO; //导入方法依赖的package包/类
private static void testGetReaderFormatNames() {
    String[] names = ImageIO.getReaderFormatNames();
    for (String n : names) {
        Iterator<ImageReader> it = ImageIO.getImageReadersByFormatName(n);
        if (!it.hasNext()) {
            throw new RuntimeException("getReaderFormatNames returned " +
                                       "an unknown name: " + n);
        }
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:11,代码来源:GetReaderWriterInfo.java

示例7: accept

import javax.imageio.ImageIO; //导入方法依赖的package包/类
public boolean accept(File pathname) {
	if (pathname.isDirectory()) return true;
	for (String imageType : ImageIO.getReaderFormatNames() ) {
		if (pathname.getName().endsWith(imageType))
			return true;
	}
	return false;
}
 
开发者ID:iedadata,项目名称:geomapapp,代码行数:9,代码来源:ImportImage.java


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