Class IndentingPrintWriter

All Implemented Interfaces:
Closeable, Flushable, Appendable, AutoCloseable

public class IndentingPrintWriter extends PrintWriter
PrintWriter implementation that will indent each new line with a specified number of whitespace characters. The writing itself can be delegated to any other Writer implementation.

Care was taken to ensure that not only lines ended by calls to PrintWriter.println() methods trigger indentation, but any other newline characters as well.

Sjoerd Talsma