本文整理匯總了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;
}