public class IndentingWriter extends PrintWriter
out| Constructor and Description |
|---|
IndentingWriter(Writer writer, int cSpaces)
Construct an IndentingWriter that indents a certain number of spaces.
|
IndentingWriter(Writer writer, String sIndent)
Construct an IndentingWriter that indents using an indention string.
|
| Modifier and Type | Method and Description |
|---|---|
void |
println()
Terminate the current line by writing the line separator string.
|
void |
resume()
Resumes indentation.
|
void |
suspend()
Suspends indentation.
|
void |
write(char[] cbuf, int off, int len)
Write a portion of an array of characters.
|
void |
write(int c)
Write a single character.
|
void |
write(String str)
Write a string.
|
void |
write(String str, int off, int len)
Write a portion of a string.
|
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, writepublic IndentingWriter(Writer writer, int cSpaces)
writer - the underlying writer to write tocSpaces - the number of spaces to indent each line withpublic void write(int c)
Subclasses that intend to support efficient single-character output should override this method.
write in class PrintWriterc - int specifying a character to be written.
public void write(char[] cbuf,
int off,
int len)
write in class PrintWritercbuf - Array of charactersoff - Offset from which to start writing characterslen - Number of characters to writepublic void write(String str)
write in class PrintWriterstr - String to be writtenpublic void write(String str, int off, int len)
write in class PrintWriterstr - A Stringoff - Offset from which to start writing characterslen - Number of characters to writepublic void println()
line.separator, and is not necessarily a single newline character ('\n').println in class PrintWriterpublic void suspend()
public void resume()