net.ranides.assira.io
Class IndentWriter

java.lang.Object
  extended by java.io.Writer
      extended by net.ranides.assira.io.IndentWriter
All Implemented Interfaces:
Closeable, Flushable, Appendable

public class IndentWriter
extends Writer

Writer, który dodaje do Writera dodatkową funkcjonalność ułatwiającą generowanie tekstu z wcięciami. Wcięcia mogą być zagnieżdżane. Uwaga: writer współpracuje z unixowymi znakami nowej linii, nie zachowuje się w sposób zależny od platformy.

Author:
ranides

Constructor Summary
IndentWriter(Appendable delegator)
          Tworzy nowy writer generujący wynik do podanego delegatora.
 
Method Summary
 void close()
           
 void flush()
           
 int getIndentation()
          Zwraca głębokość wcięcia.
 void indent()
          Zwiększa wcięcie tekstu o jeden poziom.
 void outdent()
          Zmniejsza wcięcie tekstu o jeden poziom.
 void setIndentation(int indentation)
          Ustawia poziom wcięcia tekstu na konkretną wartość.
 void write(char[] cbuf)
           
 void write(char[] cbuf, int off, int len)
           
 void write(int chr)
           
 void write(String str)
           
 void write(String str, int off, int len)
           
 
Methods inherited from class java.io.Writer
append, append, append
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

IndentWriter

public IndentWriter(Appendable delegator)
Tworzy nowy writer generujący wynik do podanego delegatora.

Parameters:
delegator -
Method Detail

indent

public void indent()
Zwiększa wcięcie tekstu o jeden poziom.


outdent

public void outdent()
Zmniejsza wcięcie tekstu o jeden poziom.


getIndentation

public int getIndentation()
Zwraca głębokość wcięcia.

Returns:

setIndentation

public void setIndentation(int indentation)
Ustawia poziom wcięcia tekstu na konkretną wartość.

Parameters:
indentation -

close

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

flush

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

write

public void write(char[] cbuf)
           throws IOException
Overrides:
write in class Writer
Throws:
IOException

write

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

write

public void write(String str)
           throws IOException
Overrides:
write in class Writer
Throws:
IOException

write

public void write(String str,
                  int off,
                  int len)
           throws IOException
Overrides:
write in class Writer
Throws:
IOException

write

public void write(int chr)
           throws IOException
Overrides:
write in class Writer
Throws:
IOException


Copyright © 2013. All Rights Reserved.