Java 类javax.imageio.spi.ImageOutputStreamSpi 实例源码

项目:openjdk-jdk10    文件:NullStreamCheckTest.java   
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();
}
项目:openjdk9    文件:NullStreamCheckTest.java   
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();
}
项目:javify    文件:ImageIO.java   
/**
 * 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());
}
项目:jvm-stm    文件:ImageIO.java   
/**
  * 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());
 }
项目:JamVM-PH    文件:ImageIO.java   
/**
  * 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());
 }
项目:classpath    文件:ImageIO.java   
/**
 * 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());
}