Package com.tangosol.io
Class IndentingWriter
- java.lang.Object
-
- java.io.Writer
-
- java.io.PrintWriter
-
- com.tangosol.io.IndentingWriter
-
- All Implemented Interfaces:
Closeable
,Flushable
,Appendable
,AutoCloseable
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
-
-
Constructor Summary
Constructors Constructor Description 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
All Methods Instance Methods Concrete Methods Modifier and Type Method Description 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, checkError, clearError, 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
-
Methods inherited from class java.io.Writer
nullWriter
-
-
-
-
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 tocSpaces
- the number of spaces 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 classPrintWriter
- 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 classPrintWriter
- Parameters:
cbuf
- Array of charactersoff
- Offset from which to start writing characterslen
- Number of characters to write
-
write
public void write(String str)
Write a string.- Overrides:
write
in classPrintWriter
- 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 classPrintWriter
- Parameters:
str
- A Stringoff
- Offset from which to start writing characterslen
- 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 propertyline.separator
, and is not necessarily a single newline character ('\n'
).- Overrides:
println
in classPrintWriter
-
suspend
public void suspend()
Suspends indentation.
-
resume
public void resume()
Resumes indentation.
-
-