javax.imageio.spi.ImageReaderSpi Java Examples
The following examples show how to use
javax.imageio.spi.ImageReaderSpi.
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: CanDecodeTest.java From TencentKona-8 with GNU General Public License v2.0 | 6 votes |
public void doTest(ImageReaderSpi spi) throws IOException { System.out.println("Test for " + title + (canDecode ? " (can decode)" : " (can't decode)")); System.out.print("As a stream..."); ImageInputStream iis = ImageIO.createImageInputStream(getDataStream()); if (spi.canDecodeInput(iis) != canDecode) { throw new RuntimeException("Test failed: wrong decideion " + "for stream data"); } System.out.println("OK"); System.out.print("As a file..."); iis = ImageIO.createImageInputStream(getDataFile()); if (spi.canDecodeInput(iis) != canDecode) { throw new RuntimeException("Test failed: wrong decideion " + "for file data"); } System.out.println("OK"); }
Example #2
Source File: ImageIO.java From openjdk-8-source with GNU General Public License v2.0 | 6 votes |
getImageReadersByFormatName(String formatName) { if (formatName == null) { throw new IllegalArgumentException("formatName == null!"); } Iterator iter; // Ensure category is present try { iter = theRegistry.getServiceProviders(ImageReaderSpi.class, new ContainsFilter(readerFormatNamesMethod, formatName), true); } catch (IllegalArgumentException e) { return Collections.emptyIterator(); } return new ImageReaderIterator(iter); }
Example #3
Source File: ImageIO.java From TencentKona-8 with GNU General Public License v2.0 | 6 votes |
getImageReadersByFormatName(String formatName) { if (formatName == null) { throw new IllegalArgumentException("formatName == null!"); } Iterator iter; // Ensure category is present try { iter = theRegistry.getServiceProviders(ImageReaderSpi.class, new ContainsFilter(readerFormatNamesMethod, formatName), true); } catch (IllegalArgumentException e) { return Collections.emptyIterator(); } return new ImageReaderIterator(iter); }
Example #4
Source File: ImageIO.java From jdk8u-jdk with GNU General Public License v2.0 | 6 votes |
getImageReadersByFormatName(String formatName) { if (formatName == null) { throw new IllegalArgumentException("formatName == null!"); } Iterator iter; // Ensure category is present try { iter = theRegistry.getServiceProviders(ImageReaderSpi.class, new ContainsFilter(readerFormatNamesMethod, formatName), true); } catch (IllegalArgumentException e) { return Collections.emptyIterator(); } return new ImageReaderIterator(iter); }
Example #5
Source File: CanDecodeTest.java From hottub with GNU General Public License v2.0 | 6 votes |
public void doTest(ImageReaderSpi spi) throws IOException { System.out.println("Test for " + title + (canDecode ? " (can decode)" : " (can't decode)")); System.out.print("As a stream..."); ImageInputStream iis = ImageIO.createImageInputStream(getDataStream()); if (spi.canDecodeInput(iis) != canDecode) { throw new RuntimeException("Test failed: wrong decideion " + "for stream data"); } System.out.println("OK"); System.out.print("As a file..."); iis = ImageIO.createImageInputStream(getDataFile()); if (spi.canDecodeInput(iis) != canDecode) { throw new RuntimeException("Test failed: wrong decideion " + "for file data"); } System.out.println("OK"); }
Example #6
Source File: ImageIO.java From hottub with GNU General Public License v2.0 | 6 votes |
/** * Returns an <code>Iterator</code> containing all currently * registered <code>ImageTranscoder</code>s that claim to be * able to transcode between the metadata of the given * <code>ImageReader</code> and <code>ImageWriter</code>. * * @param reader an <code>ImageReader</code>. * @param writer an <code>ImageWriter</code>. * * @return an <code>Iterator</code> containing * <code>ImageTranscoder</code>s. * * @exception IllegalArgumentException if <code>reader</code> or * <code>writer</code> is <code>null</code>. */ public static Iterator<ImageTranscoder> getImageTranscoders(ImageReader reader, ImageWriter writer) { if (reader == null) { throw new IllegalArgumentException("reader == null!"); } if (writer == null) { throw new IllegalArgumentException("writer == null!"); } ImageReaderSpi readerSpi = reader.getOriginatingProvider(); ImageWriterSpi writerSpi = writer.getOriginatingProvider(); ServiceRegistry.Filter filter = new TranscoderFilter(readerSpi, writerSpi); Iterator iter; // Ensure category is present try { iter = theRegistry.getServiceProviders(ImageTranscoderSpi.class, filter, true); } catch (IllegalArgumentException e) { return Collections.emptyIterator(); } return new ImageTranscoderIterator(iter); }
Example #7
Source File: ImageIO.java From openjdk-jdk9 with GNU General Public License v2.0 | 6 votes |
/** * Returns an {@code Iterator} containing all currently * registered {@code ImageTranscoder}s that claim to be * able to transcode between the metadata of the given * {@code ImageReader} and {@code ImageWriter}. * * @param reader an {@code ImageReader}. * @param writer an {@code ImageWriter}. * * @return an {@code Iterator} containing * {@code ImageTranscoder}s. * * @exception IllegalArgumentException if {@code reader} or * {@code writer} is {@code null}. */ public static Iterator<ImageTranscoder> getImageTranscoders(ImageReader reader, ImageWriter writer) { if (reader == null) { throw new IllegalArgumentException("reader == null!"); } if (writer == null) { throw new IllegalArgumentException("writer == null!"); } ImageReaderSpi readerSpi = reader.getOriginatingProvider(); ImageWriterSpi writerSpi = writer.getOriginatingProvider(); ServiceRegistry.Filter filter = new TranscoderFilter(readerSpi, writerSpi); Iterator<ImageTranscoderSpi> iter; // Ensure category is present try { iter = theRegistry.getServiceProviders(ImageTranscoderSpi.class, filter, true); } catch (IllegalArgumentException e) { return Collections.emptyIterator(); } return new ImageTranscoderIterator(iter); }
Example #8
Source File: ImageIO.java From jdk8u60 with GNU General Public License v2.0 | 6 votes |
/** * Returns an <code>Iterator</code> containing all currently * registered <code>ImageReader</code>s that claim to be able to * decode files with the given suffix. * * @param fileSuffix a <code>String</code> containing a file * suffix (<i>e.g.</i>, "jpg" or "tiff"). * * @return an <code>Iterator</code> containing * <code>ImageReader</code>s. * * @exception IllegalArgumentException if <code>fileSuffix</code> * is <code>null</code>. * * @see javax.imageio.spi.ImageReaderSpi#getFileSuffixes */ public static Iterator<ImageReader> getImageReadersBySuffix(String fileSuffix) { if (fileSuffix == null) { throw new IllegalArgumentException("fileSuffix == null!"); } // Ensure category is present Iterator iter; try { iter = theRegistry.getServiceProviders(ImageReaderSpi.class, new ContainsFilter(readerFileSuffixesMethod, fileSuffix), true); } catch (IllegalArgumentException e) { return Collections.emptyIterator(); } return new ImageReaderIterator(iter); }
Example #9
Source File: ImageIO.java From jdk8u-jdk with GNU General Public License v2.0 | 6 votes |
/** * Returns an <code>Iterator</code> containing all currently * registered <code>ImageTranscoder</code>s that claim to be * able to transcode between the metadata of the given * <code>ImageReader</code> and <code>ImageWriter</code>. * * @param reader an <code>ImageReader</code>. * @param writer an <code>ImageWriter</code>. * * @return an <code>Iterator</code> containing * <code>ImageTranscoder</code>s. * * @exception IllegalArgumentException if <code>reader</code> or * <code>writer</code> is <code>null</code>. */ public static Iterator<ImageTranscoder> getImageTranscoders(ImageReader reader, ImageWriter writer) { if (reader == null) { throw new IllegalArgumentException("reader == null!"); } if (writer == null) { throw new IllegalArgumentException("writer == null!"); } ImageReaderSpi readerSpi = reader.getOriginatingProvider(); ImageWriterSpi writerSpi = writer.getOriginatingProvider(); ServiceRegistry.Filter filter = new TranscoderFilter(readerSpi, writerSpi); Iterator iter; // Ensure category is present try { iter = theRegistry.getServiceProviders(ImageTranscoderSpi.class, filter, true); } catch (IllegalArgumentException e) { return Collections.emptyIterator(); } return new ImageTranscoderIterator(iter); }
Example #10
Source File: ImageIO.java From openjdk-8 with GNU General Public License v2.0 | 6 votes |
/** * Returns an <code>Iterator</code> containing all currently * registered <code>ImageReader</code>s that claim to be able to * decode files with the given MIME type. * * @param MIMEType a <code>String</code> containing a file * suffix (<i>e.g.</i>, "image/jpeg" or "image/x-bmp"). * * @return an <code>Iterator</code> containing * <code>ImageReader</code>s. * * @exception IllegalArgumentException if <code>MIMEType</code> is * <code>null</code>. * * @see javax.imageio.spi.ImageReaderSpi#getMIMETypes */ public static Iterator<ImageReader> getImageReadersByMIMEType(String MIMEType) { if (MIMEType == null) { throw new IllegalArgumentException("MIMEType == null!"); } // Ensure category is present Iterator iter; try { iter = theRegistry.getServiceProviders(ImageReaderSpi.class, new ContainsFilter(readerMIMETypesMethod, MIMEType), true); } catch (IllegalArgumentException e) { return Collections.emptyIterator(); } return new ImageReaderIterator(iter); }
Example #11
Source File: ImageIO.java From jdk1.8-source-analysis with Apache License 2.0 | 6 votes |
getImageReadersByFormatName(String formatName) { if (formatName == null) { throw new IllegalArgumentException("formatName == null!"); } Iterator iter; // Ensure category is present try { iter = theRegistry.getServiceProviders(ImageReaderSpi.class, new ContainsFilter(readerFormatNamesMethod, formatName), true); } catch (IllegalArgumentException e) { return Collections.emptyIterator(); } return new ImageReaderIterator(iter); }
Example #12
Source File: ImageIO.java From jdk8u-jdk with GNU General Public License v2.0 | 6 votes |
/** * Returns an <code>Iterator</code> containing all currently * registered <code>ImageReader</code>s that claim to be able to * decode files with the given suffix. * * @param fileSuffix a <code>String</code> containing a file * suffix (<i>e.g.</i>, "jpg" or "tiff"). * * @return an <code>Iterator</code> containing * <code>ImageReader</code>s. * * @exception IllegalArgumentException if <code>fileSuffix</code> * is <code>null</code>. * * @see javax.imageio.spi.ImageReaderSpi#getFileSuffixes */ public static Iterator<ImageReader> getImageReadersBySuffix(String fileSuffix) { if (fileSuffix == null) { throw new IllegalArgumentException("fileSuffix == null!"); } // Ensure category is present Iterator iter; try { iter = theRegistry.getServiceProviders(ImageReaderSpi.class, new ContainsFilter(readerFileSuffixesMethod, fileSuffix), true); } catch (IllegalArgumentException e) { return Collections.emptyIterator(); } return new ImageReaderIterator(iter); }
Example #13
Source File: ImageIO.java From openjdk-jdk8u with GNU General Public License v2.0 | 6 votes |
/** * Returns an <code>Iterator</code> containing all currently * registered <code>ImageReader</code>s that claim to be able to * decode files with the given suffix. * * @param fileSuffix a <code>String</code> containing a file * suffix (<i>e.g.</i>, "jpg" or "tiff"). * * @return an <code>Iterator</code> containing * <code>ImageReader</code>s. * * @exception IllegalArgumentException if <code>fileSuffix</code> * is <code>null</code>. * * @see javax.imageio.spi.ImageReaderSpi#getFileSuffixes */ public static Iterator<ImageReader> getImageReadersBySuffix(String fileSuffix) { if (fileSuffix == null) { throw new IllegalArgumentException("fileSuffix == null!"); } // Ensure category is present Iterator iter; try { iter = theRegistry.getServiceProviders(ImageReaderSpi.class, new ContainsFilter(readerFileSuffixesMethod, fileSuffix), true); } catch (IllegalArgumentException e) { return Collections.emptyIterator(); } return new ImageReaderIterator(iter); }
Example #14
Source File: ImageIO.java From openjdk-8 with GNU General Public License v2.0 | 6 votes |
/** * Returns an <code>Iterator</code> containing all currently * registered <code>ImageReader</code>s that claim to be able to * decode files with the given suffix. * * @param fileSuffix a <code>String</code> containing a file * suffix (<i>e.g.</i>, "jpg" or "tiff"). * * @return an <code>Iterator</code> containing * <code>ImageReader</code>s. * * @exception IllegalArgumentException if <code>fileSuffix</code> * is <code>null</code>. * * @see javax.imageio.spi.ImageReaderSpi#getFileSuffixes */ public static Iterator<ImageReader> getImageReadersBySuffix(String fileSuffix) { if (fileSuffix == null) { throw new IllegalArgumentException("fileSuffix == null!"); } // Ensure category is present Iterator iter; try { iter = theRegistry.getServiceProviders(ImageReaderSpi.class, new ContainsFilter(readerFileSuffixesMethod, fileSuffix), true); } catch (IllegalArgumentException e) { return Collections.emptyIterator(); } return new ImageReaderIterator(iter); }
Example #15
Source File: ImageIO.java From openjdk-jdk9 with GNU General Public License v2.0 | 6 votes |
/** * Returns an {@code Iterator} containing all currently * registered {@code ImageReader}s that claim to be able to * decode files with the given suffix. * * @param fileSuffix a {@code String} containing a file * suffix (<i>e.g.</i>, "jpg" or "tiff"). * * @return an {@code Iterator} containing * {@code ImageReader}s. * * @exception IllegalArgumentException if {@code fileSuffix} * is {@code null}. * * @see javax.imageio.spi.ImageReaderSpi#getFileSuffixes */ public static Iterator<ImageReader> getImageReadersBySuffix(String fileSuffix) { if (fileSuffix == null) { throw new IllegalArgumentException("fileSuffix == null!"); } // Ensure category is present Iterator<ImageReaderSpi> iter; try { iter = theRegistry.getServiceProviders(ImageReaderSpi.class, new ContainsFilter(readerFileSuffixesMethod, fileSuffix), true); } catch (IllegalArgumentException e) { return Collections.emptyIterator(); } return new ImageReaderIterator(iter); }
Example #16
Source File: ImageIO.java From jdk8u-jdk with GNU General Public License v2.0 | 6 votes |
/** * Returns an <code>Iterator</code> containing all currently * registered <code>ImageReader</code>s that claim to be able to * decode files with the given MIME type. * * @param MIMEType a <code>String</code> containing a file * suffix (<i>e.g.</i>, "image/jpeg" or "image/x-bmp"). * * @return an <code>Iterator</code> containing * <code>ImageReader</code>s. * * @exception IllegalArgumentException if <code>MIMEType</code> is * <code>null</code>. * * @see javax.imageio.spi.ImageReaderSpi#getMIMETypes */ public static Iterator<ImageReader> getImageReadersByMIMEType(String MIMEType) { if (MIMEType == null) { throw new IllegalArgumentException("MIMEType == null!"); } // Ensure category is present Iterator iter; try { iter = theRegistry.getServiceProviders(ImageReaderSpi.class, new ContainsFilter(readerMIMETypesMethod, MIMEType), true); } catch (IllegalArgumentException e) { return Collections.emptyIterator(); } return new ImageReaderIterator(iter); }
Example #17
Source File: ImageIO.java From JDKSourceCode1.8 with MIT License | 6 votes |
/** * Returns an <code>Iterator</code> containing all currently * registered <code>ImageReader</code>s that claim to be able to * decode files with the given MIME type. * * @param MIMEType a <code>String</code> containing a file * suffix (<i>e.g.</i>, "image/jpeg" or "image/x-bmp"). * * @return an <code>Iterator</code> containing * <code>ImageReader</code>s. * * @exception IllegalArgumentException if <code>MIMEType</code> is * <code>null</code>. * * @see javax.imageio.spi.ImageReaderSpi#getMIMETypes */ public static Iterator<ImageReader> getImageReadersByMIMEType(String MIMEType) { if (MIMEType == null) { throw new IllegalArgumentException("MIMEType == null!"); } // Ensure category is present Iterator iter; try { iter = theRegistry.getServiceProviders(ImageReaderSpi.class, new ContainsFilter(readerMIMETypesMethod, MIMEType), true); } catch (IllegalArgumentException e) { return Collections.emptyIterator(); } return new ImageReaderIterator(iter); }
Example #18
Source File: StreamResetTest.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
public static void main(String[] args) { IOException expectedException = null; TestStream iis = new TestStream(); ImageReader wbmp = ImageIO.getImageReadersByFormatName("WBMP").next(); if (wbmp == null) { System.out.println("No WBMP reader: skip the test"); return; } ImageReaderSpi spi = wbmp.getOriginatingProvider(); iis.checkPosition(); try { spi.canDecodeInput(iis); } catch (IOException e) { expectedException = e; } if (expectedException == null) { throw new RuntimeException("Test FAILED: stream was not used"); } iis.checkPosition(); System.out.println("Test PASSED"); }
Example #19
Source File: SpiTest.java From jdk8u_jdk with GNU General Public License v2.0 | 5 votes |
private ImageReaderSpi constructImageReaderSpi() { return new ImageReaderSpi(vendorName, version, names, suffixes, MIMETypes, readerClassName, inputTypes, writerSpiNames, false, nativeStreamMetadataFormatName, nativeStreamMetadataFormatClassName, extraStreamMetadataFormatNames, extraStreamMetadataFormatClassNames, false, nativeImageMetadataFormatName, nativeImageMetadataFormatClassName, extraImageMetadataFormatNames, extraImageMetadataFormatClassNames) { public String getDescription(Locale locale) { return null; } public boolean canDecodeInput(Object source) { return false; } public ImageReader createReaderInstance(Object extension) { return null; } }; }
Example #20
Source File: CanDecodeTest.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 5 votes |
public static void main(String[] args) throws IOException { ImageReader r = ImageIO.getImageReadersByFormatName("WBMP").next(); ImageReaderSpi spi = r.getOriginatingProvider(); Vector<TestCase> tests = getTestCases(); for (TestCase t : tests) { t.doTest(spi); } System.out.println("Test passed."); }
Example #21
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 #22
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 #23
Source File: StreamResetTest.java From dragonwell8_jdk with GNU General Public License v2.0 | 5 votes |
public static void main(String[] args) { IOException expectedException = null; TestStream iis = new TestStream(); ImageReader wbmp = ImageIO.getImageReadersByFormatName("WBMP").next(); if (wbmp == null) { System.out.println("No WBMP reader: skip the test"); return; } ImageReaderSpi spi = wbmp.getOriginatingProvider(); iis.checkPosition(); try { spi.canDecodeInput(iis); } catch (IOException e) { expectedException = e; } if (expectedException == null) { throw new RuntimeException("Test FAILED: stream was not used"); } iis.checkPosition(); System.out.println("Test PASSED"); }
Example #24
Source File: GIFImageReader.java From Bytecoder with Apache License 2.0 | 4 votes |
public GIFImageReader(ImageReaderSpi originatingProvider) { super(originatingProvider); }
Example #25
Source File: ImageIO.java From jdk8u-jdk with GNU General Public License v2.0 | 4 votes |
/** * Returns an <code>Iterator</code> containing all currently * registered <code>ImageReader</code>s that claim to be able to * decode the supplied <code>Object</code>, typically an * <code>ImageInputStream</code>. * * <p> The stream position is left at its prior position upon * exit from this method. * * @param input an <code>ImageInputStream</code> or other * <code>Object</code> containing encoded image data. * * @return an <code>Iterator</code> containing <code>ImageReader</code>s. * * @exception IllegalArgumentException if <code>input</code> is * <code>null</code>. * * @see javax.imageio.spi.ImageReaderSpi#canDecodeInput */ public static Iterator<ImageReader> getImageReaders(Object input) { if (input == null) { throw new IllegalArgumentException("input == null!"); } Iterator iter; // Ensure category is present try { iter = theRegistry.getServiceProviders(ImageReaderSpi.class, new CanDecodeInputFilter(input), true); } catch (IllegalArgumentException e) { return Collections.emptyIterator(); } return new ImageReaderIterator(iter); }
Example #26
Source File: PNGImageReader.java From jdk8u60 with GNU General Public License v2.0 | 4 votes |
public PNGImageReader(ImageReaderSpi originatingProvider) { super(originatingProvider); }
Example #27
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 #28
Source File: BMPImageReader.java From TencentKona-8 with GNU General Public License v2.0 | 4 votes |
/** Constructs <code>BMPImageReader</code> from the provided * <code>ImageReaderSpi</code>. */ public BMPImageReader(ImageReaderSpi originator) { super(originator); }
Example #29
Source File: ImageIO.java From jdk8u-jdk with GNU General Public License v2.0 | 4 votes |
/** * Returns an <code>Iterator</code> containing all currently * registered <code>ImageReader</code>s that claim to be able to * decode the supplied <code>Object</code>, typically an * <code>ImageInputStream</code>. * * <p> The stream position is left at its prior position upon * exit from this method. * * @param input an <code>ImageInputStream</code> or other * <code>Object</code> containing encoded image data. * * @return an <code>Iterator</code> containing <code>ImageReader</code>s. * * @exception IllegalArgumentException if <code>input</code> is * <code>null</code>. * * @see javax.imageio.spi.ImageReaderSpi#canDecodeInput */ public static Iterator<ImageReader> getImageReaders(Object input) { if (input == null) { throw new IllegalArgumentException("input == null!"); } Iterator iter; // Ensure category is present try { iter = theRegistry.getServiceProviders(ImageReaderSpi.class, new CanDecodeInputFilter(input), true); } catch (IllegalArgumentException e) { return Collections.emptyIterator(); } return new ImageReaderIterator(iter); }
Example #30
Source File: RegisteredFormatsTest.java From jdk8u-dev-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."); } } }