Class DotExecutableUtils


  • public final class DotExecutableUtils
    extends java.lang.Object
    Class for drawing dot graphs by calling the dot executable.
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static java.lang.String[] executeDot​(java.io.File dotExecutablePath, boolean invertYAxis, java.io.File dotInputFile, java.io.File outputFile, java.lang.String outputFormat)
      Calls the Graphviz 'dot' executable with the given arguments.
      static java.lang.String[] getSupportedExportFormats​(java.lang.String dotExecutable)  
      static java.io.File renderImage​(java.io.File dotExecutablePath, java.io.File dotInputFile, java.lang.String format, java.io.File outputFile, java.lang.String[] outputs)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • renderImage

        public static java.io.File renderImage​(java.io.File dotExecutablePath,
                                               java.io.File dotInputFile,
                                               java.lang.String format,
                                               java.io.File outputFile,
                                               java.lang.String[] outputs)
        Parameters:
        dotExecutablePath - The path of the local Graphviz 'dot' executable, e.g. "C:\\Program Files (x86)\\Graphviz2.38\\bin\\dot.exe"
        dotInputFile - The DOT content to render
        format - The image format to export the graph to (e.g. 'pdf' or 'png')
        outputFile - The output file or null if the input file name and location should be used (where only the file extension is changed dependent on the format)
        outputs - A String array with two Strings, where the first contains the output of the input stream and the second contains the output of the error stream.
        Returns:
        The image file generated by rendering the dotInputFile with Graphviz, using the specified format
      • executeDot

        public static java.lang.String[] executeDot​(java.io.File dotExecutablePath,
                                                    boolean invertYAxis,
                                                    java.io.File dotInputFile,
                                                    java.io.File outputFile,
                                                    java.lang.String outputFormat)
        Calls the Graphviz 'dot' executable with the given arguments.
        Parameters:
        dotExecutablePath - The path of the local Graphviz 'dot' executable, e.g. "C:\\Program Files (x86)\\Graphviz2.38\\bin\\dot.exe"
        invertYAxis - Whether to invert the y-axis or not.
        dotInputFile - The input file to pass to 'dot'.
        outputFile - The output file to pass to 'dot' via the -o option. May be null.
        outputFormat - The output format to pass to 'dot' via the -T option. May be null.
        Returns:
        A String array with two Strings, where the first contains the output of the input stream and the second contains the output of the error stream.
      • getSupportedExportFormats

        public static java.lang.String[] getSupportedExportFormats​(java.lang.String dotExecutable)
        Parameters:
        dotExecutable - path to the dot executable
        Returns:
        String array of the supported export formats