當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。