de.trantor.util
Class StructureWriter

java.lang.Object
  |
  +--de.trantor.util.StructureWriter
Direct Known Subclasses:
XmlWriter

public abstract class StructureWriter
extends java.lang.Object

An abstract encapsulation of a writer that allows raw and cooked (escaped) writing and supports indent levels for structured writing.


Field Summary
 java.io.Writer writer
           
 
Constructor Summary
protected StructureWriter(java.io.Writer writer)
          Builds a new StructureWriter from the given Writer
 
Method Summary
 void close()
          closes the underlying writer
 void decIndentLevel()
          decreases the indent level.
 void flush()
          flushes the underlying writer
 java.io.Writer getWriter()
          returns the underlying Writer
 void incIndentLevel()
          increments the indent level
 void printIndent()
          prints a newline followed by indent spaces
abstract  void writeCooked(java.lang.String data)
           
 void writeRaw(java.lang.String data)
          writes the string to the writer directly without escaping special characters.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

writer

public java.io.Writer writer
Constructor Detail

StructureWriter

protected StructureWriter(java.io.Writer writer)
Builds a new StructureWriter from the given Writer
Method Detail

close

public void close()
           throws java.io.IOException
closes the underlying writer

decIndentLevel

public void decIndentLevel()
decreases the indent level.

flush

public void flush()
           throws java.io.IOException
flushes the underlying writer

getWriter

public java.io.Writer getWriter()
returns the underlying Writer

incIndentLevel

public void incIndentLevel()
increments the indent level

printIndent

public void printIndent()
                 throws java.io.IOException
prints a newline followed by indent spaces

writeRaw

public void writeRaw(java.lang.String data)
              throws java.io.IOException
writes the string to the writer directly without escaping special characters. Equivalent to getWriter.write (data)

writeCooked

public abstract void writeCooked(java.lang.String data)
                          throws java.io.IOException