public class AutoIndentWriter extends java.lang.Object implements STWriter
| Modifier and Type | Field and Description |
|---|---|
int[] |
anchors
Stack of integer anchors (char positions in line); avoid Integer
creation overhead.
|
int |
anchors_sp |
boolean |
atStartOfLine |
int |
charIndex
The absolute char index into the output of the next char to be written.
|
int |
charPosition
Track char position in the line (later we can think about tabs).
|
java.util.List<java.lang.String> |
indents
stack of indents; use List as it's much faster than Stack.
|
int |
lineWidth |
java.lang.String |
newline
\n or \r\n?
|
java.io.Writer |
out |
| Constructor and Description |
|---|
AutoIndentWriter(java.io.Writer out) |
AutoIndentWriter(java.io.Writer out,
java.lang.String newline) |
| Modifier and Type | Method and Description |
|---|---|
int |
indent() |
int |
index()
Return the absolute char index into the output of the char
we're about to write.
|
void |
popAnchorPoint() |
java.lang.String |
popIndentation() |
void |
pushAnchorPoint() |
void |
pushIndentation(java.lang.String indent) |
void |
setLineWidth(int lineWidth) |
int |
write(java.lang.String str)
Write out a string literal or attribute expression or expression element.
|
int |
write(java.lang.String str,
java.lang.String wrap)
Write out a string literal or attribute expression or expression element.
|
int |
writeSeparator(java.lang.String str)
Write a separator.
|
int |
writeWrap(java.lang.String wrap)
Because we evaluate ST instance by invoking exec() again, we
can't pass options in.
|
public java.util.List<java.lang.String> indents
public int[] anchors
public int anchors_sp
public java.lang.String newline
public java.io.Writer out
public boolean atStartOfLine
public int charPosition
public int charIndex
public int lineWidth
public AutoIndentWriter(java.io.Writer out,
java.lang.String newline)
public AutoIndentWriter(java.io.Writer out)
public void setLineWidth(int lineWidth)
setLineWidth in interface STWriterpublic void pushIndentation(java.lang.String indent)
pushIndentation in interface STWriterpublic java.lang.String popIndentation()
popIndentation in interface STWriterpublic void pushAnchorPoint()
pushAnchorPoint in interface STWriterpublic void popAnchorPoint()
popAnchorPoint in interface STWriterpublic int index()
STWriterpublic int write(java.lang.String str)
throws java.io.IOException
public int writeSeparator(java.lang.String str)
throws java.io.IOException
STWriterwriteSeparator in interface STWriterjava.io.IOExceptionpublic int write(java.lang.String str,
java.lang.String wrap)
throws java.io.IOException
public int writeWrap(java.lang.String wrap)
throws java.io.IOException
STWriterpublic int indent()
throws java.io.IOException
java.io.IOException