Copyright 2002 by aragost

com.aragost.io
Class IndentableWriter

java.lang.Object
  |
  +--java.io.Writer
        |
        +--java.io.PrintWriter
              |
              +--com.aragost.io.IndentableWriter
Direct Known Subclasses:
HtmlWriter

public class IndentableWriter
extends java.io.PrintWriter

See Also:
PrintWriter

Field Summary
static java.lang.String DEFAULT_INDENTION_STRING
           
 
Fields inherited from class java.io.PrintWriter
out
 
Fields inherited from class java.io.Writer
lock
 
Constructor Summary
IndentableWriter(java.io.OutputStream out)
          Create a new IndentableWriter, without automatic line flushing, from an existing OutputStream.
IndentableWriter(java.io.OutputStream out, boolean autoFlush)
          Create a new IndentableWriter from an existing OutputStream.
IndentableWriter(java.io.Writer out)
          Create a new IndentableWriter
IndentableWriter(java.io.Writer out, boolean autoFlush)
          Create a new IndentableWriter.
 
Method Summary
 void doIndent()
          Write indention.
 void dontIndent()
          Don't write indention until doIndent() is called.
 java.lang.String getIndentionString()
          Getter for property indentionString.
 void indent()
          Increase the indention
 void outdent()
          Decrease the indention level
 void println()
           
 void setIndentionString(java.lang.String indentionString)
          Setter for property indentionString.
 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(java.lang.String s, int off, int len)
          Write a portion of a String.
 
Methods inherited from class java.io.PrintWriter
checkError, close, flush, print, print, print, print, print, print, print, print, print, println, println, println, println, println, println, println, println, println, setError, write, write
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_INDENTION_STRING

public static final java.lang.String DEFAULT_INDENTION_STRING
See Also:
Constant Field Values
Constructor Detail

IndentableWriter

public IndentableWriter(java.io.Writer out)
Create a new IndentableWriter


IndentableWriter

public IndentableWriter(java.io.Writer out,
                        boolean autoFlush)
Create a new IndentableWriter.

Parameters:
out - A Writer
autoFlush - A boolean; if true, the println() methods will flush the output buffer

IndentableWriter

public IndentableWriter(java.io.OutputStream out)
Create a new IndentableWriter, without automatic line flushing, from an existing OutputStream. This convenience constructor creates the necessary intermediate OutputStreamWriter, which will convert characters into bytes using the default character encoding.

Parameters:
out - An output stream
See Also:
OutputStreamWriter.OutputStreamWriter(java.io.OutputStream)

IndentableWriter

public IndentableWriter(java.io.OutputStream out,
                        boolean autoFlush)
Create a new IndentableWriter from an existing OutputStream. This convenience constructor creates the necessary intermediate OutputStreamWriter, which will convert characters into bytes using the default character encoding.

Parameters:
out - An output stream
autoFlush - A boolean; if true, the println() methods will flush the output buffer
See Also:
OutputStreamWriter.OutputStreamWriter(java.io.OutputStream)
Method Detail

write

public void write(int c)
Write a single character

Overrides:
write in class java.io.PrintWriter
Parameters:
c - The character to write

write

public void write(char[] cbuf,
                  int off,
                  int len)
Write a portion of an array of characters.

Overrides:
write in class java.io.PrintWriter
Parameters:
cbuf - Array of characters
off - Offset from which to start writing characters
len - Number of characters to write

write

public void write(java.lang.String s,
                  int off,
                  int len)
Write a portion of a String.

Overrides:
write in class java.io.PrintWriter
Parameters:
s - String
off - Offset from which to start writing characters
len - Number of characters to write

println

public void println()
Overrides:
println in class java.io.PrintWriter

indent

public void indent()
Increase the indention


outdent

public void outdent()
Decrease the indention level


dontIndent

public void dontIndent()
Don't write indention until doIndent() is called. This is useful if you want to print a literal String spanning multiple lines.


doIndent

public void doIndent()
Write indention.


getIndentionString

public java.lang.String getIndentionString()
Getter for property indentionString.

Returns:
Value of property indentionString.

setIndentionString

public void setIndentionString(java.lang.String indentionString)
Setter for property indentionString.

Parameters:
indentionString - New value of property indentionString.

Copyright 2002 by aragost