to.etc.util
Class IndentWriter

java.lang.Object
  extended by java.io.Writer
      extended by to.etc.util.IndentWriter
All Implemented Interfaces:
java.io.Closeable, java.io.Flushable, java.lang.Appendable
Direct Known Subclasses:
XmlWriter

public class IndentWriter
extends java.io.Writer

Handles indented writing for dumps and the like.

Author:
Frits Jalvingh Created on May 3, 2004

Field Summary
 
Fields inherited from class java.io.Writer
lock
 
Constructor Summary
IndentWriter()
          Constructor
IndentWriter(java.io.Writer w)
           
IndentWriter(java.io.Writer w, boolean dontclose)
           
 
Method Summary
 void close()
           
 void dec()
           
 void flush()
           
 void forceNewline()
           
static IndentWriter getStdoutWriter()
           
 java.io.Writer getWriter()
           
 void inc()
           
 void indent()
          Output as many spaces as needed to reach the current indent level.
 void init(java.io.Writer w, int indentlevel)
           
 boolean isIndentEnabled()
           
 void print(java.lang.String s)
           
 void println()
           
 void println(java.lang.String s)
           
 void setInd(int i)
           
 void setIndentEnabled(boolean indentEnabled)
           
 void setSpacesPerIndent(int spi)
           
 void write(char[] buf, int off, int len)
           
 void write(java.lang.String str)
           
 void writeRaw(char[] buf, int off, int len)
           
 void writeRaw(java.lang.String s)
           
 void writeRaw(java.lang.String buf, int off, int len)
           
 
Methods inherited from class java.io.Writer
append, append, append, write, write, write
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

IndentWriter

public IndentWriter()
Constructor


IndentWriter

public IndentWriter(java.io.Writer w)

IndentWriter

public IndentWriter(java.io.Writer w,
                    boolean dontclose)
Method Detail

init

public void init(java.io.Writer w,
                 int indentlevel)

isIndentEnabled

public boolean isIndentEnabled()

setIndentEnabled

public void setIndentEnabled(boolean indentEnabled)

close

public void close()
           throws java.io.IOException
Specified by:
close in interface java.io.Closeable
Specified by:
close in class java.io.Writer
Throws:
java.io.IOException

flush

public void flush()
           throws java.io.IOException
Specified by:
flush in interface java.io.Flushable
Specified by:
flush in class java.io.Writer
Throws:
java.io.IOException

setInd

public void setInd(int i)

setSpacesPerIndent

public void setSpacesPerIndent(int spi)

writeRaw

public void writeRaw(java.lang.String s)
              throws java.io.IOException
Throws:
java.io.IOException

writeRaw

public void writeRaw(char[] buf,
                     int off,
                     int len)
              throws java.io.IOException
Throws:
java.io.IOException

writeRaw

public void writeRaw(java.lang.String buf,
                     int off,
                     int len)
              throws java.io.IOException
Throws:
java.io.IOException

indent

public void indent()
            throws java.io.IOException
Output as many spaces as needed to reach the current indent level.

Throws:
java.io.IOException

write

public void write(char[] buf,
                  int off,
                  int len)
           throws java.io.IOException
Specified by:
write in class java.io.Writer
Throws:
java.io.IOException

write

public void write(java.lang.String str)
           throws java.io.IOException
Overrides:
write in class java.io.Writer
Throws:
java.io.IOException

inc

public void inc()

dec

public void dec()

forceNewline

public void forceNewline()
                  throws java.io.IOException
Throws:
java.io.IOException

println

public void println()
             throws java.io.IOException
Throws:
java.io.IOException

print

public void print(java.lang.String s)
           throws java.io.IOException
Throws:
java.io.IOException

println

public void println(java.lang.String s)
             throws java.io.IOException
Throws:
java.io.IOException

getWriter

public java.io.Writer getWriter()

getStdoutWriter

public static IndentWriter getStdoutWriter()