Class Converter
- java.lang.Object
-
- net.sourceforge.jeuclid.converter.Converter
-
public final class Converter extends java.lang.ObjectGeneric converter which uses the registry to do its conversions.- Version:
- $Revision: fb73652dbc06 $
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringEXTENSION_SVGFile extension for SVG.static java.lang.StringTYPE_SVGMime type for SVG.
-
Constructor Summary
Constructors Modifier Constructor Description protectedConverter()Default constructor.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description java.awt.Dimensionconvert(java.io.File inFile, java.io.File outFile, java.lang.String outFileType)Converts an existing file from MathML or ODF to the given type.java.awt.Dimensionconvert(java.io.File inFile, java.io.File outFile, java.lang.String outFileType, LayoutContext params)Converts an existing file from MathML or ODF to the given type.java.awt.Dimensionconvert(org.w3c.dom.Node doc, java.io.File outFile, java.lang.String outFileType, LayoutContext params)Converts an existing document from MathML to the given type and store it in a file.java.awt.Dimensionconvert(org.w3c.dom.Node doc, java.io.OutputStream outStream, java.lang.String outFileType, LayoutContext params)Converts an existing file from MathML or ODF to the given type.ConverterPlugin.DocumentWithDimensionconvert(org.w3c.dom.Node doc, java.lang.String outFileType, LayoutContext params)Converts an existing document from MathML to the given XML based type and store it in a DOM document.static ConvertergetConverter()Deprecated.usegetInstance()instead.static ConvertergetInstance()Retrieve an instance of the converter singleton class.java.awt.image.BufferedImagerender(org.w3c.dom.Node node, LayoutContext context)Renders a document into an image.java.awt.image.BufferedImagerender(org.w3c.dom.Node node, LayoutContext context, int imageType)Renders a document into an image.
-
-
-
Field Detail
-
TYPE_SVG
public static final java.lang.String TYPE_SVG
Mime type for SVG.- See Also:
- Constant Field Values
-
EXTENSION_SVG
public static final java.lang.String EXTENSION_SVG
File extension for SVG.- See Also:
- Constant Field Values
-
-
Method Detail
-
getInstance
public static Converter getInstance()
Retrieve an instance of the converter singleton class.- Returns:
- a Converter object.
-
getConverter
@Deprecated public static Converter getConverter()
Deprecated.usegetInstance()instead.- Returns:
- Converter instance
-
convert
public java.awt.Dimension convert(java.io.File inFile, java.io.File outFile, java.lang.String outFileType) throws java.io.IOExceptionConverts 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:
- Dimension of converted image upon success, null otherwise
- Throws:
java.io.IOException- if an I/O error occurred during read or write.
-
convert
public java.awt.Dimension convert(java.io.File inFile, java.io.File outFile, java.lang.String outFileType, LayoutContext params) throws java.io.IOExceptionConverts an existing file from MathML or ODF to the given type.- Parameters:
inFile- input file.outFile- output file.outFileType- mimetype for the output file.params- rendering parameters.- Returns:
- Dimension of converted image upon success, null otherwise
- Throws:
java.io.IOException- if an I/O error occurred during read or write.
-
convert
public java.awt.Dimension convert(org.w3c.dom.Node doc, java.io.File outFile, java.lang.String outFileType, LayoutContext params) throws java.io.IOExceptionConverts an existing document from MathML to the given type and store it in a file.- Parameters:
doc- input document. Seenet.sourceforge.jeuclid.DOMBuilder#DOMBuilder(Node, MathBase)for the list of valid node types.outFile- output file.outFileType- mimetype for the output file.params- parameter set to use for conversion.- Returns:
- Dimension of converted image upon success, null otherwise
- Throws:
java.io.IOException- if an I/O error occurred during read or write.
-
convert
public ConverterPlugin.DocumentWithDimension convert(org.w3c.dom.Node doc, java.lang.String outFileType, LayoutContext params)
Converts an existing document from MathML to the given XML based type and store it in a DOM document.- Parameters:
doc- input document. Seenet.sourceforge.jeuclid.DOMBuilder#DOMBuilder(Node, MathBase)for the list of valid node types.outFileType- mimetype for the output file.params- parameter set to use for conversion.- Returns:
- an instance of Document, or the appropriate subtype for this format (e.g. SVGDocument). If conversion is not supported to this type, it may return null.
-
convert
public java.awt.Dimension convert(org.w3c.dom.Node doc, java.io.OutputStream outStream, java.lang.String outFileType, LayoutContext params) throws java.io.IOExceptionConverts an existing file from MathML or ODF to the given type.- Parameters:
doc- input document. Seenet.sourceforge.jeuclid.DOMBuilder#DOMBuilder(Node, MathBase)for the list of valid node types.outStream- output stream.outFileType- mimetype for the output file.params- parameter set to use for conversion.- Returns:
- Dimension of converted image upon success, null otherwise
- Throws:
java.io.IOException- if an I/O error occurred during read or write.
-
render
public java.awt.image.BufferedImage render(org.w3c.dom.Node node, LayoutContext context) throws java.io.IOExceptionRenders a document into an image.- Parameters:
node- Document / Node to rendercontext- LayoutContext to use.- Returns:
- the rendered image
- Throws:
java.io.IOException- if an I/O error occurred.
-
render
public java.awt.image.BufferedImage render(org.w3c.dom.Node node, LayoutContext context, int imageType) throws java.io.IOExceptionRenders a document into an image.- Parameters:
node- Document / Node to rendercontext- LayoutContext to use.imageType- ImageType as defined byBufferedImage- Returns:
- the rendered image
- Throws:
java.io.IOException- if an I/O error occurred.
-
-