public String prettyPrint() { StringWriter sw = new StringWriter(); try { writeTo(sw); } catch (IOException e) { throw new GroovyRuntimeException(e); } return sw.toString(); }