Package jminusminus
Class PrettyPrinter
java.lang.Object
jminusminus.PrettyPrinter
A utility class that allows pretty (indented) printing to standard output.
-
Constructor Summary
ConstructorDescriptionConstructs a pretty printer with an indentation width of 2.PrettyPrinter
(int indentWidth) Constructs a pretty printer. -
Method Summary
Modifier and TypeMethodDescriptionvoid
Indents left.void
Indents right.void
Prints the specified string to standard output.void
Prints args to standard output according to the specified format.void
println()
Prints an empty line to standard output.void
Prints the specified string (followed by a newline) to standard output.
-
Constructor Details
-
PrettyPrinter
public PrettyPrinter()Constructs a pretty printer with an indentation width of 2. -
PrettyPrinter
public PrettyPrinter(int indentWidth) Constructs a pretty printer.- Parameters:
indentWidth
- number of blank spaces for an indent.
-
-
Method Details
-
indentRight
public void indentRight()Indents right. -
indentLeft
public void indentLeft()Indents left. -
println
public void println()Prints an empty line to standard output. -
println
Prints the specified string (followed by a newline) to standard output.- Parameters:
s
- string to print.
-
print
Prints the specified string to standard output.- Parameters:
s
- string to print.
-
printf
Prints args to standard output according to the specified format.- Parameters:
format
- format specifier.args
- values to print.
-