xmlgraphics-commons 1.0

org.apache.xmlgraphics.image.writer
Class ImageWriterRegistry

java.lang.Object
  extended byorg.apache.xmlgraphics.image.writer.ImageWriterRegistry

public class ImageWriterRegistry
extends java.lang.Object

Registry for ImageWriter implementations. They are primarily registered through the "Service Provider" mechanism.

See Also:
Service

Constructor Summary
ImageWriterRegistry()
          Default constructor.
ImageWriterRegistry(java.util.Properties preferredOrder)
          Special constructor.
 
Method Summary
static ImageWriterRegistry getInstance()
           
 ImageWriter getWriterFor(java.lang.String mime)
          Returns an ImageWriter that can be used to encode an image to the requested MIME type.
 void register(ImageWriter writer)
          Registers a new ImageWriter implementation in the registry.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ImageWriterRegistry

public ImageWriterRegistry()
Default constructor. The default preferred order for the image writers is loaded from the resources.


ImageWriterRegistry

public ImageWriterRegistry(java.util.Properties preferredOrder)
Special constructor. The preferred order for the image writers can be specified as a Map (for example a Properties file). The entries of the Map consists of fully qualified class or package names as keys and integer numbers as values. Zero (0) is the default priority.

Method Detail

getInstance

public static ImageWriterRegistry getInstance()
Returns:
a singleton instance of the ImageWriterRegistry.

register

public void register(ImageWriter writer)
Registers a new ImageWriter implementation in the registry. If an ImageWriter for the same target MIME type has already been registered, it is overwritten with the new one.

Parameters:
writer - the ImageWriter instance to register.

getWriterFor

public ImageWriter getWriterFor(java.lang.String mime)
Returns an ImageWriter that can be used to encode an image to the requested MIME type.

Parameters:
mime - the MIME type of the desired output format
Returns:
an ImageWriter instance handling the desired output format or null if none can be found.

xmlgraphics-commons 1.0

Copyright 1999-2006 The Apache Software Foundation. All Rights Reserved.