Class ImageWriterRegistry
- java.lang.Object
-
- org.apache.xmlgraphics.image.writer.ImageWriterRegistry
-
public final class ImageWriterRegistry extends java.lang.ObjectRegistry forImageWriterimplementations.
-
-
Constructor Summary
Constructors Constructor Description ImageWriterRegistry()Default constructor.ImageWriterRegistry(java.util.Properties preferredOrder)Special constructor.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static ImageWriterRegistrygetInstance()ImageWritergetWriterFor(java.lang.String mime)Returns an ImageWriter that can be used to encode an image to the requested MIME type.voidregister(ImageWriter writer)Registers a new ImageWriter implementation in the registry.voidregister(ImageWriter writer, int priority)Registers a new ImageWriter implementation with the associated priority in the registry.
-
-
-
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.- Parameters:
preferredOrder- the map of order properties used to order the plug-ins
-
-
Method Detail
-
getInstance
public static ImageWriterRegistry getInstance()
- Returns:
- a singleton instance of the ImageWriterRegistry.
-
register
public void register(ImageWriter writer, int priority)
Registers a new ImageWriter implementation with the associated priority in the registry. Higher priorities get preference over lower priorities.- Parameters:
writer- the ImageWriter instance to register.priority- the priority of the writer in the registry.- See Also:
register(ImageWriter)
-
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 placed in an array based on priority.- 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:
- a functional ImageWriter instance handling the desired output format or null if none can be found.
-
-