Java Code Examples for javax.imageio.spi.ImageWriterSpi#getOutputTypes()

The following examples show how to use javax.imageio.spi.ImageWriterSpi#getOutputTypes() . 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: SpiTest.java    From jdk8u_jdk with GNU General Public License v2.0 5 votes vote down vote up
public void testSpi(ImageWriterSpi spi) {
    testSpi((ImageReaderWriterSpi)spi);
    Class[] outputTypes = spi.getOutputTypes();
    if (outputTypes == null) {
        error("outputTypes == null!");
    }
    if (outputTypes.length == 0) {
        error("outputTypes.length == 0!");
    }
    String[] readerSpiNames = spi.getImageReaderSpiNames();
    if (readerSpiNames != null && readerSpiNames.length == 0) {
        error("readerSpiNames.length == 0!");
    }
}
 
Example 2
Source File: SpiTest.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
public void testSpi(ImageWriterSpi spi) {
    testSpi((ImageReaderWriterSpi)spi);
    Class[] outputTypes = spi.getOutputTypes();
    if (outputTypes == null) {
        error("outputTypes == null!");
    }
    if (outputTypes.length == 0) {
        error("outputTypes.length == 0!");
    }
    String[] readerSpiNames = spi.getImageReaderSpiNames();
    if (readerSpiNames != null && readerSpiNames.length == 0) {
        error("readerSpiNames.length == 0!");
    }
}
 
Example 3
Source File: ImageWriter.java    From jdk8u-dev-jdk with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Sets the destination to the given
 * <code>ImageOutputStream</code> or other <code>Object</code>.
 * The destination is assumed to be ready to accept data, and will
 * not be closed at the end of each write. This allows distributed
 * imaging applications to transmit a series of images over a
 * single network connection.  If <code>output</code> is
 * <code>null</code>, any currently set output will be removed.
 *
 * <p> If <code>output</code> is an
 * <code>ImageOutputStream</code>, calls to the
 * <code>write</code>, <code>writeToSequence</code>, and
 * <code>prepareWriteEmpty</code>/<code>endWriteEmpty</code>
 * methods will preserve the existing contents of the stream.
 * Other write methods, such as <code>writeInsert</code>,
 * <code>replaceStreamMetadata</code>,
 * <code>replaceImageMetadata</code>, <code>replacePixels</code>,
 * <code>prepareInsertEmpty</code>/<code>endInsertEmpty</code>,
 * and <code>endWriteSequence</code>, require the full contents
 * of the stream to be readable and writable, and may alter any
 * portion of the stream.
 *
 * <p> Use of a general <code>Object</code> other than an
 * <code>ImageOutputStream</code> is intended for writers that
 * interact directly with an output device or imaging protocol.
 * The set of legal classes is advertised by the writer's service
 * provider's <code>getOutputTypes</code> method; most writers
 * will return a single-element array containing only
 * <code>ImageOutputStream.class</code> to indicate that they
 * accept only an <code>ImageOutputStream</code>.
 *
 * <p> The default implementation sets the <code>output</code>
 * instance variable to the value of <code>output</code> after
 * checking <code>output</code> against the set of classes
 * advertised by the originating provider, if there is one.
 *
 * @param output the <code>ImageOutputStream</code> or other
 * <code>Object</code> to use for future writing.
 *
 * @exception IllegalArgumentException if <code>output</code> is
 * not an instance of one of the classes returned by the
 * originating service provider's <code>getOutputTypes</code>
 * method.
 *
 * @see #getOutput
 */
public void setOutput(Object output) {
    if (output != null) {
        ImageWriterSpi provider = getOriginatingProvider();
        if (provider != null) {
            Class[] classes = provider.getOutputTypes();
            boolean found = false;
            for (int i = 0; i < classes.length; i++) {
                if (classes[i].isInstance(output)) {
                    found = true;
                    break;
                }
            }
            if (!found) {
                throw new IllegalArgumentException("Illegal output type!");
            }
        }
    }

    this.output = output;
}
 
Example 4
Source File: ImageWriter.java    From jdk1.8-source-analysis with Apache License 2.0 4 votes vote down vote up
/**
 * Sets the destination to the given
 * <code>ImageOutputStream</code> or other <code>Object</code>.
 * The destination is assumed to be ready to accept data, and will
 * not be closed at the end of each write. This allows distributed
 * imaging applications to transmit a series of images over a
 * single network connection.  If <code>output</code> is
 * <code>null</code>, any currently set output will be removed.
 *
 * <p> If <code>output</code> is an
 * <code>ImageOutputStream</code>, calls to the
 * <code>write</code>, <code>writeToSequence</code>, and
 * <code>prepareWriteEmpty</code>/<code>endWriteEmpty</code>
 * methods will preserve the existing contents of the stream.
 * Other write methods, such as <code>writeInsert</code>,
 * <code>replaceStreamMetadata</code>,
 * <code>replaceImageMetadata</code>, <code>replacePixels</code>,
 * <code>prepareInsertEmpty</code>/<code>endInsertEmpty</code>,
 * and <code>endWriteSequence</code>, require the full contents
 * of the stream to be readable and writable, and may alter any
 * portion of the stream.
 *
 * <p> Use of a general <code>Object</code> other than an
 * <code>ImageOutputStream</code> is intended for writers that
 * interact directly with an output device or imaging protocol.
 * The set of legal classes is advertised by the writer's service
 * provider's <code>getOutputTypes</code> method; most writers
 * will return a single-element array containing only
 * <code>ImageOutputStream.class</code> to indicate that they
 * accept only an <code>ImageOutputStream</code>.
 *
 * <p> The default implementation sets the <code>output</code>
 * instance variable to the value of <code>output</code> after
 * checking <code>output</code> against the set of classes
 * advertised by the originating provider, if there is one.
 *
 * @param output the <code>ImageOutputStream</code> or other
 * <code>Object</code> to use for future writing.
 *
 * @exception IllegalArgumentException if <code>output</code> is
 * not an instance of one of the classes returned by the
 * originating service provider's <code>getOutputTypes</code>
 * method.
 *
 * @see #getOutput
 */
public void setOutput(Object output) {
    if (output != null) {
        ImageWriterSpi provider = getOriginatingProvider();
        if (provider != null) {
            Class[] classes = provider.getOutputTypes();
            boolean found = false;
            for (int i = 0; i < classes.length; i++) {
                if (classes[i].isInstance(output)) {
                    found = true;
                    break;
                }
            }
            if (!found) {
                throw new IllegalArgumentException("Illegal output type!");
            }
        }
    }

    this.output = output;
}
 
Example 5
Source File: ImageWriter.java    From jdk8u-jdk with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Sets the destination to the given
 * <code>ImageOutputStream</code> or other <code>Object</code>.
 * The destination is assumed to be ready to accept data, and will
 * not be closed at the end of each write. This allows distributed
 * imaging applications to transmit a series of images over a
 * single network connection.  If <code>output</code> is
 * <code>null</code>, any currently set output will be removed.
 *
 * <p> If <code>output</code> is an
 * <code>ImageOutputStream</code>, calls to the
 * <code>write</code>, <code>writeToSequence</code>, and
 * <code>prepareWriteEmpty</code>/<code>endWriteEmpty</code>
 * methods will preserve the existing contents of the stream.
 * Other write methods, such as <code>writeInsert</code>,
 * <code>replaceStreamMetadata</code>,
 * <code>replaceImageMetadata</code>, <code>replacePixels</code>,
 * <code>prepareInsertEmpty</code>/<code>endInsertEmpty</code>,
 * and <code>endWriteSequence</code>, require the full contents
 * of the stream to be readable and writable, and may alter any
 * portion of the stream.
 *
 * <p> Use of a general <code>Object</code> other than an
 * <code>ImageOutputStream</code> is intended for writers that
 * interact directly with an output device or imaging protocol.
 * The set of legal classes is advertised by the writer's service
 * provider's <code>getOutputTypes</code> method; most writers
 * will return a single-element array containing only
 * <code>ImageOutputStream.class</code> to indicate that they
 * accept only an <code>ImageOutputStream</code>.
 *
 * <p> The default implementation sets the <code>output</code>
 * instance variable to the value of <code>output</code> after
 * checking <code>output</code> against the set of classes
 * advertised by the originating provider, if there is one.
 *
 * @param output the <code>ImageOutputStream</code> or other
 * <code>Object</code> to use for future writing.
 *
 * @exception IllegalArgumentException if <code>output</code> is
 * not an instance of one of the classes returned by the
 * originating service provider's <code>getOutputTypes</code>
 * method.
 *
 * @see #getOutput
 */
public void setOutput(Object output) {
    if (output != null) {
        ImageWriterSpi provider = getOriginatingProvider();
        if (provider != null) {
            Class[] classes = provider.getOutputTypes();
            boolean found = false;
            for (int i = 0; i < classes.length; i++) {
                if (classes[i].isInstance(output)) {
                    found = true;
                    break;
                }
            }
            if (!found) {
                throw new IllegalArgumentException("Illegal output type!");
            }
        }
    }

    this.output = output;
}
 
Example 6
Source File: ImageWriter.java    From jdk8u_jdk with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Sets the destination to the given
 * <code>ImageOutputStream</code> or other <code>Object</code>.
 * The destination is assumed to be ready to accept data, and will
 * not be closed at the end of each write. This allows distributed
 * imaging applications to transmit a series of images over a
 * single network connection.  If <code>output</code> is
 * <code>null</code>, any currently set output will be removed.
 *
 * <p> If <code>output</code> is an
 * <code>ImageOutputStream</code>, calls to the
 * <code>write</code>, <code>writeToSequence</code>, and
 * <code>prepareWriteEmpty</code>/<code>endWriteEmpty</code>
 * methods will preserve the existing contents of the stream.
 * Other write methods, such as <code>writeInsert</code>,
 * <code>replaceStreamMetadata</code>,
 * <code>replaceImageMetadata</code>, <code>replacePixels</code>,
 * <code>prepareInsertEmpty</code>/<code>endInsertEmpty</code>,
 * and <code>endWriteSequence</code>, require the full contents
 * of the stream to be readable and writable, and may alter any
 * portion of the stream.
 *
 * <p> Use of a general <code>Object</code> other than an
 * <code>ImageOutputStream</code> is intended for writers that
 * interact directly with an output device or imaging protocol.
 * The set of legal classes is advertised by the writer's service
 * provider's <code>getOutputTypes</code> method; most writers
 * will return a single-element array containing only
 * <code>ImageOutputStream.class</code> to indicate that they
 * accept only an <code>ImageOutputStream</code>.
 *
 * <p> The default implementation sets the <code>output</code>
 * instance variable to the value of <code>output</code> after
 * checking <code>output</code> against the set of classes
 * advertised by the originating provider, if there is one.
 *
 * @param output the <code>ImageOutputStream</code> or other
 * <code>Object</code> to use for future writing.
 *
 * @exception IllegalArgumentException if <code>output</code> is
 * not an instance of one of the classes returned by the
 * originating service provider's <code>getOutputTypes</code>
 * method.
 *
 * @see #getOutput
 */
public void setOutput(Object output) {
    if (output != null) {
        ImageWriterSpi provider = getOriginatingProvider();
        if (provider != null) {
            Class[] classes = provider.getOutputTypes();
            boolean found = false;
            for (int i = 0; i < classes.length; i++) {
                if (classes[i].isInstance(output)) {
                    found = true;
                    break;
                }
            }
            if (!found) {
                throw new IllegalArgumentException("Illegal output type!");
            }
        }
    }

    this.output = output;
}
 
Example 7
Source File: ImageWriter.java    From openjdk-8 with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Sets the destination to the given
 * <code>ImageOutputStream</code> or other <code>Object</code>.
 * The destination is assumed to be ready to accept data, and will
 * not be closed at the end of each write. This allows distributed
 * imaging applications to transmit a series of images over a
 * single network connection.  If <code>output</code> is
 * <code>null</code>, any currently set output will be removed.
 *
 * <p> If <code>output</code> is an
 * <code>ImageOutputStream</code>, calls to the
 * <code>write</code>, <code>writeToSequence</code>, and
 * <code>prepareWriteEmpty</code>/<code>endWriteEmpty</code>
 * methods will preserve the existing contents of the stream.
 * Other write methods, such as <code>writeInsert</code>,
 * <code>replaceStreamMetadata</code>,
 * <code>replaceImageMetadata</code>, <code>replacePixels</code>,
 * <code>prepareInsertEmpty</code>/<code>endInsertEmpty</code>,
 * and <code>endWriteSequence</code>, require the full contents
 * of the stream to be readable and writable, and may alter any
 * portion of the stream.
 *
 * <p> Use of a general <code>Object</code> other than an
 * <code>ImageOutputStream</code> is intended for writers that
 * interact directly with an output device or imaging protocol.
 * The set of legal classes is advertised by the writer's service
 * provider's <code>getOutputTypes</code> method; most writers
 * will return a single-element array containing only
 * <code>ImageOutputStream.class</code> to indicate that they
 * accept only an <code>ImageOutputStream</code>.
 *
 * <p> The default implementation sets the <code>output</code>
 * instance variable to the value of <code>output</code> after
 * checking <code>output</code> against the set of classes
 * advertised by the originating provider, if there is one.
 *
 * @param output the <code>ImageOutputStream</code> or other
 * <code>Object</code> to use for future writing.
 *
 * @exception IllegalArgumentException if <code>output</code> is
 * not an instance of one of the classes returned by the
 * originating service provider's <code>getOutputTypes</code>
 * method.
 *
 * @see #getOutput
 */
public void setOutput(Object output) {
    if (output != null) {
        ImageWriterSpi provider = getOriginatingProvider();
        if (provider != null) {
            Class[] classes = provider.getOutputTypes();
            boolean found = false;
            for (int i = 0; i < classes.length; i++) {
                if (classes[i].isInstance(output)) {
                    found = true;
                    break;
                }
            }
            if (!found) {
                throw new IllegalArgumentException("Illegal output type!");
            }
        }
    }

    this.output = output;
}
 
Example 8
Source File: ImageWriter.java    From openjdk-8-source with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Sets the destination to the given
 * <code>ImageOutputStream</code> or other <code>Object</code>.
 * The destination is assumed to be ready to accept data, and will
 * not be closed at the end of each write. This allows distributed
 * imaging applications to transmit a series of images over a
 * single network connection.  If <code>output</code> is
 * <code>null</code>, any currently set output will be removed.
 *
 * <p> If <code>output</code> is an
 * <code>ImageOutputStream</code>, calls to the
 * <code>write</code>, <code>writeToSequence</code>, and
 * <code>prepareWriteEmpty</code>/<code>endWriteEmpty</code>
 * methods will preserve the existing contents of the stream.
 * Other write methods, such as <code>writeInsert</code>,
 * <code>replaceStreamMetadata</code>,
 * <code>replaceImageMetadata</code>, <code>replacePixels</code>,
 * <code>prepareInsertEmpty</code>/<code>endInsertEmpty</code>,
 * and <code>endWriteSequence</code>, require the full contents
 * of the stream to be readable and writable, and may alter any
 * portion of the stream.
 *
 * <p> Use of a general <code>Object</code> other than an
 * <code>ImageOutputStream</code> is intended for writers that
 * interact directly with an output device or imaging protocol.
 * The set of legal classes is advertised by the writer's service
 * provider's <code>getOutputTypes</code> method; most writers
 * will return a single-element array containing only
 * <code>ImageOutputStream.class</code> to indicate that they
 * accept only an <code>ImageOutputStream</code>.
 *
 * <p> The default implementation sets the <code>output</code>
 * instance variable to the value of <code>output</code> after
 * checking <code>output</code> against the set of classes
 * advertised by the originating provider, if there is one.
 *
 * @param output the <code>ImageOutputStream</code> or other
 * <code>Object</code> to use for future writing.
 *
 * @exception IllegalArgumentException if <code>output</code> is
 * not an instance of one of the classes returned by the
 * originating service provider's <code>getOutputTypes</code>
 * method.
 *
 * @see #getOutput
 */
public void setOutput(Object output) {
    if (output != null) {
        ImageWriterSpi provider = getOriginatingProvider();
        if (provider != null) {
            Class[] classes = provider.getOutputTypes();
            boolean found = false;
            for (int i = 0; i < classes.length; i++) {
                if (classes[i].isInstance(output)) {
                    found = true;
                    break;
                }
            }
            if (!found) {
                throw new IllegalArgumentException("Illegal output type!");
            }
        }
    }

    this.output = output;
}
 
Example 9
Source File: ImageWriter.java    From hottub with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Sets the destination to the given
 * <code>ImageOutputStream</code> or other <code>Object</code>.
 * The destination is assumed to be ready to accept data, and will
 * not be closed at the end of each write. This allows distributed
 * imaging applications to transmit a series of images over a
 * single network connection.  If <code>output</code> is
 * <code>null</code>, any currently set output will be removed.
 *
 * <p> If <code>output</code> is an
 * <code>ImageOutputStream</code>, calls to the
 * <code>write</code>, <code>writeToSequence</code>, and
 * <code>prepareWriteEmpty</code>/<code>endWriteEmpty</code>
 * methods will preserve the existing contents of the stream.
 * Other write methods, such as <code>writeInsert</code>,
 * <code>replaceStreamMetadata</code>,
 * <code>replaceImageMetadata</code>, <code>replacePixels</code>,
 * <code>prepareInsertEmpty</code>/<code>endInsertEmpty</code>,
 * and <code>endWriteSequence</code>, require the full contents
 * of the stream to be readable and writable, and may alter any
 * portion of the stream.
 *
 * <p> Use of a general <code>Object</code> other than an
 * <code>ImageOutputStream</code> is intended for writers that
 * interact directly with an output device or imaging protocol.
 * The set of legal classes is advertised by the writer's service
 * provider's <code>getOutputTypes</code> method; most writers
 * will return a single-element array containing only
 * <code>ImageOutputStream.class</code> to indicate that they
 * accept only an <code>ImageOutputStream</code>.
 *
 * <p> The default implementation sets the <code>output</code>
 * instance variable to the value of <code>output</code> after
 * checking <code>output</code> against the set of classes
 * advertised by the originating provider, if there is one.
 *
 * @param output the <code>ImageOutputStream</code> or other
 * <code>Object</code> to use for future writing.
 *
 * @exception IllegalArgumentException if <code>output</code> is
 * not an instance of one of the classes returned by the
 * originating service provider's <code>getOutputTypes</code>
 * method.
 *
 * @see #getOutput
 */
public void setOutput(Object output) {
    if (output != null) {
        ImageWriterSpi provider = getOriginatingProvider();
        if (provider != null) {
            Class[] classes = provider.getOutputTypes();
            boolean found = false;
            for (int i = 0; i < classes.length; i++) {
                if (classes[i].isInstance(output)) {
                    found = true;
                    break;
                }
            }
            if (!found) {
                throw new IllegalArgumentException("Illegal output type!");
            }
        }
    }

    this.output = output;
}
 
Example 10
Source File: ImageWriter.java    From Java8CN with Apache License 2.0 4 votes vote down vote up
/**
 * Sets the destination to the given
 * <code>ImageOutputStream</code> or other <code>Object</code>.
 * The destination is assumed to be ready to accept data, and will
 * not be closed at the end of each write. This allows distributed
 * imaging applications to transmit a series of images over a
 * single network connection.  If <code>output</code> is
 * <code>null</code>, any currently set output will be removed.
 *
 * <p> If <code>output</code> is an
 * <code>ImageOutputStream</code>, calls to the
 * <code>write</code>, <code>writeToSequence</code>, and
 * <code>prepareWriteEmpty</code>/<code>endWriteEmpty</code>
 * methods will preserve the existing contents of the stream.
 * Other write methods, such as <code>writeInsert</code>,
 * <code>replaceStreamMetadata</code>,
 * <code>replaceImageMetadata</code>, <code>replacePixels</code>,
 * <code>prepareInsertEmpty</code>/<code>endInsertEmpty</code>,
 * and <code>endWriteSequence</code>, require the full contents
 * of the stream to be readable and writable, and may alter any
 * portion of the stream.
 *
 * <p> Use of a general <code>Object</code> other than an
 * <code>ImageOutputStream</code> is intended for writers that
 * interact directly with an output device or imaging protocol.
 * The set of legal classes is advertised by the writer's service
 * provider's <code>getOutputTypes</code> method; most writers
 * will return a single-element array containing only
 * <code>ImageOutputStream.class</code> to indicate that they
 * accept only an <code>ImageOutputStream</code>.
 *
 * <p> The default implementation sets the <code>output</code>
 * instance variable to the value of <code>output</code> after
 * checking <code>output</code> against the set of classes
 * advertised by the originating provider, if there is one.
 *
 * @param output the <code>ImageOutputStream</code> or other
 * <code>Object</code> to use for future writing.
 *
 * @exception IllegalArgumentException if <code>output</code> is
 * not an instance of one of the classes returned by the
 * originating service provider's <code>getOutputTypes</code>
 * method.
 *
 * @see #getOutput
 */
public void setOutput(Object output) {
    if (output != null) {
        ImageWriterSpi provider = getOriginatingProvider();
        if (provider != null) {
            Class[] classes = provider.getOutputTypes();
            boolean found = false;
            for (int i = 0; i < classes.length; i++) {
                if (classes[i].isInstance(output)) {
                    found = true;
                    break;
                }
            }
            if (!found) {
                throw new IllegalArgumentException("Illegal output type!");
            }
        }
    }

    this.output = output;
}
 
Example 11
Source File: ImageWriter.java    From jdk8u-jdk with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Sets the destination to the given
 * <code>ImageOutputStream</code> or other <code>Object</code>.
 * The destination is assumed to be ready to accept data, and will
 * not be closed at the end of each write. This allows distributed
 * imaging applications to transmit a series of images over a
 * single network connection.  If <code>output</code> is
 * <code>null</code>, any currently set output will be removed.
 *
 * <p> If <code>output</code> is an
 * <code>ImageOutputStream</code>, calls to the
 * <code>write</code>, <code>writeToSequence</code>, and
 * <code>prepareWriteEmpty</code>/<code>endWriteEmpty</code>
 * methods will preserve the existing contents of the stream.
 * Other write methods, such as <code>writeInsert</code>,
 * <code>replaceStreamMetadata</code>,
 * <code>replaceImageMetadata</code>, <code>replacePixels</code>,
 * <code>prepareInsertEmpty</code>/<code>endInsertEmpty</code>,
 * and <code>endWriteSequence</code>, require the full contents
 * of the stream to be readable and writable, and may alter any
 * portion of the stream.
 *
 * <p> Use of a general <code>Object</code> other than an
 * <code>ImageOutputStream</code> is intended for writers that
 * interact directly with an output device or imaging protocol.
 * The set of legal classes is advertised by the writer's service
 * provider's <code>getOutputTypes</code> method; most writers
 * will return a single-element array containing only
 * <code>ImageOutputStream.class</code> to indicate that they
 * accept only an <code>ImageOutputStream</code>.
 *
 * <p> The default implementation sets the <code>output</code>
 * instance variable to the value of <code>output</code> after
 * checking <code>output</code> against the set of classes
 * advertised by the originating provider, if there is one.
 *
 * @param output the <code>ImageOutputStream</code> or other
 * <code>Object</code> to use for future writing.
 *
 * @exception IllegalArgumentException if <code>output</code> is
 * not an instance of one of the classes returned by the
 * originating service provider's <code>getOutputTypes</code>
 * method.
 *
 * @see #getOutput
 */
public void setOutput(Object output) {
    if (output != null) {
        ImageWriterSpi provider = getOriginatingProvider();
        if (provider != null) {
            Class[] classes = provider.getOutputTypes();
            boolean found = false;
            for (int i = 0; i < classes.length; i++) {
                if (classes[i].isInstance(output)) {
                    found = true;
                    break;
                }
            }
            if (!found) {
                throw new IllegalArgumentException("Illegal output type!");
            }
        }
    }

    this.output = output;
}
 
Example 12
Source File: ImageWriter.java    From openjdk-jdk9 with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Sets the destination to the given
 * {@code ImageOutputStream} or other {@code Object}.
 * The destination is assumed to be ready to accept data, and will
 * not be closed at the end of each write. This allows distributed
 * imaging applications to transmit a series of images over a
 * single network connection.  If {@code output} is
 * {@code null}, any currently set output will be removed.
 *
 * <p> If {@code output} is an
 * {@code ImageOutputStream}, calls to the
 * {@code write}, {@code writeToSequence}, and
 * {@code prepareWriteEmpty}/{@code endWriteEmpty}
 * methods will preserve the existing contents of the stream.
 * Other write methods, such as {@code writeInsert},
 * {@code replaceStreamMetadata},
 * {@code replaceImageMetadata}, {@code replacePixels},
 * {@code prepareInsertEmpty}/{@code endInsertEmpty},
 * and {@code endWriteSequence}, require the full contents
 * of the stream to be readable and writable, and may alter any
 * portion of the stream.
 *
 * <p> Use of a general {@code Object} other than an
 * {@code ImageOutputStream} is intended for writers that
 * interact directly with an output device or imaging protocol.
 * The set of legal classes is advertised by the writer's service
 * provider's {@code getOutputTypes} method; most writers
 * will return a single-element array containing only
 * {@code ImageOutputStream.class} to indicate that they
 * accept only an {@code ImageOutputStream}.
 *
 * <p> The default implementation sets the {@code output}
 * instance variable to the value of {@code output} after
 * checking {@code output} against the set of classes
 * advertised by the originating provider, if there is one.
 *
 * @param output the {@code ImageOutputStream} or other
 * {@code Object} to use for future writing.
 *
 * @exception IllegalArgumentException if {@code output} is
 * not an instance of one of the classes returned by the
 * originating service provider's {@code getOutputTypes}
 * method.
 *
 * @see #getOutput
 */
public void setOutput(Object output) {
    if (output != null) {
        ImageWriterSpi provider = getOriginatingProvider();
        if (provider != null) {
            Class<?>[] classes = provider.getOutputTypes();
            boolean found = false;
            for (int i = 0; i < classes.length; i++) {
                if (classes[i].isInstance(output)) {
                    found = true;
                    break;
                }
            }
            if (!found) {
                throw new IllegalArgumentException("Illegal output type!");
            }
        }
    }

    this.output = output;
}
 
Example 13
Source File: ImageWriter.java    From Bytecoder with Apache License 2.0 4 votes vote down vote up
/**
 * Sets the destination to the given
 * {@code ImageOutputStream} or other {@code Object}.
 * The destination is assumed to be ready to accept data, and will
 * not be closed at the end of each write. This allows distributed
 * imaging applications to transmit a series of images over a
 * single network connection.  If {@code output} is
 * {@code null}, any currently set output will be removed.
 *
 * <p> If {@code output} is an
 * {@code ImageOutputStream}, calls to the
 * {@code write}, {@code writeToSequence}, and
 * {@code prepareWriteEmpty}/{@code endWriteEmpty}
 * methods will preserve the existing contents of the stream.
 * Other write methods, such as {@code writeInsert},
 * {@code replaceStreamMetadata},
 * {@code replaceImageMetadata}, {@code replacePixels},
 * {@code prepareInsertEmpty}/{@code endInsertEmpty},
 * and {@code endWriteSequence}, require the full contents
 * of the stream to be readable and writable, and may alter any
 * portion of the stream.
 *
 * <p> Use of a general {@code Object} other than an
 * {@code ImageOutputStream} is intended for writers that
 * interact directly with an output device or imaging protocol.
 * The set of legal classes is advertised by the writer's service
 * provider's {@code getOutputTypes} method; most writers
 * will return a single-element array containing only
 * {@code ImageOutputStream.class} to indicate that they
 * accept only an {@code ImageOutputStream}.
 *
 * <p> The default implementation sets the {@code output}
 * instance variable to the value of {@code output} after
 * checking {@code output} against the set of classes
 * advertised by the originating provider, if there is one.
 *
 * @param output the {@code ImageOutputStream} or other
 * {@code Object} to use for future writing.
 *
 * @exception IllegalArgumentException if {@code output} is
 * not an instance of one of the classes returned by the
 * originating service provider's {@code getOutputTypes}
 * method.
 *
 * @see #getOutput
 */
public void setOutput(Object output) {
    if (output != null) {
        ImageWriterSpi provider = getOriginatingProvider();
        if (provider != null) {
            Class<?>[] classes = provider.getOutputTypes();
            boolean found = false;
            for (int i = 0; i < classes.length; i++) {
                if (classes[i].isInstance(output)) {
                    found = true;
                    break;
                }
            }
            if (!found) {
                throw new IllegalArgumentException("Illegal output type!");
            }
        }
    }

    this.output = output;
}
 
Example 14
Source File: ImageWriter.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Sets the destination to the given
 * <code>ImageOutputStream</code> or other <code>Object</code>.
 * The destination is assumed to be ready to accept data, and will
 * not be closed at the end of each write. This allows distributed
 * imaging applications to transmit a series of images over a
 * single network connection.  If <code>output</code> is
 * <code>null</code>, any currently set output will be removed.
 *
 * <p> If <code>output</code> is an
 * <code>ImageOutputStream</code>, calls to the
 * <code>write</code>, <code>writeToSequence</code>, and
 * <code>prepareWriteEmpty</code>/<code>endWriteEmpty</code>
 * methods will preserve the existing contents of the stream.
 * Other write methods, such as <code>writeInsert</code>,
 * <code>replaceStreamMetadata</code>,
 * <code>replaceImageMetadata</code>, <code>replacePixels</code>,
 * <code>prepareInsertEmpty</code>/<code>endInsertEmpty</code>,
 * and <code>endWriteSequence</code>, require the full contents
 * of the stream to be readable and writable, and may alter any
 * portion of the stream.
 *
 * <p> Use of a general <code>Object</code> other than an
 * <code>ImageOutputStream</code> is intended for writers that
 * interact directly with an output device or imaging protocol.
 * The set of legal classes is advertised by the writer's service
 * provider's <code>getOutputTypes</code> method; most writers
 * will return a single-element array containing only
 * <code>ImageOutputStream.class</code> to indicate that they
 * accept only an <code>ImageOutputStream</code>.
 *
 * <p> The default implementation sets the <code>output</code>
 * instance variable to the value of <code>output</code> after
 * checking <code>output</code> against the set of classes
 * advertised by the originating provider, if there is one.
 *
 * @param output the <code>ImageOutputStream</code> or other
 * <code>Object</code> to use for future writing.
 *
 * @exception IllegalArgumentException if <code>output</code> is
 * not an instance of one of the classes returned by the
 * originating service provider's <code>getOutputTypes</code>
 * method.
 *
 * @see #getOutput
 */
public void setOutput(Object output) {
    if (output != null) {
        ImageWriterSpi provider = getOriginatingProvider();
        if (provider != null) {
            Class[] classes = provider.getOutputTypes();
            boolean found = false;
            for (int i = 0; i < classes.length; i++) {
                if (classes[i].isInstance(output)) {
                    found = true;
                    break;
                }
            }
            if (!found) {
                throw new IllegalArgumentException("Illegal output type!");
            }
        }
    }

    this.output = output;
}
 
Example 15
Source File: ImageWriter.java    From openjdk-jdk8u with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Sets the destination to the given
 * <code>ImageOutputStream</code> or other <code>Object</code>.
 * The destination is assumed to be ready to accept data, and will
 * not be closed at the end of each write. This allows distributed
 * imaging applications to transmit a series of images over a
 * single network connection.  If <code>output</code> is
 * <code>null</code>, any currently set output will be removed.
 *
 * <p> If <code>output</code> is an
 * <code>ImageOutputStream</code>, calls to the
 * <code>write</code>, <code>writeToSequence</code>, and
 * <code>prepareWriteEmpty</code>/<code>endWriteEmpty</code>
 * methods will preserve the existing contents of the stream.
 * Other write methods, such as <code>writeInsert</code>,
 * <code>replaceStreamMetadata</code>,
 * <code>replaceImageMetadata</code>, <code>replacePixels</code>,
 * <code>prepareInsertEmpty</code>/<code>endInsertEmpty</code>,
 * and <code>endWriteSequence</code>, require the full contents
 * of the stream to be readable and writable, and may alter any
 * portion of the stream.
 *
 * <p> Use of a general <code>Object</code> other than an
 * <code>ImageOutputStream</code> is intended for writers that
 * interact directly with an output device or imaging protocol.
 * The set of legal classes is advertised by the writer's service
 * provider's <code>getOutputTypes</code> method; most writers
 * will return a single-element array containing only
 * <code>ImageOutputStream.class</code> to indicate that they
 * accept only an <code>ImageOutputStream</code>.
 *
 * <p> The default implementation sets the <code>output</code>
 * instance variable to the value of <code>output</code> after
 * checking <code>output</code> against the set of classes
 * advertised by the originating provider, if there is one.
 *
 * @param output the <code>ImageOutputStream</code> or other
 * <code>Object</code> to use for future writing.
 *
 * @exception IllegalArgumentException if <code>output</code> is
 * not an instance of one of the classes returned by the
 * originating service provider's <code>getOutputTypes</code>
 * method.
 *
 * @see #getOutput
 */
public void setOutput(Object output) {
    if (output != null) {
        ImageWriterSpi provider = getOriginatingProvider();
        if (provider != null) {
            Class[] classes = provider.getOutputTypes();
            boolean found = false;
            for (int i = 0; i < classes.length; i++) {
                if (classes[i].isInstance(output)) {
                    found = true;
                    break;
                }
            }
            if (!found) {
                throw new IllegalArgumentException("Illegal output type!");
            }
        }
    }

    this.output = output;
}
 
Example 16
Source File: ImageWriter.java    From JDKSourceCode1.8 with MIT License 4 votes vote down vote up
/**
 * Sets the destination to the given
 * <code>ImageOutputStream</code> or other <code>Object</code>.
 * The destination is assumed to be ready to accept data, and will
 * not be closed at the end of each write. This allows distributed
 * imaging applications to transmit a series of images over a
 * single network connection.  If <code>output</code> is
 * <code>null</code>, any currently set output will be removed.
 *
 * <p> If <code>output</code> is an
 * <code>ImageOutputStream</code>, calls to the
 * <code>write</code>, <code>writeToSequence</code>, and
 * <code>prepareWriteEmpty</code>/<code>endWriteEmpty</code>
 * methods will preserve the existing contents of the stream.
 * Other write methods, such as <code>writeInsert</code>,
 * <code>replaceStreamMetadata</code>,
 * <code>replaceImageMetadata</code>, <code>replacePixels</code>,
 * <code>prepareInsertEmpty</code>/<code>endInsertEmpty</code>,
 * and <code>endWriteSequence</code>, require the full contents
 * of the stream to be readable and writable, and may alter any
 * portion of the stream.
 *
 * <p> Use of a general <code>Object</code> other than an
 * <code>ImageOutputStream</code> is intended for writers that
 * interact directly with an output device or imaging protocol.
 * The set of legal classes is advertised by the writer's service
 * provider's <code>getOutputTypes</code> method; most writers
 * will return a single-element array containing only
 * <code>ImageOutputStream.class</code> to indicate that they
 * accept only an <code>ImageOutputStream</code>.
 *
 * <p> The default implementation sets the <code>output</code>
 * instance variable to the value of <code>output</code> after
 * checking <code>output</code> against the set of classes
 * advertised by the originating provider, if there is one.
 *
 * @param output the <code>ImageOutputStream</code> or other
 * <code>Object</code> to use for future writing.
 *
 * @exception IllegalArgumentException if <code>output</code> is
 * not an instance of one of the classes returned by the
 * originating service provider's <code>getOutputTypes</code>
 * method.
 *
 * @see #getOutput
 */
public void setOutput(Object output) {
    if (output != null) {
        ImageWriterSpi provider = getOriginatingProvider();
        if (provider != null) {
            Class[] classes = provider.getOutputTypes();
            boolean found = false;
            for (int i = 0; i < classes.length; i++) {
                if (classes[i].isInstance(output)) {
                    found = true;
                    break;
                }
            }
            if (!found) {
                throw new IllegalArgumentException("Illegal output type!");
            }
        }
    }

    this.output = output;
}
 
Example 17
Source File: ImageWriter.java    From jdk8u60 with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Sets the destination to the given
 * <code>ImageOutputStream</code> or other <code>Object</code>.
 * The destination is assumed to be ready to accept data, and will
 * not be closed at the end of each write. This allows distributed
 * imaging applications to transmit a series of images over a
 * single network connection.  If <code>output</code> is
 * <code>null</code>, any currently set output will be removed.
 *
 * <p> If <code>output</code> is an
 * <code>ImageOutputStream</code>, calls to the
 * <code>write</code>, <code>writeToSequence</code>, and
 * <code>prepareWriteEmpty</code>/<code>endWriteEmpty</code>
 * methods will preserve the existing contents of the stream.
 * Other write methods, such as <code>writeInsert</code>,
 * <code>replaceStreamMetadata</code>,
 * <code>replaceImageMetadata</code>, <code>replacePixels</code>,
 * <code>prepareInsertEmpty</code>/<code>endInsertEmpty</code>,
 * and <code>endWriteSequence</code>, require the full contents
 * of the stream to be readable and writable, and may alter any
 * portion of the stream.
 *
 * <p> Use of a general <code>Object</code> other than an
 * <code>ImageOutputStream</code> is intended for writers that
 * interact directly with an output device or imaging protocol.
 * The set of legal classes is advertised by the writer's service
 * provider's <code>getOutputTypes</code> method; most writers
 * will return a single-element array containing only
 * <code>ImageOutputStream.class</code> to indicate that they
 * accept only an <code>ImageOutputStream</code>.
 *
 * <p> The default implementation sets the <code>output</code>
 * instance variable to the value of <code>output</code> after
 * checking <code>output</code> against the set of classes
 * advertised by the originating provider, if there is one.
 *
 * @param output the <code>ImageOutputStream</code> or other
 * <code>Object</code> to use for future writing.
 *
 * @exception IllegalArgumentException if <code>output</code> is
 * not an instance of one of the classes returned by the
 * originating service provider's <code>getOutputTypes</code>
 * method.
 *
 * @see #getOutput
 */
public void setOutput(Object output) {
    if (output != null) {
        ImageWriterSpi provider = getOriginatingProvider();
        if (provider != null) {
            Class[] classes = provider.getOutputTypes();
            boolean found = false;
            for (int i = 0; i < classes.length; i++) {
                if (classes[i].isInstance(output)) {
                    found = true;
                    break;
                }
            }
            if (!found) {
                throw new IllegalArgumentException("Illegal output type!");
            }
        }
    }

    this.output = output;
}
 
Example 18
Source File: ImageWriter.java    From TencentKona-8 with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Sets the destination to the given
 * <code>ImageOutputStream</code> or other <code>Object</code>.
 * The destination is assumed to be ready to accept data, and will
 * not be closed at the end of each write. This allows distributed
 * imaging applications to transmit a series of images over a
 * single network connection.  If <code>output</code> is
 * <code>null</code>, any currently set output will be removed.
 *
 * <p> If <code>output</code> is an
 * <code>ImageOutputStream</code>, calls to the
 * <code>write</code>, <code>writeToSequence</code>, and
 * <code>prepareWriteEmpty</code>/<code>endWriteEmpty</code>
 * methods will preserve the existing contents of the stream.
 * Other write methods, such as <code>writeInsert</code>,
 * <code>replaceStreamMetadata</code>,
 * <code>replaceImageMetadata</code>, <code>replacePixels</code>,
 * <code>prepareInsertEmpty</code>/<code>endInsertEmpty</code>,
 * and <code>endWriteSequence</code>, require the full contents
 * of the stream to be readable and writable, and may alter any
 * portion of the stream.
 *
 * <p> Use of a general <code>Object</code> other than an
 * <code>ImageOutputStream</code> is intended for writers that
 * interact directly with an output device or imaging protocol.
 * The set of legal classes is advertised by the writer's service
 * provider's <code>getOutputTypes</code> method; most writers
 * will return a single-element array containing only
 * <code>ImageOutputStream.class</code> to indicate that they
 * accept only an <code>ImageOutputStream</code>.
 *
 * <p> The default implementation sets the <code>output</code>
 * instance variable to the value of <code>output</code> after
 * checking <code>output</code> against the set of classes
 * advertised by the originating provider, if there is one.
 *
 * @param output the <code>ImageOutputStream</code> or other
 * <code>Object</code> to use for future writing.
 *
 * @exception IllegalArgumentException if <code>output</code> is
 * not an instance of one of the classes returned by the
 * originating service provider's <code>getOutputTypes</code>
 * method.
 *
 * @see #getOutput
 */
public void setOutput(Object output) {
    if (output != null) {
        ImageWriterSpi provider = getOriginatingProvider();
        if (provider != null) {
            Class[] classes = provider.getOutputTypes();
            boolean found = false;
            for (int i = 0; i < classes.length; i++) {
                if (classes[i].isInstance(output)) {
                    found = true;
                    break;
                }
            }
            if (!found) {
                throw new IllegalArgumentException("Illegal output type!");
            }
        }
    }

    this.output = output;
}
 
Example 19
Source File: ImageWriter.java    From dragonwell8_jdk with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Sets the destination to the given
 * <code>ImageOutputStream</code> or other <code>Object</code>.
 * The destination is assumed to be ready to accept data, and will
 * not be closed at the end of each write. This allows distributed
 * imaging applications to transmit a series of images over a
 * single network connection.  If <code>output</code> is
 * <code>null</code>, any currently set output will be removed.
 *
 * <p> If <code>output</code> is an
 * <code>ImageOutputStream</code>, calls to the
 * <code>write</code>, <code>writeToSequence</code>, and
 * <code>prepareWriteEmpty</code>/<code>endWriteEmpty</code>
 * methods will preserve the existing contents of the stream.
 * Other write methods, such as <code>writeInsert</code>,
 * <code>replaceStreamMetadata</code>,
 * <code>replaceImageMetadata</code>, <code>replacePixels</code>,
 * <code>prepareInsertEmpty</code>/<code>endInsertEmpty</code>,
 * and <code>endWriteSequence</code>, require the full contents
 * of the stream to be readable and writable, and may alter any
 * portion of the stream.
 *
 * <p> Use of a general <code>Object</code> other than an
 * <code>ImageOutputStream</code> is intended for writers that
 * interact directly with an output device or imaging protocol.
 * The set of legal classes is advertised by the writer's service
 * provider's <code>getOutputTypes</code> method; most writers
 * will return a single-element array containing only
 * <code>ImageOutputStream.class</code> to indicate that they
 * accept only an <code>ImageOutputStream</code>.
 *
 * <p> The default implementation sets the <code>output</code>
 * instance variable to the value of <code>output</code> after
 * checking <code>output</code> against the set of classes
 * advertised by the originating provider, if there is one.
 *
 * @param output the <code>ImageOutputStream</code> or other
 * <code>Object</code> to use for future writing.
 *
 * @exception IllegalArgumentException if <code>output</code> is
 * not an instance of one of the classes returned by the
 * originating service provider's <code>getOutputTypes</code>
 * method.
 *
 * @see #getOutput
 */
public void setOutput(Object output) {
    if (output != null) {
        ImageWriterSpi provider = getOriginatingProvider();
        if (provider != null) {
            Class[] classes = provider.getOutputTypes();
            boolean found = false;
            for (int i = 0; i < classes.length; i++) {
                if (classes[i].isInstance(output)) {
                    found = true;
                    break;
                }
            }
            if (!found) {
                throw new IllegalArgumentException("Illegal output type!");
            }
        }
    }

    this.output = output;
}