| Modifier and Type | Field and Description |
|---|---|
| protected int[] | anchors
Stack of integer anchors (char positions in line); avoid Integer creation overhead. |
| protected int | |
| protected boolean | |
| protected int | charPosition
Track char position in the line (later we can think about tabs). |
| protected int | |
| protected List | indents
stack of indents; use List as it's much faster than Stack. |
| protected int | |
| protected String | newline
\n or \r\n? |
| protected Writer |
| Access | Constructor and Description |
|---|---|
| public | |
| public |
| Modifier and Type | Method and Description |
|---|---|
| public int | |
| protected StringBuffer | |
| public int | |
| public int | |
| public void | |
| public String | |
| public void | |
| public void | pushIndentation(String indent)
Implements org. |
| 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 | writeWrapSeparator(String wrap)
Implements org. |
| anchors | back to summary |
|---|---|
| protected int[] anchors Stack of integer anchors (char positions in line); avoid Integer creation overhead. | |
| anchors_sp | back to summary |
|---|---|
| protected int anchors_sp | |
| atStartOfLine | back to summary |
|---|---|
| protected boolean atStartOfLine | |
| charPosition | back to summary |
|---|---|
| protected int charPosition Track char position in the line (later we can think about tabs). Indexed from 0. We want to keep charPosition <= lineWidth. This is the position we are *about* to write not the position last written to. | |
| charPositionOfStartOfExpr | back to summary |
|---|---|
| protected int charPositionOfStartOfExpr | |
| indents | back to summary |
|---|---|
| protected List<E> indents stack of indents; use List as it's much faster than Stack. Grows
from 0..n-1. List | |
| lineWidth | back to summary |
|---|---|
| protected int lineWidth | |
| newline | back to summary |
|---|---|
| protected String newline \n or \r\n? | |
| out | back to summary |
|---|---|
| protected Writer out | |
| AutoIndentWriter | back to summary |
|---|---|
| public AutoIndentWriter(Writer out, String newline) | |
| AutoIndentWriter | back to summary |
|---|---|
| public AutoIndentWriter(Writer out) | |
| getIndentationWidth | back to summary |
|---|---|
| public int getIndentationWidth() | |
| getIndentString | back to summary |
|---|---|
| protected StringBuffer getIndentString(int spaces) | |
| indent | back to summary |
|---|---|
| public int indent() throws IOException | |
| indent | back to summary |
|---|---|
| public int indent(int spaces) throws IOException | |
| 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. Push even blank (null) indents as they are like scopes; must be able to pop them back off stack. To deal with combined anchors and indentation, force indents to include any current anchor point. If current anchor is beyond current indent width, add the difference to the indent to be added. This prevents a check later to deal with anchors when starting new line. | |
| 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 wrap before emitting this str. If at or beyond desired line width then emit a \n and any indentation before spitting out this str. | |
| writeSeparator | back to summary |
|---|---|
| public int writeSeparator(String str) throws IOException Implements org. Doc from org. Write a separator. Same as write() except that a \n cannot be inserted before emitting a separator. | |
| writeWrapSeparator | back to summary |
|---|---|
| public int writeWrapSeparator(String wrap) throws IOException Implements org. Doc from org. Because we might need to wrap at a non-atomic string boundary
(such as when we wrap in between template applications
| |