本文整理汇总了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;
}
示例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;
}
示例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;
}
示例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()!");
}
}
示例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!");
}
}
示例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);
}
}
}
示例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;
}