package jas.util; import java.io.PrintWriter; import java.io.Writer; /** * A PrintWriter that keeps track of an indentation level * and indents the output appropriately. * * Warning: Only print and println methods taking strings have been overriden, * print, println methods taking other arguments may not be indented properly. */ public class IndentPrintWriter extends PrintWriter { public IndentPrintWriter(Writer w) { super(w); } public void println(String s) { if (!indented) doIndent(); super.println(s); indented = false; } public void print(String s) { if (!indented) doIndent(); super.print(s); } public void println() { super.println(); indented = false; } private void doIndent() { for (int i=0; i