| java.lang.Object java.io.Writer java.io.BufferedWriter com.sun.satsa.jcrmic.utils.IndentingWriter
IndentingWriter | public class IndentingWriter extends BufferedWriter (Code) | | IndentingWriter is a BufferedWriter subclass that supports automatic
indentation of lines of text written to the underlying Writer.
Methods are provided for compact, convenient indenting, writing text,
and writing lines in various combinations.
|
Constructor Summary | |
public | IndentingWriter(Writer out) Create a new IndentingWriter that writes indented text to the
given Writer. | public | IndentingWriter(Writer out, int step) Create a new IndentingWriter that writes indented text to the
given Writer and uses the supplied indent step. |
Method Summary | |
protected void | checkWrite() Check if an indent needs to be written before writing the next
character. | protected void | indentIn() Increase the current indent by the indent step. | protected void | indentOut() Decrease the current indent by the indent step. | public void | newLine() Write a line separator. | public void | p(String s) Write string. | public void | pI() Indent in. | public void | pO() Indent out. | public void | pO(String s) Indent out; write string. | public void | pOln(String s) Indent out; write string; end current line. | public void | pOlnI(String s) Indent out; write string; end current line; indent in. | public void | pln() End current line. | public void | pln(String s) Write string; end current line. | public void | plnI(String s) Write string; end current line; indent in. | public void | write(int c) Write a single character. | public void | write(char[] cbuf, int off, int len) Write a portion of an array of characters. | public void | write(String s, int off, int len) Write a portion of a String. |
IndentingWriter | public IndentingWriter(Writer out)(Code) | | Create a new IndentingWriter that writes indented text to the
given Writer. Use the default indent step of four spaces.
Parameters: out - output stream |
IndentingWriter | public IndentingWriter(Writer out, int step)(Code) | | Create a new IndentingWriter that writes indented text to the
given Writer and uses the supplied indent step.
Parameters: out - output stream Parameters: step - indent step |
checkWrite | protected void checkWrite() throws IOException(Code) | | Check if an indent needs to be written before writing the next
character.
The indent generation is optimized (and made consistent with
certain coding conventions) by condensing groups of eight spaces
into tab characters.
throws: IOException - if I/O exception occurs |
indentIn | protected void indentIn()(Code) | | Increase the current indent by the indent step.
|
indentOut | protected void indentOut()(Code) | | Decrease the current indent by the indent step.
|
newLine | public void newLine() throws IOException(Code) | | Write a line separator. The next character written will be
preceded by an indent.
throws: IOException - if I/O exception occurs |
pI | public void pI()(Code) | | Indent in.
|
pO | public void pO()(Code) | | Indent out.
|
pOln | public void pOln(String s) throws IOException(Code) | | Indent out; write string; end current line.
Parameters: s - the string throws: IOException - if I/O exception occurs |
pOlnI | public void pOlnI(String s) throws IOException(Code) | | Indent out; write string; end current line; indent in.
This method is useful for generating lines of code that both
end and begin nested blocks, like "} else {".
Parameters: s - the string throws: IOException - if I/O exception occurs |
plnI | public void plnI(String s) throws IOException(Code) | | Write string; end current line; indent in.
Parameters: s - the string throws: IOException - if I/O exception occurs |
write | public void write(int c) throws IOException(Code) | | Write a single character.
Parameters: c - the character throws: IOException - if I/O exception occurs |
write | public void write(char[] cbuf, int off, int len) throws IOException(Code) | | Write a portion of an array of characters.
Parameters: cbuf - buffer Parameters: off - offset Parameters: len - length throws: IOException - if I/O exception occurs |
write | public void write(String s, int off, int len) throws IOException(Code) | | Write a portion of a String.
Parameters: s - the string Parameters: off - offset Parameters: len - length throws: IOException - if I/O exception occurs |
|
|