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
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
ConstructorsConstructorDescriptionIndentingWriter(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
Modifier and TypeMethodDescriptionvoidprintln()Terminate the current line by writing the line separator string.voidresume()Resumes indentation.voidsuspend()Suspends indentation.voidwrite(char[] cbuf, int off, int len) Write a portion of an array of characters.voidwrite(int c) Write a single character.voidWrite a string.voidWrite 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, writeMethods inherited from class java.io.Writer
nullWriter
-
Constructor Details
-
IndentingWriter
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
-
IndentingWriter
Construct an IndentingWriter that indents using an indention string.- Parameters:
writer- the underlying writer to write tosIndent- the String value to indent each line with
-
-
Method Details
-
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:
writein 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:
writein classPrintWriter- Parameters:
cbuf- Array of charactersoff- Offset from which to start writing characterslen- Number of characters to write
-
write
Write a string.- Overrides:
writein classPrintWriter- Parameters:
str- String to be written
-
write
Write a portion of a string.- Overrides:
writein 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:
printlnin classPrintWriter
-
suspend
public void suspend()Suspends indentation. -
resume
public void resume()Resumes indentation.
-