Class Converter

java.lang.Object
net.sourceforge.jeuclid.converter.Converter

public final class Converter extends Object
Generic converter which uses the registry to do its conversions.
Version:
$Revision: fb73652dbc06 $
  • Field Details

  • Constructor Details

    • Converter

      protected Converter()
      Default constructor.
  • Method Details

    • getInstance

      public static Converter getInstance()
      Retrieve an instance of the converter singleton class.
      Returns:
      a Converter object.
    • getConverter

      @Deprecated public static Converter getConverter()
      Deprecated.
      use getInstance() instead.
      Returns:
      Converter instance
    • convert

      public Dimension 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:
      Dimension of converted image upon success, null otherwise
      Throws:
      IOException - if an I/O error occurred during read or write.
    • convert

      public Dimension convert(File inFile, File outFile, String outFileType, LayoutContext params) 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.
      params - rendering parameters.
      Returns:
      Dimension of converted image upon success, null otherwise
      Throws:
      IOException - if an I/O error occurred during read or write.
    • convert

      public Dimension convert(Node doc, File outFile, String outFileType, LayoutContext params) throws IOException
      Converts an existing document from MathML to the given type and store it in a file.
      Parameters:
      doc - input document. See
      invalid reference
      net.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:
      IOException - if an I/O error occurred during read or write.
    • convert

      public ConverterPlugin.DocumentWithDimension convert(Node doc, 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. See
      invalid reference
      net.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 Dimension convert(Node doc, OutputStream outStream, String outFileType, LayoutContext params) throws IOException
      Converts an existing file from MathML or ODF to the given type.
      Parameters:
      doc - input document. See
      invalid reference
      net.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:
      IOException - if an I/O error occurred during read or write.
    • render

      public BufferedImage render(Node node, LayoutContext context) throws IOException
      Renders a document into an image.
      Parameters:
      node - Document / Node to render
      context - LayoutContext to use.
      Returns:
      the rendered image
      Throws:
      IOException - if an I/O error occurred.
    • render

      public BufferedImage render(Node node, LayoutContext context, int imageType) throws IOException
      Renders a document into an image.
      Parameters:
      node - Document / Node to render
      context - LayoutContext to use.
      imageType - ImageType as defined by BufferedImage
      Returns:
      the rendered image
      Throws:
      IOException - if an I/O error occurred.