本文整理汇总了Java中javax.imageio.spi.ImageReaderSpi.getStreamMetadataFormat方法的典型用法代码示例。如果您正苦于以下问题:Java ImageReaderSpi.getStreamMetadataFormat方法的具体用法?Java ImageReaderSpi.getStreamMetadataFormat怎么用?Java ImageReaderSpi.getStreamMetadataFormat使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.imageio.spi.ImageReaderSpi
的用法示例。
在下文中一共展示了ImageReaderSpi.getStreamMetadataFormat方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: main
import javax.imageio.spi.ImageReaderSpi; //导入方法依赖的package包/类
public static void main(String[] args) {
IIOMetadataFormat format = null;
if (args.length == 0 || args[0].equals("javax_imageio_1.0")) {
format = IIOMetadataFormatImpl.getStandardFormatInstance();
} else {
IIORegistry registry = IIORegistry.getDefaultInstance();
Iterator iter = registry.getServiceProviders(ImageReaderSpi.class,
false);
while (iter.hasNext()) {
ImageReaderSpi spi = (ImageReaderSpi)iter.next();
if (args[0].equals
(spi.getNativeStreamMetadataFormatName())) {
System.out.print(spi.getDescription(null));
System.out.println(": native stream format");
format = spi.getStreamMetadataFormat(args[0]);
break;
}
String[] extraStreamFormatNames =
spi.getExtraStreamMetadataFormatNames();
if (extraStreamFormatNames != null &&
Arrays.asList(extraStreamFormatNames).
contains(args[0])) {
System.out.print(spi.getDescription(null));
System.out.println(": extra stream format");
format = spi.getStreamMetadataFormat(args[0]);
break;
}
if (args[0].equals
(spi.getNativeImageMetadataFormatName())) {
System.out.print(spi.getDescription(null));
System.out.println(": native image format");
format = spi.getImageMetadataFormat(args[0]);
break;
}
String[] extraImageFormatNames =
spi.getExtraImageMetadataFormatNames();
if (extraImageFormatNames != null &&
Arrays.asList(extraImageFormatNames).contains(args[0])) {
System.out.print(spi.getDescription(null));
System.out.println(": extra image format");
format = spi.getImageMetadataFormat(args[0]);
break;
}
}
}
if (format == null) {
System.err.println("Unknown format: " + args[0]);
System.exit(0);
}
MetadataFormatPrinter printer = new MetadataFormatPrinter(System.out);
printer.print(format);
}