org.freehep.util.io
Class IndentPrintWriter

java.lang.Object
  extended by java.io.Writer
      extended by java.io.PrintWriter
          extended by org.freehep.util.io.IndentPrintWriter
All Implemented Interfaces:
Closeable, Flushable, Appendable

public class IndentPrintWriter
extends PrintWriter

A PrintWriter that keeps track of an indentation level and indents the output appropriately.

Version:
$Id: IndentPrintWriter.java 8584 2006-08-10 23:06:37Z duns $
Author:
Tony Johnson, Mark Donszelmann

Field Summary
 
Fields inherited from class java.io.PrintWriter
out
 
Fields inherited from class java.io.Writer
lock
 
Constructor Summary
IndentPrintWriter(Writer w)
          Creates an Indent PrintWriter with indentation level 0.
IndentPrintWriter(Writer w, int level)
          Creates an Indent PrintWriter.
 
Method Summary
 int getIndent()
          Return the current indent count
 String getIndentString()
          Return the current indentString
 void indent()
          Increase the indentation
 void outdent()
          Decrease the indentation
 void print(boolean s)
           
 void print(char s)
           
 void print(char[] s)
           
 void print(double s)
           
 void print(float s)
           
 void print(int s)
           
 void print(long s)
           
 void print(Object s)
           
 void print(String s)
           
 void println()
           
 void setIndent(int level)
          Set the current indent count
 void setIndentString(String indentString)
          Set the current indentString.
 
Methods inherited from class java.io.PrintWriter
append, append, append, append, append, append, append, append, append, checkError, close, flush, format, format, printf, printf, 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

IndentPrintWriter

public IndentPrintWriter(Writer w,
                         int level)
Creates an Indent PrintWriter.

Parameters:
w - writer to write to
level - starting indentation level

IndentPrintWriter

public IndentPrintWriter(Writer w)
Creates an Indent PrintWriter with indentation level 0.

Parameters:
w - writer to write to
Method Detail

print

public void print(boolean s)
Overrides:
print in class PrintWriter

print

public void print(char s)
Overrides:
print in class PrintWriter

print

public void print(char[] s)
Overrides:
print in class PrintWriter

print

public void print(double s)
Overrides:
print in class PrintWriter

print

public void print(float s)
Overrides:
print in class PrintWriter

print

public void print(int s)
Overrides:
print in class PrintWriter

print

public void print(long s)
Overrides:
print in class PrintWriter

print

public void print(Object s)
Overrides:
print in class PrintWriter

print

public void print(String s)
Overrides:
print in class PrintWriter

println

public void println()
Overrides:
println in class PrintWriter

indent

public void indent()
Increase the indentation


outdent

public void outdent()
Decrease the indentation


getIndent

public int getIndent()
Return the current indent count

Returns:
current indentation level

setIndent

public void setIndent(int level)
Set the current indent count

Parameters:
level - new level

getIndentString

public String getIndentString()
Return the current indentString

Returns:
indent string
See Also:
setIndentString(String)

setIndentString

public void setIndentString(String indentString)
Set the current indentString. Default is a single tab per indent level.

Parameters:
indentString - The characters to prefix each line with (repeated for each indent level)


Copyright © 2000-2007 FreeHEP. All Rights Reserved.