|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object
java.io.Writer
java.io.PrintWriter
oracle.idm.io.IndentPrintWriter
public class IndentPrintWriter
IndentPrintWriter is a convenience class for indented printing. It extends the PrintWriter, and simplifies printing of indented information, such as XML tags. You can construct the IndentPrintWriter from any OutputStream or any Writer. If OutputStream or Writer used to construct the IndentPrintWriter is already an instance of IndentPrintStream or IndentPrintWriter, both will share the same Indentater.
Here is an example of how to use IndentPrintWriter:
IndentPrintWriter out = new IndentPrintWriter(System.out); out.iprintln(...); out.increase(); foo.print(out); // foo will print at increased indentation level out.decrease(); out.iprintln(...);
Field Summary |
---|
Fields inherited from class java.io.PrintWriter |
---|
out |
Fields inherited from class java.io.Writer |
---|
lock |
Constructor Summary | |
---|---|
IndentPrintWriter(java.io.OutputStream out) Constructor for indent print writer from output stream. |
|
IndentPrintWriter(java.io.OutputStream out, boolean autoFlush) Constructor for indent print writer from output stream, given auto flush mode. |
|
IndentPrintWriter(java.io.Writer out) Constructor for indent print writer from writer. |
|
IndentPrintWriter(java.io.Writer out, boolean autoFlush) Constructor for indent print writer from writer, given auto flush mode. |
Method Summary | |
---|---|
void |
decrease() This method decreases indentation level. |
Indenter |
getIndenter() Getter for the indenter of this indent print writer. |
static IndentPrintWriter |
getIndentPrintWriter(java.io.Writer out) Factory method for indent print writers. |
void |
increase() This method increases indentation level. |
void |
indent() This method prints the indentation. |
void |
iprint(boolean b) Indents and prints a boolean. |
void |
iprint(char c) Indents and prints a char. |
void |
iprint(char[] s) Indents and prints a char[]. |
void |
iprint(double d) Indents and prints a double. |
void |
iprint(float f) Indents and prints a float. |
void |
iprint(int i) Indents and prints an int. |
void |
iprint(long l) Indents and prints a long. |
void |
iprint(java.lang.Object o) Indents and prints an object. |
void |
iprint(java.lang.String s) Indents and prints a string. |
void |
iprintln() Indents and terminates the line. |
void |
iprintln(boolean b) Indents, prints a boolean, and terminates the line. |
void |
iprintln(char c) Indents, prints a char, and terminates the line. |
void |
iprintln(char[] s) Indents, prints a char[], and terminates the line. |
void |
iprintln(double d) Indents, prints a double, and terminates the line. |
void |
iprintln(float f) Indents, prints a float, and terminates the line. |
void |
iprintln(int i) Indents, prints an int, and terminates the line. |
void |
iprintln(long l) Indents, prints a long, and terminates the line. |
void |
iprintln(java.lang.Object o) Indents, prints an object, and terminates the line. |
void |
iprintln(java.lang.String s) Indents, prints a string, and terminates the line. |
void |
setIndenter(Indenter indenter) Setter for the indenter of this indent print writer. |
Methods inherited from class java.io.PrintWriter |
---|
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, println, setError, write, write, write, write, write |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public IndentPrintWriter(java.io.OutputStream out)
public IndentPrintWriter(java.io.OutputStream out, boolean autoFlush)
public IndentPrintWriter(java.io.Writer out)
public IndentPrintWriter(java.io.Writer out, boolean autoFlush)
Method Detail |
---|
public static IndentPrintWriter getIndentPrintWriter(java.io.Writer out)
public Indenter getIndenter()
getIndenter
in interface Indentable
public void setIndenter(Indenter indenter)
setIndenter
in interface Indentable
public void increase()
increase
in interface Indentable
public void decrease()
decrease
in interface Indentable
public void indent()
indent
in interface Indentable
public void iprint(boolean b)
public void iprint(char c)
public void iprint(int i)
public void iprint(long l)
public void iprint(float f)
public void iprint(double d)
public void iprint(char[] s)
public void iprint(java.lang.String s)
public void iprint(java.lang.Object o)
public void iprintln()
public void iprintln(boolean b)
public void iprintln(char c)
public void iprintln(int i)
public void iprintln(long l)
public void iprintln(float f)
public void iprintln(double d)
public void iprintln(char[] s)
public void iprintln(java.lang.String s)
public void iprintln(java.lang.Object o)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |