CoherenceTM v3.3
Copyright© 2000-2007 by Oracle Corporation

com.tangosol.io
Class IndentingWriter

java.lang.Object
  extended by java.io.Writer
      extended by java.io.PrintWriter
          extended by com.tangosol.io.IndentingWriter
All Implemented Interfaces:
Closeable, Flushable, Appendable

public class IndentingWriter
extends PrintWriter

An IndentingWriter is used to indent line-based output to an underlying Writer.

Author:
cp 2000.10.17

Field Summary
 
Fields inherited from class java.io.PrintWriter
out
 
Fields inherited from class java.io.Writer
lock
 
Constructor Summary
IndentingWriter(Writer writer, int cSpaces)
          Construct an IndentingWriter that indents a certain number of spaces.
IndentingWriter(Writer writer, String sIndent)
          Construct an IndentingWriter that indents using an indention string.
 
Method Summary
 void println()
          Terminate the current line by writing the line separator string.
 void resume()
          Resumes indentation.
 void suspend()
          Suspends indentation.
 void write(char[] cbuf, int off, int len)
          Write a portion of an array of characters.
 void write(int c)
          Write a single character.
 void write(String str)
          Write a string.
 void write(String str, int off, int len)
          Write a portion of a string.
 
Methods inherited from class java.io.PrintWriter
append, append, append, append, append, append, append, append, append, checkError, close, flush, format, format, print, print, print, print, print, print, print, print, print, printf, printf, println, println, println, println, println, println, println, println, println, setError, write
 

Constructor Detail

IndentingWriter

public IndentingWriter(Writer writer,
                       int cSpaces)
Construct an IndentingWriter that indents a certain number of spaces.

Parameters:
writer - the underlying writer to write to
cSpaces - the number of spaces to indent each line with

IndentingWriter

public IndentingWriter(Writer writer,
                       String sIndent)
Construct an IndentingWriter that indents using an indention string.

Parameters:
writer - the underlying writer to write to
sIndent - the String value to indent each line with
Method Detail

write

public void write(int c)
Write a single character. The character to be written is contained in the 16 low-order bits of the given integer value; the 16 high-order bits are ignored.

Subclasses that intend to support efficient single-character output should override this method.

Overrides:
write in class PrintWriter
Parameters:
c - int specifying a character to be written.

write

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

Overrides:
write in class PrintWriter
Parameters:
cbuf - Array of characters
off - Offset from which to start writing characters
len - Number of characters to write

write

public void write(String str)
Write a string.

Overrides:
write in class PrintWriter
Parameters:
str - String to be written

write

public void write(String str,
                  int off,
                  int len)
Write a portion of a string.

Overrides:
write in class PrintWriter
Parameters:
str - A String
off - Offset from which to start writing characters
len - Number of characters to write

println

public void println()
Terminate the current line by writing the line separator string. The line separator string is defined by the system property line.separator, and is not necessarily a single newline character ('\n').

Overrides:
println in class PrintWriter

suspend

public void suspend()
Suspends indentation.


resume

public void resume()
Resumes indentation.


CoherenceTM v3.3
Copyright© 2000-2007 by Oracle Corporation