net.sourceforge.jeuclid
Class Converter

java.lang.Object
  extended by net.sourceforge.jeuclid.Converter

public final class Converter
extends Object

Utility class for conversion from MathML to other formats.

This class supports easy conversion from a MathML or ODF file to any supported output format.

Currently supported output formats:

Conversion is done through the Converter class in the new interface. This class will be deprecated some time after the 3.0 release. However, the new API is not to be considered stable yet, so please use these functions for the time being.

Version:
$Revision: 319 $
Author:
Max Berger

Field Summary
static String EXTENSION_SVG
          File extension for SVG.
static String TYPE_SVG
          Mime type for SVG.
 
Method Summary
static boolean convert(Document doc, File outFile, Map<ParameterKey,String> params)
          Converts an existing file from MathML or ODF to the given type.
static boolean convert(File inFile, File outFile, Map<ParameterKey,String> params)
          Converts an existing file from MathML or ODF to the given type.
static boolean convert(File inFile, File outFile, String outFileType)
          Converts an existing file from MathML or ODF to the given type.
static List<String> getAvailableOutfileTypes()
          Retrieve a list of available mime types for conversion.
static String getMimeTypeForSuffix(String suffix)
          Returns the MimeType for a given suffix.
static String getSuffixForMimeType(String mimeType)
          Returns the file suffix suitable for the given mime type.
static BufferedImage render(Document doc, Map<ParameterKey,String> params)
          Renders a document into an image.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

TYPE_SVG

public static final String TYPE_SVG
Mime type for SVG.

See Also:
Constant Field Values

EXTENSION_SVG

public static final String EXTENSION_SVG
File extension for SVG.

See Also:
Constant Field Values
Method Detail

convert

public static boolean convert(File inFile,
                              File outFile,
                              String outFileType)
                       throws IOException
Converts an existing file from MathML or ODF to the given type.

Parameters:
inFile - input file.
outFile - output file.
outFileType - mimetype for the output file.
Returns:
true if the conversion was successful.
Throws:
IOException - if an I/O error occurred during read or write.

render

public static BufferedImage render(Document doc,
                                   Map<ParameterKey,String> params)
                            throws SAXException,
                                   IOException
Renders a document into an image.

Parameters:
doc - DOM MathML document
params - parameters
Returns:
the rendered image
Throws:
SAXException - if an error occurs reading the DOM document
IOException - if an I/O error occurred.

convert

public static boolean convert(File inFile,
                              File outFile,
                              Map<ParameterKey,String> params)
                       throws IOException
Converts an existing file from MathML or ODF to the given type.

Parameters:
inFile - input file.
outFile - output file.
params - rendering parameters.
Returns:
true if the conversion was successful.
Throws:
IOException - if an I/O error occurred during read or write.

convert

public static boolean convert(Document doc,
                              File outFile,
                              Map<ParameterKey,String> params)
                       throws IOException
Converts an existing file from MathML or ODF to the given type.

Parameters:
doc - input document.
outFile - output file.
params - parameter set to use for conversion.
Returns:
true if the conversion was successful.
Throws:
IOException - if an I/O error occurred during read or write.

getAvailableOutfileTypes

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

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

getSuffixForMimeType

public static 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().
Returns:
the three letter suffix common for this type.

getMimeTypeForSuffix

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

Parameters:
suffix - the suffix, e.g. png
Returns:
the mime-type


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