public class IndentingPrintWriter extends PrintWriter
out
Constructor and Description |
---|
IndentingPrintWriter(OutputStream out,
Charset charset,
int indentSize)
Creates a new printer that sends all output to the specified stream.
|
IndentingPrintWriter(OutputStream out,
int indentSize)
Creates a new printer that sends all output to the specified stream.
|
IndentingPrintWriter(Writer writer,
int indentSize)
Creates a new printer that sends all output to the specified writer.
|
Modifier and Type | Method and Description |
---|---|
int |
getIndentLevel()
Gets the current level of indentation.
|
void |
indent()
Increases the current level of indentation by one.
|
void |
outdent()
Decreases the current level of indentation by one.
|
void |
println() |
void |
write(char[] buf,
int offs,
int len) |
void |
write(int ch) |
void |
write(String s,
int offs,
int len) |
append, append, append, checkError, clearError, close, flush, format, format, print, print, print, print, print, print, print, print, print, printf, printf, println, println, println, println, println, println, println, println, println, setError, write, write
public IndentingPrintWriter(Writer writer, int indentSize)
writer
- the writer to which printed output is writtenindentSize
- the number of spaces in a single level of indentationpublic IndentingPrintWriter(OutputStream out, int indentSize)
out
- the stream to which printed output is written using UTF8 for character encodingindentSize
- the number of spaces in a single level of indentationpublic IndentingPrintWriter(OutputStream out, Charset charset, int indentSize)
out
- the stream to which printed output is writtencharset
- the character set used to encode outputindentSize
- the number of spaces in a single level of indentationpublic void println()
println
in class PrintWriter
public void write(char[] buf, int offs, int len)
write
in class PrintWriter
public void write(int ch)
write
in class PrintWriter
public void write(String s, int offs, int len)
write
in class PrintWriter
public int getIndentLevel()
public void indent()
public void outdent()