Java Code Examples for javax.imageio.spi.IIORegistry#getServiceProviders()
The following examples show how to use
javax.imageio.spi.IIORegistry#getServiceProviders() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: OutputImageTests.java From openjdk-8-source with GNU General Public License v2.0 | 5 votes |
private static void initIIOWriteFormats() { List spis = new ArrayList(); List shortNames = new ArrayList(); ImageIO.scanForPlugins(); IIORegistry registry = IIORegistry.getDefaultInstance(); java.util.Iterator writerspis = registry.getServiceProviders(ImageWriterSpi.class, false); while (writerspis.hasNext()) { // REMIND: there could be more than one non-core plugin for // a particular format, as is the case for JPEG2000 in the JAI // IIO Tools package, so we should support that somehow ImageWriterSpi spi = (ImageWriterSpi)writerspis.next(); String klass = spi.getClass().getName(); String format = spi.getFormatNames()[0].toLowerCase(); String suffix = spi.getFileSuffixes()[0].toLowerCase(); if (suffix == null || suffix.equals("")) { suffix = format; } String shortName; if (klass.startsWith("com.sun.imageio.plugins")) { shortName = "core-" + suffix; } else { shortName = "ext-" + suffix; } spis.add(spi); shortNames.add(shortName); } imageioWriterSpis = new ImageWriterSpi[spis.size()]; imageioWriterSpis = (ImageWriterSpi[])spis.toArray(imageioWriterSpis); imageioWriteFormatShortNames = new String[shortNames.size()]; imageioWriteFormatShortNames = (String[])shortNames.toArray(imageioWriteFormatShortNames); }
Example 2
Source File: InputImageTests.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
private static void initIIOReadFormats() { List spis = new ArrayList(); List shortNames = new ArrayList(); ImageIO.scanForPlugins(); IIORegistry registry = IIORegistry.getDefaultInstance(); java.util.Iterator readerspis = registry.getServiceProviders(ImageReaderSpi.class, false); while (readerspis.hasNext()) { // REMIND: there could be more than one non-core plugin for // a particular format, as is the case for JPEG2000 in the JAI // IIO Tools package, so we should support that somehow ImageReaderSpi spi = (ImageReaderSpi)readerspis.next(); String klass = spi.getClass().getName(); String format = spi.getFormatNames()[0].toLowerCase(); String suffix = spi.getFileSuffixes()[0].toLowerCase(); if (suffix == null || suffix.equals("")) { suffix = format; } String shortName; if (klass.startsWith("com.sun.imageio.plugins")) { shortName = "core-" + suffix; } else { shortName = "ext-" + suffix; } spis.add(spi); shortNames.add(shortName); } imageioReaderSpis = new ImageReaderSpi[spis.size()]; imageioReaderSpis = (ImageReaderSpi[])spis.toArray(imageioReaderSpis); imageioReadFormatShortNames = new String[shortNames.size()]; imageioReadFormatShortNames = (String[])shortNames.toArray(imageioReadFormatShortNames); }
Example 3
Source File: CanWriteSequence.java From jdk8u60 with GNU General Public License v2.0 | 5 votes |
public static void main(final String[] args) throws Exception { final IIORegistry registry = IIORegistry.getDefaultInstance(); final Iterator<ImageWriterSpi> iter = registry.getServiceProviders(ImageWriterSpi.class, provider -> true, true); // Validates all supported ImageWriters while (iter.hasNext()) { final ImageWriter writer = iter.next().createWriterInstance(); System.out.println("ImageWriter = " + writer); test(writer); } System.out.println("Test passed"); }
Example 4
Source File: RegisterPluginTwiceTest.java From jdk8u_jdk with GNU General Public License v2.0 | 5 votes |
public RegisterPluginTwiceTest() throws Exception { BMPImageReaderSPI BMPSpi = new BMPImageReaderSPI(); BMPImageReaderSPI BMPSpi1 = new BMPImageReaderSPI(); IIORegistry regis = IIORegistry.getDefaultInstance(); boolean res1 = regis.registerServiceProvider(BMPSpi, javax.imageio.spi.ImageReaderSpi.class); boolean res2 = regis.registerServiceProvider(BMPSpi1, javax.imageio.spi.ImageReaderSpi.class); if(!res1 || res2) { throw new RuntimeException("Bad returned values for registerServiceProvider"); } Iterator it = regis.getServiceProviders(Class.forName("javax.imageio.spi.ImageReaderSpi"), true); int count = 0; while (it.hasNext()) { Object o = it.next(); if(o instanceof BMPImageReaderSPI) { count++; System.out.println("Found next BMPImageReaderSPI, count = " +count); } } if(count > 1) { throw new RuntimeException("Too many instances of the BMPImageReaderSPI was registered!"); } }
Example 5
Source File: RegisterPluginTwiceTest.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
public RegisterPluginTwiceTest() throws Exception { BMPImageReaderSPI BMPSpi = new BMPImageReaderSPI(); BMPImageReaderSPI BMPSpi1 = new BMPImageReaderSPI(); IIORegistry regis = IIORegistry.getDefaultInstance(); boolean res1 = regis.registerServiceProvider(BMPSpi, javax.imageio.spi.ImageReaderSpi.class); boolean res2 = regis.registerServiceProvider(BMPSpi1, javax.imageio.spi.ImageReaderSpi.class); if(!res1 || res2) { throw new RuntimeException("Bad returned values for registerServiceProvider"); } Iterator it = regis.getServiceProviders(Class.forName("javax.imageio.spi.ImageReaderSpi"), true); int count = 0; while (it.hasNext()) { Object o = it.next(); if(o instanceof BMPImageReaderSPI) { count++; System.out.println("Found next BMPImageReaderSPI, count = " +count); } } if(count > 1) { throw new RuntimeException("Too many instances of the BMPImageReaderSPI was registered!"); } }
Example 6
Source File: InputImageTests.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 5 votes |
private static void initIIOReadFormats() { List spis = new ArrayList(); List shortNames = new ArrayList(); ImageIO.scanForPlugins(); IIORegistry registry = IIORegistry.getDefaultInstance(); java.util.Iterator readerspis = registry.getServiceProviders(ImageReaderSpi.class, false); while (readerspis.hasNext()) { // REMIND: there could be more than one non-core plugin for // a particular format, as is the case for JPEG2000 in the JAI // IIO Tools package, so we should support that somehow ImageReaderSpi spi = (ImageReaderSpi)readerspis.next(); String klass = spi.getClass().getName(); String format = spi.getFormatNames()[0].toLowerCase(); String suffix = spi.getFileSuffixes()[0].toLowerCase(); if (suffix == null || suffix.equals("")) { suffix = format; } String shortName; if (klass.startsWith("com.sun.imageio.plugins")) { shortName = "core-" + suffix; } else { shortName = "ext-" + suffix; } spis.add(spi); shortNames.add(shortName); } imageioReaderSpis = new ImageReaderSpi[spis.size()]; imageioReaderSpis = (ImageReaderSpi[])spis.toArray(imageioReaderSpis); imageioReadFormatShortNames = new String[shortNames.size()]; imageioReadFormatShortNames = (String[])shortNames.toArray(imageioReadFormatShortNames); }
Example 7
Source File: OutputImageTests.java From jdk8u-dev-jdk with GNU General Public License v2.0 | 5 votes |
private static void initIIOWriteFormats() { List spis = new ArrayList(); List shortNames = new ArrayList(); ImageIO.scanForPlugins(); IIORegistry registry = IIORegistry.getDefaultInstance(); java.util.Iterator writerspis = registry.getServiceProviders(ImageWriterSpi.class, false); while (writerspis.hasNext()) { // REMIND: there could be more than one non-core plugin for // a particular format, as is the case for JPEG2000 in the JAI // IIO Tools package, so we should support that somehow ImageWriterSpi spi = (ImageWriterSpi)writerspis.next(); String klass = spi.getClass().getName(); String format = spi.getFormatNames()[0].toLowerCase(); String suffix = spi.getFileSuffixes()[0].toLowerCase(); if (suffix == null || suffix.equals("")) { suffix = format; } String shortName; if (klass.startsWith("com.sun.imageio.plugins")) { shortName = "core-" + suffix; } else { shortName = "ext-" + suffix; } spis.add(spi); shortNames.add(shortName); } imageioWriterSpis = new ImageWriterSpi[spis.size()]; imageioWriterSpis = (ImageWriterSpi[])spis.toArray(imageioWriterSpis); imageioWriteFormatShortNames = new String[shortNames.size()]; imageioWriteFormatShortNames = (String[])shortNames.toArray(imageioWriteFormatShortNames); }
Example 8
Source File: WriteAfterAbort.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
public static void main(final String[] args) throws IOException { final IIORegistry registry = IIORegistry.getDefaultInstance(); final Iterator<ImageWriterSpi> iter = registry.getServiceProviders( ImageWriterSpi.class, provider -> true, true); // Validates all supported ImageWriters while (iter.hasNext()) { final WriteAfterAbort writeAfterAbort = new WriteAfterAbort(); final ImageWriter writer = iter.next().createWriterInstance(); System.out.println("ImageWriter = " + writer); writeAfterAbort.test(writer); } System.out.println("Test passed"); }
Example 9
Source File: WriteAfterAbort.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
public static void main(final String[] args) throws IOException { final IIORegistry registry = IIORegistry.getDefaultInstance(); final Iterator<ImageWriterSpi> iter = registry.getServiceProviders( ImageWriterSpi.class, provider -> true, true); // Validates all supported ImageWriters while (iter.hasNext()) { final WriteAfterAbort writeAfterAbort = new WriteAfterAbort(); final ImageWriter writer = iter.next().createWriterInstance(); System.out.println("ImageWriter = " + writer); writeAfterAbort.test(writer); } System.out.println("Test passed"); }
Example 10
Source File: InputImageTests.java From openjdk-8-source with GNU General Public License v2.0 | 5 votes |
private static void initIIOReadFormats() { List spis = new ArrayList(); List shortNames = new ArrayList(); ImageIO.scanForPlugins(); IIORegistry registry = IIORegistry.getDefaultInstance(); java.util.Iterator readerspis = registry.getServiceProviders(ImageReaderSpi.class, false); while (readerspis.hasNext()) { // REMIND: there could be more than one non-core plugin for // a particular format, as is the case for JPEG2000 in the JAI // IIO Tools package, so we should support that somehow ImageReaderSpi spi = (ImageReaderSpi)readerspis.next(); String klass = spi.getClass().getName(); String format = spi.getFormatNames()[0].toLowerCase(); String suffix = spi.getFileSuffixes()[0].toLowerCase(); if (suffix == null || suffix.equals("")) { suffix = format; } String shortName; if (klass.startsWith("com.sun.imageio.plugins")) { shortName = "core-" + suffix; } else { shortName = "ext-" + suffix; } spis.add(spi); shortNames.add(shortName); } imageioReaderSpis = new ImageReaderSpi[spis.size()]; imageioReaderSpis = (ImageReaderSpi[])spis.toArray(imageioReaderSpis); imageioReadFormatShortNames = new String[shortNames.size()]; imageioReadFormatShortNames = (String[])shortNames.toArray(imageioReadFormatShortNames); }
Example 11
Source File: InputImageTests.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
private static void initIIOReadFormats() { List spis = new ArrayList(); List shortNames = new ArrayList(); ImageIO.scanForPlugins(); IIORegistry registry = IIORegistry.getDefaultInstance(); java.util.Iterator readerspis = registry.getServiceProviders(ImageReaderSpi.class, false); while (readerspis.hasNext()) { // REMIND: there could be more than one non-core plugin for // a particular format, as is the case for JPEG2000 in the JAI // IIO Tools package, so we should support that somehow ImageReaderSpi spi = (ImageReaderSpi)readerspis.next(); String klass = spi.getClass().getName(); String format = spi.getFormatNames()[0].toLowerCase(); String suffix = spi.getFileSuffixes()[0].toLowerCase(); if (suffix == null || suffix.equals("")) { suffix = format; } String shortName; if (klass.startsWith("com.sun.imageio.plugins")) { shortName = "core-" + suffix; } else { shortName = "ext-" + suffix; } spis.add(spi); shortNames.add(shortName); } imageioReaderSpis = new ImageReaderSpi[spis.size()]; imageioReaderSpis = (ImageReaderSpi[])spis.toArray(imageioReaderSpis); imageioReadFormatShortNames = new String[shortNames.size()]; imageioReadFormatShortNames = (String[])shortNames.toArray(imageioReadFormatShortNames); }
Example 12
Source File: CanWriteSequence.java From hottub with GNU General Public License v2.0 | 5 votes |
public static void main(final String[] args) throws Exception { final IIORegistry registry = IIORegistry.getDefaultInstance(); final Iterator<ImageWriterSpi> iter = registry.getServiceProviders(ImageWriterSpi.class, provider -> true, true); // Validates all supported ImageWriters while (iter.hasNext()) { final ImageWriter writer = iter.next().createWriterInstance(); System.out.println("ImageWriter = " + writer); test(writer); } System.out.println("Test passed"); }
Example 13
Source File: WriteAfterAbort.java From dragonwell8_jdk with GNU General Public License v2.0 | 5 votes |
public static void main(final String[] args) throws IOException { final IIORegistry registry = IIORegistry.getDefaultInstance(); final Iterator<ImageWriterSpi> iter = registry.getServiceProviders( ImageWriterSpi.class, provider -> true, true); // Validates all supported ImageWriters while (iter.hasNext()) { final WriteAfterAbort writeAfterAbort = new WriteAfterAbort(); final ImageWriter writer = iter.next().createWriterInstance(); System.out.println("ImageWriter = " + writer); writeAfterAbort.test(writer); } System.out.println("Test passed"); }
Example 14
Source File: InputImageTests.java From jdk8u_jdk with GNU General Public License v2.0 | 5 votes |
private static void initIIOReadFormats() { List spis = new ArrayList(); List shortNames = new ArrayList(); ImageIO.scanForPlugins(); IIORegistry registry = IIORegistry.getDefaultInstance(); java.util.Iterator readerspis = registry.getServiceProviders(ImageReaderSpi.class, false); while (readerspis.hasNext()) { // REMIND: there could be more than one non-core plugin for // a particular format, as is the case for JPEG2000 in the JAI // IIO Tools package, so we should support that somehow ImageReaderSpi spi = (ImageReaderSpi)readerspis.next(); String klass = spi.getClass().getName(); String format = spi.getFormatNames()[0].toLowerCase(); String suffix = spi.getFileSuffixes()[0].toLowerCase(); if (suffix == null || suffix.equals("")) { suffix = format; } String shortName; if (klass.startsWith("com.sun.imageio.plugins")) { shortName = "core-" + suffix; } else { shortName = "ext-" + suffix; } spis.add(spi); shortNames.add(shortName); } imageioReaderSpis = new ImageReaderSpi[spis.size()]; imageioReaderSpis = (ImageReaderSpi[])spis.toArray(imageioReaderSpis); imageioReadFormatShortNames = new String[shortNames.size()]; imageioReadFormatShortNames = (String[])shortNames.toArray(imageioReadFormatShortNames); }
Example 15
Source File: OutputImageTests.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
private static void initIIOWriteFormats() { List spis = new ArrayList(); List shortNames = new ArrayList(); ImageIO.scanForPlugins(); IIORegistry registry = IIORegistry.getDefaultInstance(); java.util.Iterator writerspis = registry.getServiceProviders(ImageWriterSpi.class, false); while (writerspis.hasNext()) { // REMIND: there could be more than one non-core plugin for // a particular format, as is the case for JPEG2000 in the JAI // IIO Tools package, so we should support that somehow ImageWriterSpi spi = (ImageWriterSpi)writerspis.next(); String klass = spi.getClass().getName(); String format = spi.getFormatNames()[0].toLowerCase(); String suffix = spi.getFileSuffixes()[0].toLowerCase(); if (suffix == null || suffix.equals("")) { suffix = format; } String shortName; if (klass.startsWith("com.sun.imageio.plugins")) { shortName = "core-" + suffix; } else { shortName = "ext-" + suffix; } spis.add(spi); shortNames.add(shortName); } imageioWriterSpis = new ImageWriterSpi[spis.size()]; imageioWriterSpis = (ImageWriterSpi[])spis.toArray(imageioWriterSpis); imageioWriteFormatShortNames = new String[shortNames.size()]; imageioWriteFormatShortNames = (String[])shortNames.toArray(imageioWriteFormatShortNames); }
Example 16
Source File: RegisteredFormatsTest.java From openjdk-8 with GNU General Public License v2.0 | 4 votes |
public static void main(String[] args) { fmts = new Hashtable(); fmts.put("javax_imageio_jpeg_stream_1.0", Boolean.FALSE); fmts.put("javax_imageio_jpeg_image_1.0", Boolean.FALSE); fmts.put("javax_imageio_png_1.0", Boolean.FALSE); fmts.put("javax_imageio_bmp_1.0", Boolean.FALSE); fmts.put("javax_imageio_wbmp_1.0", Boolean.FALSE); fmts.put("javax_imageio_gif_stream_1.0", Boolean.FALSE); fmts.put("javax_imageio_gif_image_1.0", Boolean.FALSE); IIORegistry registry = IIORegistry.getDefaultInstance(); Iterator iter = registry.getServiceProviders(ImageReaderSpi.class, false); while(iter.hasNext()) { ImageReaderSpi spi = (ImageReaderSpi)iter.next(); String fmt_name; fmt_name = spi.getNativeStreamMetadataFormatName(); testStreamMetadataFormat(spi, fmt_name); fmt_name = spi.getNativeImageMetadataFormatName(); testImageMetadataFormat(spi, fmt_name); String[] fmt_names; fmt_names = spi.getExtraStreamMetadataFormatNames(); for (int i=0; fmt_names != null && i < fmt_names.length; i++) { testStreamMetadataFormat(spi, fmt_names[i]); } fmt_names = spi.getExtraImageMetadataFormatNames(); for (int i=0; fmt_names != null && i < fmt_names.length; i++) { testImageMetadataFormat(spi, fmt_names[i]); } } Enumeration keys = fmts.keys(); while (keys.hasMoreElements()) { String key = (String)keys.nextElement(); boolean val = ((Boolean)fmts.get(key)).booleanValue(); if (!val) { throw new RuntimeException("Test failed: format " + key + "is not registered."); } } }
Example 17
Source File: RegisteredFormatsTest.java From jdk8u_jdk with GNU General Public License v2.0 | 4 votes |
public static void main(String[] args) { fmts = new Hashtable(); fmts.put("javax_imageio_jpeg_stream_1.0", Boolean.FALSE); fmts.put("javax_imageio_jpeg_image_1.0", Boolean.FALSE); fmts.put("javax_imageio_png_1.0", Boolean.FALSE); fmts.put("javax_imageio_bmp_1.0", Boolean.FALSE); fmts.put("javax_imageio_wbmp_1.0", Boolean.FALSE); fmts.put("javax_imageio_gif_stream_1.0", Boolean.FALSE); fmts.put("javax_imageio_gif_image_1.0", Boolean.FALSE); IIORegistry registry = IIORegistry.getDefaultInstance(); Iterator iter = registry.getServiceProviders(ImageReaderSpi.class, false); while(iter.hasNext()) { ImageReaderSpi spi = (ImageReaderSpi)iter.next(); String fmt_name; fmt_name = spi.getNativeStreamMetadataFormatName(); testStreamMetadataFormat(spi, fmt_name); fmt_name = spi.getNativeImageMetadataFormatName(); testImageMetadataFormat(spi, fmt_name); String[] fmt_names; fmt_names = spi.getExtraStreamMetadataFormatNames(); for (int i=0; fmt_names != null && i < fmt_names.length; i++) { testStreamMetadataFormat(spi, fmt_names[i]); } fmt_names = spi.getExtraImageMetadataFormatNames(); for (int i=0; fmt_names != null && i < fmt_names.length; i++) { testImageMetadataFormat(spi, fmt_names[i]); } } Enumeration keys = fmts.keys(); while (keys.hasMoreElements()) { String key = (String)keys.nextElement(); boolean val = ((Boolean)fmts.get(key)).booleanValue(); if (!val) { throw new RuntimeException("Test failed: format " + key + "is not registered."); } } }
Example 18
Source File: MetadataFormatPrinter.java From jdk8u-dev-jdk with GNU General Public License v2.0 | 4 votes |
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); }
Example 19
Source File: MetadataFormatPrinter.java From openjdk-jdk8u with GNU General Public License v2.0 | 4 votes |
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); }
Example 20
Source File: MetadataFormatPrinter.java From openjdk-jdk9 with GNU General Public License v2.0 | 4 votes |
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); }