Java Code Examples for javax.imageio.spi.ServiceRegistry#Filter

The following examples show how to use javax.imageio.spi.ServiceRegistry#Filter . 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: ImageIO.java    From jdk8u-jdk with GNU General Public License v2.0 6 votes vote down vote up
/**
 * 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 2
Source File: ImageIOGreyScale.java    From multimedia-indexing with Apache License 2.0 6 votes vote down vote up
/**
 * 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 new HashSet().iterator();
	}
	return new ImageTranscoderIterator(iter);
}
 
Example 3
Source File: ImageIO.java    From jdk8u-dev-jdk with GNU General Public License v2.0 6 votes vote down vote up
/**
 * 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 4
Source File: ImageIO.java    From jdk8u-jdk with GNU General Public License v2.0 6 votes vote down vote up
/**
 * 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 5
Source File: ImageIO.java    From jdk8u_jdk with GNU General Public License v2.0 6 votes vote down vote up
/**
 * 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 6
Source File: ImageIO.java    From openjdk-8 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * 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-8-source with GNU General Public License v2.0 6 votes vote down vote up
/**
 * 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 8
Source File: ImageIO.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
/**
 * 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 9
Source File: ImageIO.java    From Java8CN with Apache License 2.0 6 votes vote down vote up
/**
 * 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 jdk1.8-source-analysis with Apache License 2.0 6 votes vote down vote up
/**
 * 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 11
Source File: ImageIO.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * 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 12
Source File: ImageIO.java    From Bytecoder with Apache License 2.0 6 votes vote down vote up
/**
 * 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 13
Source File: ImageIO.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
/**
 * 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 14
Source File: ImageIO.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
/**
 * 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 15
Source File: ImageIO.java    From JDKSourceCode1.8 with MIT License 6 votes vote down vote up
/**
 * 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 16
Source File: ImageIO.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * 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 17
Source File: ImageIO.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * 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 18
Source File: ImageIO.java    From dragonwell8_jdk with GNU General Public License v2.0 6 votes vote down vote up
/**
 * 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);
}