y.io
Class ImageIoOutputHandler

java.lang.Object
  extended by y.io.IOHandler
      extended by y.io.ImageOutputHandler
          extended by y.io.ImageIoOutputHandler

public class ImageIoOutputHandler
extends ImageOutputHandler

This class serves as an adapter to the javax.imageio API which is available in J2RE version 1.4 and later. It can be used to adapt an ImageWriter to an ImageOutputHandler.

 

Constructor Summary
ImageIoOutputHandler(ImageWriter iWriter)
          Creates a new instance of ImageIoOutputHandler using the given ImageWriter.
 
Method Summary
protected  BufferedImage createImage(int width, int height)
          Creates the buffered image on which the graph will be rendered.
protected  void encode(BufferedImage image, OutputStream out)
          Encodes the given image to the given output stream.
 String getFileFormatString()
          Returns a descriptive string of the supported file format.
 String getFileNameExtension()
          Returns the file name extension of the supported file format.
 ImageWriteParam getImageWriteParam()
          Returns the current ImageWriteParam for the ImageWriter.
 ImageWriter getImageWriter()
          Returns the currently set ImageWriter instance.
 void setImageWriteParam(ImageWriteParam iwp)
          Sets the current ImageWriteParam for the ImageWriter.
 void setImageWriter(ImageWriter iWriter)
          Sets the new ImageWriter instance.
 
Methods inherited from class y.io.ImageOutputHandler
canRead, createDefaultGraph2DView, createGraphicsContext, isAntialiasingEnabled, read, setAntialiasingEnabled, write, write
 
Methods inherited from class y.io.IOHandler
canWrite, canWriteSubset, createObjectInputStream, createObjectOutputStream, hide, read, read, shouldSerialize, shouldSerialize, write, writeSubset, writeSubset
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ImageIoOutputHandler

public ImageIoOutputHandler(ImageWriter iWriter)
Creates a new instance of ImageIoOutputHandler using the given ImageWriter.

Method Detail

setImageWriter

public void setImageWriter(ImageWriter iWriter)
Sets the new ImageWriter instance. This call resets the current ImageWriteParam to the default of the given writer.

Parameters:
iWriter - the new writer - must not be null

getImageWriter

public ImageWriter getImageWriter()
Returns the currently set ImageWriter instance.


encode

protected void encode(BufferedImage image,
                      OutputStream out)
               throws IOException
Description copied from class: ImageOutputHandler
Encodes the given image to the given output stream.

Specified by:
encode in class ImageOutputHandler
Throws:
IOException

getFileNameExtension

public String getFileNameExtension()
Description copied from class: IOHandler
Returns the file name extension of the supported file format. The extension does not include the separating dot (i.e, '.').

Specified by:
getFileNameExtension in class IOHandler

getFileFormatString

public String getFileFormatString()
Description copied from class: IOHandler
Returns a descriptive string of the supported file format.

Specified by:
getFileFormatString in class IOHandler

createImage

protected BufferedImage createImage(int width,
                                    int height)
Description copied from class: ImageOutputHandler
Creates the buffered image on which the graph will be rendered.

Specified by:
createImage in class ImageOutputHandler

getImageWriteParam

public ImageWriteParam getImageWriteParam()
Returns the current ImageWriteParam for the ImageWriter.


setImageWriteParam

public void setImageWriteParam(ImageWriteParam iwp)
Sets the current ImageWriteParam for the ImageWriter.


© Copyright 2000-2008,
yWorks GmbH.
All rights reserved.