jd.io
Class TabWriter

java.lang.Object
  extended byjava.io.Writer
      extended byjava.io.PrintWriter
          extended byjd.io.TabWriter
Direct Known Subclasses:
SourceWriter, XmlWriter

public class TabWriter
extends PrintWriter

A PrintWriter to write pretty indented files.


Field Summary
 
Fields inherited from class java.io.PrintWriter
out
 
Fields inherited from class java.io.Writer
lock
 
Constructor Summary
TabWriter(Writer out)
          Create a TabWriter.
TabWriter(Writer out, boolean autoFlush)
          Create a TabWriter.
TabWriter(Writer out, boolean autoFlush, int bufferSize)
          Create a new TabWriter.
 
Method Summary
 boolean checkError()
          Flush the stream and check its error state.
 void close()
          Close the stream.
 void decreaseTab()
          Decrease the tab.
 void flush()
          Flush the stream.
protected  int getBufferUsed()
           
 int getTabCount()
          Return the number of tabs.
 void increaseTab()
          Increase the tab.
 boolean newLineStarted()
           
 void print(char c)
           
 void println()
           
 void println(boolean x)
           
 void println(char x)
           
 void println(char[] x)
           
 void println(double x)
           
 void println(float x)
           
 void println(int x)
           
 void println(long x)
           
 void println(Object x)
           
 void println(String x)
           
protected  void resetBuffer()
           
protected  void setError()
          Indicate that an error has occurred.
 void setLineSeparator(String s)
          Set characters used to separate lines.
 void setTabChars(String chars)
          Set the string used for a tab.
 void write(char[] buf, int off, int len)
          Write a portion of an array of characters.
 void write(int c)
          Write a single character.
 void write(int c1, int c2)
          Write two characters.
 void write(String s)
          Write a string.
 void write(String s, int off, int length)
          Write a portion of a string.
protected  void writeNewLineTab()
           
 
Methods inherited from class java.io.PrintWriter
print, print, print, print, print, print, print, print, write
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TabWriter

public TabWriter(Writer out)
Create a TabWriter.

Parameters:
out - a Writer

TabWriter

public TabWriter(Writer out,
                 boolean autoFlush)
Create a TabWriter.

Parameters:
out - a Writer
autoFlush - - a boolean; if true, the println() methods will flush the output buffer

TabWriter

public TabWriter(Writer out,
                 boolean autoFlush,
                 int bufferSize)
Create a new TabWriter.

Parameters:
out - a Writer
autoFlush - - a boolean; if true, the println() methods will flush the output buffer
bufferSize - the size of the internal buffer
Method Detail

setTabChars

public void setTabChars(String chars)
Set the string used for a tab. The default is a tab character.


setLineSeparator

public void setLineSeparator(String s)
Set characters used to separate lines. The default is system dependent (e.g. "0xD0xA" on Windows).


increaseTab

public void increaseTab()
Increase the tab.


decreaseTab

public void decreaseTab()
Decrease the tab.


getTabCount

public int getTabCount()
Return the number of tabs.


writeNewLineTab

protected void writeNewLineTab()

newLineStarted

public boolean newLineStarted()

close

public void close()
Close the stream.


flush

public void flush()
Flush the stream.


checkError

public boolean checkError()
Flush the stream and check its error state. Errors are cumulative; once the stream encounters an error, this routine will return true on all successive calls.

Returns:
true if the print stream has encountered an error, either on the underlying output stream or during a format conversion.

setError

protected void setError()
Indicate that an error has occurred.


write

public void write(int c)
Write a single character.


write

public void write(int c1,
                  int c2)
Write two characters.


write

public void write(char[] buf,
                  int off,
                  int len)
Write a portion of an array of characters.


write

public void write(String s,
                  int off,
                  int length)
Write a portion of a string.


write

public void write(String s)
Write a string. This method cannot be inherited from the Writer class because it must suppress I/O exceptions.


print

public void print(char c)

println

public void println()

println

public void println(boolean x)

println

public void println(char x)

println

public void println(int x)

println

public void println(long x)

println

public void println(float x)

println

public void println(double x)

println

public void println(char[] x)

println

public void println(String x)

println

public void println(Object x)

resetBuffer

protected void resetBuffer()

getBufferUsed

protected int getBufferUsed()