本文整理汇总了Java中javax.imageio.spi.ImageOutputStreamSpi类的典型用法代码示例。如果您正苦于以下问题:Java ImageOutputStreamSpi类的具体用法?Java ImageOutputStreamSpi怎么用?Java ImageOutputStreamSpi使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ImageOutputStreamSpi类属于javax.imageio.spi包,在下文中一共展示了ImageOutputStreamSpi类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: main
import javax.imageio.spi.ImageOutputStreamSpi; //导入依赖的package包/类
public static void main(String[] args) throws IOException,
MalformedURLException {
/* deregister ImageOutputStreamSpi so that we creatImageOutputStream
* returns null while writing.
*/
localRegistry.deregisterAll(ImageOutputStreamSpi.class);
/* verify possible ImageIO.write() scenario's for null stream output
* from createImageOutputStream() API in ImageIO class.
*/
verifyFileWrite();
verifyStreamWrite();
/* deregister ImageInputStreamSpi so that we creatImageInputStream
* returns null while reading.
*/
localRegistry.deregisterAll(ImageInputStreamSpi.class);
/* verify possible ImageIO.read() scenario's for null stream output
* from createImageInputStream API in ImageIO class.
*/
verifyFileRead();
verifyStreamRead();
verifyUrlRead();
}
示例2: createImageOutputStream
import javax.imageio.spi.ImageOutputStreamSpi; //导入依赖的package包/类
/**
* Create an image output stream from the given object. The
* collection of ImageOutputStreamSpis registered with the
* IIORegistry is searched for an image output stream that can send
* output to the given object. null is returned if no such SPI is
* registered.
*
* The image data will be cached in the current cache directory if
* caching is enabled.
*
* @param output an object to which to write image data
*
* @return an ImageOutputStream that can send data to output, or
* null
*
* @exception IllegalArgumentException if output is null
* @exception IOException if caching is required but not enabled
*/
public static ImageOutputStream createImageOutputStream (Object output)
throws IOException
{
if (output == null)
throw new IllegalArgumentException ("null argument");
Iterator spis = getRegistry().getServiceProviders
(ImageOutputStreamSpi.class, true);
ImageOutputStreamSpi foundSpi = null;
while(spis.hasNext())
{
ImageOutputStreamSpi spi = (ImageOutputStreamSpi) spis.next();
if (output.getClass().equals(spi.getOutputClass()))
{
foundSpi = spi;
break;
}
}
return foundSpi == null ? null :
foundSpi.createOutputStreamInstance (output,
getUseCache(),
getCacheDirectory());
}
示例3: createImageOutputStream
import javax.imageio.spi.ImageOutputStreamSpi; //导入依赖的package包/类
/**
* Create an image output stream from the given object. The
* collection of ImageOutputStreamSpis registered with the
* IIORegistry is searched for an image output stream that can send
* output to the given object. null is returned if no such SPI is
* registered.
*
* The image data will be cached in the current cache directory if
* caching is enabled.
*
* @param output an object to which to write image data
*
* @return an ImageOutputStream that can send data to output, or
* null
*
* @exception IllegalArgumentException if output is null
* @exception IOException if caching is required but not enabled
*/
public static ImageOutputStream createImageOutputStream (Object output)
throws IOException
{
if (output == null)
throw new IllegalArgumentException ("null argument");
Iterator spis = getRegistry().getServiceProviders
(ImageOutputStreamSpi.class, true);
ImageOutputStreamSpi foundSpi = null;
while(spis.hasNext())
{
ImageOutputStreamSpi spi = (ImageOutputStreamSpi) spis.next();
if (output.getClass().equals(spi.getOutputClass()))
{
foundSpi = spi;
break;
}
}
return foundSpi == null ? null :
foundSpi.createOutputStreamInstance (output,
getUseCache(),
getCacheDirectory());
}