com.approximatrix.charting
Class ChartEncoder

java.lang.Object
  extended by com.approximatrix.charting.ChartEncoder

public class ChartEncoder
extends java.lang.Object

The ChartEncoder class provides several static methods to encode charts to an OutputStream. It uses the Java Advanced Imaging Library which is part of the JDK 1.4 release. The list of supported Image Formats may vary depending on the actual release. Quoting from the current webpage as of 28.1.2002: "As of JAI-1.1.1, the latest public version of JAI, the image formats supported by these ancillary codec classes are: BMP, GIF (decoder only), FlashPix (decoder only), JPEG, PNG, PNM, and TIFF." For the actual list of supported image formats call getSupportedFormats().

Version:
1.0
Author:
mueller

Constructor Summary
ChartEncoder()
           
 
Method Summary
static void createEncodedImage(java.io.OutputStream os, Chart chart, java.lang.String format)
          Prints the encoded image to an output stream.
static void createGIF(java.io.OutputStream os, Chart chart)
          Deprecated. GIF encoding is no longer supported, use PNG instead
static void createJPEG(java.io.OutputStream os, Chart chart)
          Prints the JPEG encoded image to an output stream.
static void createPNG(java.io.OutputStream os, Chart chart)
          Prints the PNG encoded image to an output stream.
static java.lang.String[] getSupportedFormats()
          Returns a String array containing the informal format names for all supported image encodings.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ChartEncoder

public ChartEncoder()
Method Detail

createJPEG

public static void createJPEG(java.io.OutputStream os,
                              Chart chart)
                       throws EncodingException
Prints the JPEG encoded image to an output stream.

Parameters:
os - the OutputStream where the image will be printed to.
chart - the Chart which will be printed to the output stream
Throws:
EncodingException - if an error occurred accessing the Stream

createGIF

public static void createGIF(java.io.OutputStream os,
                             Chart chart)
                      throws EncodingException
Deprecated. GIF encoding is no longer supported, use PNG instead

Prints the GIF encoded image to an output stream.

Parameters:
os - the OutputStream where the image will be printed to.
chart - the Chart which will be printed to the output stream
Throws:
EncodingException - if an error occurred accessing the Stream

createPNG

public static void createPNG(java.io.OutputStream os,
                             Chart chart)
                      throws EncodingException
Prints the PNG encoded image to an output stream.

Parameters:
os - the OutputStream where the image will be printed to.
chart - the Chart which will be printed to the output stream
Throws:
EncodingException - if an error occurred accessing the Stream

createEncodedImage

public static void createEncodedImage(java.io.OutputStream os,
                                      Chart chart,
                                      java.lang.String format)
                               throws EncodingException
Prints the encoded image to an output stream.

Parameters:
os - the OutputStream where the image will be printed to.
chart - the Chart which will be printed to the output stream
format - the informal format name
Throws:
EncodingException - if an error occurred accessing the Stream

getSupportedFormats

public static java.lang.String[] getSupportedFormats()
Returns a String array containing the informal format names for all supported image encodings.