visualization/visualization-spi-dot/src/main/java/se/jguru/nazgul/tools/visualization/spi/dot/DotDiagramValidator.java
public static DotParser.GraphContext validate(final InputStream dotDiagramData) throws DotDiagramSyntaxException {

        // Check sanity
        if (dotDiagramData == null) {
            throw new IllegalArgumentException("Cannot handle null 'dotDiagramData' argument.");
        }

        // Create the parser
        final DotLexer lexer = createLexer(dotDiagramData);
        final DotParser parser = createParser(lexer);

        // Ensure we can harvest all syntax errors.
        final DotSyntaxErrorListener errorListener = new DotSyntaxErrorListener();
        parser.addErrorListener(errorListener);

        final DotParser.GraphContext toReturn = parser.graph();

        // Check sanity
        if (errorListener.isErrorState()) {
            throw new DotDiagramSyntaxException(errorListener.getErrorDataList());
        }

        // All Done.
        return toReturn;
    }
public static DotParser.GraphContext validate(final InputStream dotDiagramData) throws DotDiagramSyntaxException {

        // Check sanity
        if (dotDiagramData == null) {
            throw new IllegalArgumentException("Cannot handle null 'dotDiagramData' argument.");
        }

        // Create the parser
        final DotLexer lexer = createLexer(dotDiagramData);
        final DotParser parser = createParser(lexer);

        // Ensure we can harvest all syntax errors.
        final DotSyntaxErrorListener errorListener = new DotSyntaxErrorListener();
        parser.addErrorListener(errorListener);

        final DotParser.GraphContext toReturn = parser.graph();

        // Check sanity
        if (errorListener.isErrorState()) {
            throw new DotDiagramSyntaxException(errorListener.getErrorDataList());
        }

        // All Done.
        return toReturn;
    }
Validates that the supplied InputStream contains well-formed Graph data, complying to the
<a href="http://www.graphviz.org/content/dot-language">DOT language specification</a>. If the

@param dotDiagramData A non-null InputStream containing a Graph or DiGraph definition.
@return A {@link se.jguru.nazgul.tools.visualization.spi.dot.grammars.DotParser.GraphContext} containing the
parsed Graph from the parsed DOT data.
@throws DotDiagramSyntaxException if the supplied InputStream contained syntax errors.