public String draw(Object obj) { ByteArrayOutputStream ba = new ByteArrayOutputStream(); draw(obj, new PrintStream(ba)); return ba.toString(); }
public String draw(Object obj) { ByteArrayOutputStream ba = new ByteArrayOutputStream(); draw(obj, new PrintStream(ba)); return ba.toString(); }
public void draw(Object obj, String outfile, String options) throws IOException { String cmd = getGraphvizBinary() + " -o " + outfile + " " + options; draw(obj, cmd); }
public void draw(Object obj, String outfile, String options) throws IOException { String cmd = getGraphvizBinary() + " -o " + outfile + " " + options; draw(obj, cmd); }
public void draw(Object obj, String cmd) throws IOException { log.info("Running '" + cmd + "' in '" + new File(".").getCanonicalPath() + "'"); Process p = Runtime.getRuntime().exec(cmd); PrintStream ps = new PrintStream(p.getOutputStream()); BufferedInputStream in = new BufferedInputStream(p.getInputStream()); BufferedInputStream err = new BufferedInputStream(p.getErrorStream()); draw(obj, ps); ps.close(); int b; ByteArrayOutputStream oerr = new ByteArrayOutputStream(); ByteArrayOutputStream out = new ByteArrayOutputStream(); while ((b = err.read()) >= 0) oerr.write(b); while ((b = in.read()) >= 0) out.write(b); if (oerr.size() > 0) log.info("Graphviz output to stderr: \n" + oerr.toString()); if (out.size() > 0) log.info("Graphviz output to stdout: \n" + out.toString()); }
public void draw(Object obj, String cmd) throws IOException { log.info("Running '" + cmd + "' in '" + new File(".").getCanonicalPath() + "'"); Process p = Runtime.getRuntime().exec(cmd); PrintStream ps = new PrintStream(p.getOutputStream()); BufferedInputStream in = new BufferedInputStream(p.getInputStream()); BufferedInputStream err = new BufferedInputStream(p.getErrorStream()); draw(obj, ps); ps.close(); int b; ByteArrayOutputStream oerr = new ByteArrayOutputStream(); ByteArrayOutputStream out = new ByteArrayOutputStream(); while ((b = err.read()) >= 0) oerr.write(b); while ((b = in.read()) >= 0) out.write(b); if (oerr.size() > 0) log.info("Graphviz output to stderr: \n" + oerr.toString()); if (out.size() > 0) log.info("Graphviz output to stdout: \n" + out.toString()); }
private String drawSafe(final GraphvizDotBuilder builder, final Object graph) { String _xtrycatchfinallyexpression = null; try { _xtrycatchfinallyexpression = builder.draw(graph); } catch (final Throwable _t) { if (_t instanceof Exception) { final Exception e = (Exception)_t; InputOutput.<String>println("Error rendering"); e.printStackTrace(); return Throwables.getStackTraceAsString(e); } else { throw Exceptions.sneakyThrow(_t); } } return _xtrycatchfinallyexpression; }