Dresden OCL Toolkit

tudresden.ocl.injection.reverseeng
Class IndentAwareWriter

java.lang.Object
  extended byjava.io.Writer
      extended byjava.io.FilterWriter
          extended bytudresden.ocl.injection.reverseeng.IndentAwareWriter

public class IndentAwareWriter
extends FilterWriter

A writer that is aware of the current indent level. The indent level is defined as the number of consecutive spaces/tabs since the last \n.

Version:
0.1
Author:
sz9 (Steffen Zschaler)

Field Summary
private  boolean m_fCollectIndent
          true if indent should be accumulated (i.e., after \n until the first character different from ' ' and \n)
private  int m_nCurrentIndent
          Current indent level.
private  int m_nLastIndent
          Indent found before last \n.
 
Fields inherited from class java.io.FilterWriter
out
 
Fields inherited from class java.io.Writer
lock
 
Constructor Summary
IndentAwareWriter(Writer wSource)
          Creates new IndentAwareWriter
 
Method Summary
 int getCurrentIndent()
           
 int getLastIndent()
           
private  void resetIndent()
           
 void write(char[] cbuf, int off, int len)
           
 void write(int c)
           
 void write(String s, int off, int len)
           
 
Methods inherited from class java.io.FilterWriter
close, flush
 
Methods inherited from class java.io.Writer
write, write
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

m_nCurrentIndent

private int m_nCurrentIndent
Current indent level.


m_nLastIndent

private int m_nLastIndent
Indent found before last \n.


m_fCollectIndent

private boolean m_fCollectIndent
true if indent should be accumulated (i.e., after \n until the first character different from ' ' and \n)

Constructor Detail

IndentAwareWriter

public IndentAwareWriter(Writer wSource)
Creates new IndentAwareWriter

Method Detail

write

public void write(int c)
           throws IOException
Throws:
IOException

write

public void write(String s,
                  int off,
                  int len)
           throws IOException
Throws:
IOException

write

public void write(char[] cbuf,
                  int off,
                  int len)
           throws IOException
Throws:
IOException

resetIndent

private void resetIndent()

getCurrentIndent

public int getCurrentIndent()

getLastIndent

public int getLastIndent()

Dresden OCL Toolkit

Submit a bug
Developed at the Dresden University of Technology.
This software is published under the GNU Lesser General Public License.