The indent stack is a stack of strings so we can repeat original indent not just the same number of columns (don't have to worry about tabs vs spaces then). Anchors are char positions (tabs won't work) that indicate where all future wraps should justify to. The wrap position is actually the larger of either the last anchor or the indentation level.
This is a filter on a Writer.
\n is the proper way to say newline for options and templates.
Templates can mix \r\n and \n them, but use \n in
options like wrap="\n". This writer will render newline characters
according to newline. The default value is taken from the
line.separator system property, and can be overridden by passing in a
String to the appropriate constructor.
| Modifier and Type | Field and Description |
|---|---|
| public int[] | |
| public int | |
| public boolean | |
| public int | charIndex
The absolute char index into the output of the next char to be written. |
| public int | charPosition
Track char position in the line (later we can think about tabs). |
| public List | indents
Stack of indents. |
| public int | |
| public String | newline
|
| public Writer |
| Access | Constructor and Description |
|---|---|
| public | |
| public |
| Modifier and Type | Method and Description |
|---|---|
| public int | |
| public int | index()
Implements org. |
| public void | |
| public String | |
| public void | |
| public void | |
| public void | |
| public int | write(String str)
Implements org. |
| public int | write(String str, String wrap)
Implements org. |
| public int | writeSeparator(String str)
Implements org. |
| public int | writeWrap(String wrap)
Implements org. Interpreter#exec(STWriter, InstanceScope) again, we can't pass options in.
So the Bytecode#INSTR_WRITE instruction of an applied template
(such as when we wrap in between template applications like
<data:{v|[<v>]}; wrap>) we need to write the wrap string
before calling Interpreter#exec.
|
| anchors | back to summary |
|---|---|
| public int[] anchors Stack of integer anchors (char positions in line); avoid | |
| anchors_sp | back to summary |
|---|---|
| public int anchors_sp | |
| atStartOfLine | back to summary |
|---|---|
| public boolean atStartOfLine | |
| charIndex | back to summary |
|---|---|
| public int charIndex The absolute char index into the output of the next char to be written. | |
| charPosition | back to summary |
|---|---|
| public int charPosition Track char position in the line (later we can think about tabs). Indexed
from 0. We want to keep | |
| indents | back to summary |
|---|---|
| public List<String> indents Stack of indents. Use | |
| lineWidth | back to summary |
|---|---|
| public int lineWidth | |
| newline | back to summary |
|---|---|
| public String newline
| |
| out | back to summary |
|---|---|
| public Writer out | |
| AutoIndentWriter | back to summary |
|---|---|
| public AutoIndentWriter(Writer out, String newline) | |
| AutoIndentWriter | back to summary |
|---|---|
| public AutoIndentWriter(Writer out) | |
| indent | back to summary |
|---|---|
| public int indent() throws IOException | |
| index | back to summary |
|---|---|
| public int index() Implements org. Doc from org. Return the absolute char index into the output of the char we're about to write. Returns 0 if no char written yet.
| |
| popAnchorPoint | back to summary |
|---|---|
| public void popAnchorPoint() Implements org.
| |
| popIndentation | back to summary |
|---|---|
| public String popIndentation() Implements org.
| |
| pushAnchorPoint | back to summary |
|---|---|
| public void pushAnchorPoint() Implements org.
| |
| pushIndentation | back to summary |
|---|---|
| public void pushIndentation(String indent) Implements org.
| |
| setLineWidth | back to summary |
|---|---|
| public void setLineWidth(int lineWidth) Implements org.
| |
| write | back to summary |
|---|---|
| public int write(String str) throws IOException Implements org. Write out a string literal or attribute expression or expression element.
| |
| write | back to summary |
|---|---|
| public int write(String str, String wrap) throws IOException Implements org. Write out a string literal or attribute expression or expression element.
If doing line wrap, then check
| |
| writeSeparator | back to summary |
|---|---|
| public int writeSeparator(String str) throws IOException Implements org. Doc from org. Write a separator. Same as
| |
| writeWrap | back to summary |
|---|---|
| public int writeWrap(String wrap) throws IOException Implements org. Doc from org. Because we evaluate ST instance by invoking
| |