net.sourceforge.jeuclid.converter
Class ConverterRegistry

java.lang.Object
  extended by net.sourceforge.jeuclid.converter.ConverterRegistry

public final class ConverterRegistry
extends Object

A registry for image converters.

Version:
$Revision: 5a7becda9147 $

Constructor Summary
protected ConverterRegistry()
          Default constructor.
 
Method Summary
 Set<String> getAvailableExtensions()
          Retrieve a list of all available extensions.
 Set<String> getAvailableOutfileTypes()
          Retrieve a list of available mime types for conversion.
 ConverterPlugin getConverter(String mimeType)
          Retrieve the converter for a given mime-type.
static ConverterRegistry getInstance()
          Retrieve the default registry instance.
 String getMimeTypeForSuffix(String suffix)
          Returns the MimeType for a given suffix.
static ConverterRegistry getRegisty()
          Deprecated. use getInstance() instead.
 String getSuffixForMimeType(String mimeType)
          Returns the file suffix suitable for the given mime type.
 void registerConverter(String mimeType, ConverterPlugin converter, boolean primary)
          Registers a converter for the given mime type.
 void registerMimeTypeAndSuffix(String mimeType, String suffix, boolean primary)
          Registers a new MimeType and it's suffix.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ConverterRegistry

protected ConverterRegistry()
Default constructor.

Method Detail

getInstance

public static ConverterRegistry getInstance()
Retrieve the default registry instance.

Returns:
the ConverterRegistry.

getRegisty

@Deprecated
public static ConverterRegistry getRegisty()
Deprecated. use getInstance() instead.

use getInstance() instead.

Returns:
see getInstance()

getAvailableOutfileTypes

public Set<String> getAvailableOutfileTypes()
Retrieve a list of available mime types for conversion.

Returns:
a Set<String> containing all valid mime-types.

getAvailableExtensions

public Set<String> getAvailableExtensions()
Retrieve a list of all available extensions.

Returns:
a list of available extensions.

getSuffixForMimeType

public String getSuffixForMimeType(String mimeType)
Returns the file suffix suitable for the given mime type.

This function is not fully implemented yet

Parameters:
mimeType - a mimetype, as returned by getAvailableOutfileTypes() , or null if unknown.
Returns:
the three letter suffix common for this type.

getMimeTypeForSuffix

public String getMimeTypeForSuffix(String suffix)
Returns the MimeType for a given suffix.

Parameters:
suffix - the suffix, e.g. png, or null if unknown.
Returns:
the mime-type

registerMimeTypeAndSuffix

public void registerMimeTypeAndSuffix(String mimeType,
                                      String suffix,
                                      boolean primary)
Registers a new MimeType and it's suffix.

Parameters:
mimeType - the Mime-Type
suffix - The Suffix
primary - If true, old mappings will be overwritten. If false and a mapping already exists, it will stay the same.

registerConverter

public void registerConverter(String mimeType,
                              ConverterPlugin converter,
                              boolean primary)
Registers a converter for the given mime type.

Parameters:
mimeType - The mime type.
converter - The converter to register.
primary - Converter for this type. If true, old mappings will be overwritten. If false and a mapping already exists, it will stay the same.

getConverter

public ConverterPlugin getConverter(String mimeType)
Retrieve the converter for a given mime-type.

Parameters:
mimeType - the Mime-Type.
Returns:
a Converter instance


Copyright © 2002-2010 The JEuclid project. All Rights Reserved.