Package net.emustudio.edigen.misc
Class PrettyPrinter
- java.lang.Object
-
- net.emustudio.edigen.misc.PrettyPrinter
-
public class PrettyPrinter extends java.lang.ObjectMinimalistic on-the-fly Java source code pretty-printer.The input must conform to some limitations, mainly:
- The "prettifier" provides only indentation. The input must already be split correctly into lines according to the standard Java source code style.
- Each block (like the body of an
iforwhilestatement) must be enclosed in brackets.
Example of a valid input:
if (something) { switch(a) { case 1: break; } } else { }This produces the output:
if (something) { switch(a) { case 1: break; } } else { }
-
-
Constructor Summary
Constructors Constructor Description PrettyPrinter(java.io.Writer output)Constructs the pretty printer.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidwrite(java.lang.String text)Writes text to the output stream as-is.voidwriteLine(java.lang.String text)Indents the line as necessary and writes it to the output stream.
-