本文整理汇总了Java中javax.imageio.spi.ImageWriterSpi.getOutputTypes方法的典型用法代码示例。如果您正苦于以下问题:Java ImageWriterSpi.getOutputTypes方法的具体用法?Java ImageWriterSpi.getOutputTypes怎么用?Java ImageWriterSpi.getOutputTypes使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.imageio.spi.ImageWriterSpi
的用法示例。
在下文中一共展示了ImageWriterSpi.getOutputTypes方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testSpi
import javax.imageio.spi.ImageWriterSpi; //导入方法依赖的package包/类
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!");
}
}
示例2: setOutput
import javax.imageio.spi.ImageWriterSpi; //导入方法依赖的package包/类
/**
* 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;
}
示例3: setOutput
import javax.imageio.spi.ImageWriterSpi; //导入方法依赖的package包/类
/**
* 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;
}