| Modifier and Type | Field and Description |
|---|---|
| private boolean | canWrapLines
True indicates that when writing, the line can be split, false indicates that even if the line is > than max line length it should not be split. |
| private int | |
| private Document | |
| private int | |
| private char[] | indentChars
Used when indenting. |
| private int | |
| private int | |
| private boolean | isLineEmpty
True while the current line is empty. |
| private ElementIterator | |
| private String | lineSeparator
String used for end of line. |
| private int | |
| protected static final char | NEWLINE
How the text packages models newlines. |
| private char[] | newlineChars
This is used in |
| private int | |
| private Writer | |
| private Segment | segment
Used for writing text. |
| private int | |
| private char[] | tempChars
Used when writing out a string. |
| Access | Constructor and Description |
|---|---|
| protected | |
| protected | AbstractWriter(Writer
a Writer w, Document an Element doc, int The location in the document to fetch the
content. pos, int The amount to write out. len)Creates a new AbstractWriter. |
| protected | |
| protected | AbstractWriter(Writer
a Writer w, Element an Element root, int The location in the document to fetch the
content. pos, int The amount to write out. len)Creates a new AbstractWriter. |
| Modifier and Type | Method and Description |
|---|---|
| protected void | |
| protected boolean | Returns: whether or not the lines can be wrappedReturns whether or not the lines can be wrapped. |
| protected int | |
| protected Document | |
| protected ElementIterator | |
| public int | |
| protected int | |
| protected int | |
| protected int | |
| public String | Returns: the string used to represent newlinesReturns the string used to represent newlines. |
| public int | |
| protected String | |
| protected Writer | Returns: the Writer that is used to output the contentReturns the Writer that is used to output the content. |
| protected void | |
| protected void | |
| private int | indexOf(char[] chars, char sChar, int startIndex, int endIndex)
Support method to locate an occurrence of a particular character. |
| protected boolean | |
| protected boolean | Returns: true if the current line should be considered emptyReturns true if the current line should be considered empty. |
| protected void | output(char[]
characters to output content, int starting index start, int length of output length)The last stop in writing out content. |
| protected void | setCanWrapLines(boolean
new value for line wrapping newValue)Sets whether or not lines can be wrapped. |
| protected void | |
| protected void | setIndentSpace(int
an int representing the space to indent mapping. space)Enables subclasses to specify how many spaces an indent maps to. |
| protected void | setLineLength(int
the maximum line length. l)Enables subclasses to set the number of characters they want written per line. |
| public void | |
| protected void | |
| protected abstract void | |
| protected void | |
| protected void | |
| protected void | write(char[]
characters to output chars, int starting index startIndex, int length of output length)All write methods call into this one. |
| protected void | writeAttributes(AttributeSet
an AttributeSet. attr)Writes out the set of attributes as " <name>=<value>" pairs. |
| protected void |
| canWrapLines | back to summary |
|---|---|
| private boolean canWrapLines True indicates that when writing, the line can be split, false indicates that even if the line is > than max line length it should not be split. | |
| currLength | back to summary |
|---|---|
| private int currLength | |
| doc | back to summary |
|---|---|
| private Document doc | |
| endOffset | back to summary |
|---|---|
| private int endOffset | |
| indentChars | back to summary |
|---|---|
| private char[] indentChars Used when indenting. Will contain the spaces. | |
| indentLevel | back to summary |
|---|---|
| private int indentLevel | |
| indentSpace | back to summary |
|---|---|
| private int indentSpace | |
| isLineEmpty | back to summary |
|---|---|
| private boolean isLineEmpty True while the current line is empty. This will remain true after indenting. | |
| it | back to summary |
|---|---|
| private ElementIterator it | |
| lineSeparator | back to summary |
|---|---|
| private String lineSeparator String used for end of line. If the Document has the property EndOfLineStringProperty, it will be used for newlines. Otherwise the System property line.separator will be used. The line separator can also be set. | |
| maxLineLength | back to summary |
|---|---|
| private int maxLineLength | |
| NEWLINE | back to summary |
|---|---|
| protected static final char NEWLINE How the text packages models newlines.
| |
| newlineChars | back to summary |
|---|---|
| private char[] newlineChars This is used in | |
| offsetIndent | back to summary |
|---|---|
| private int offsetIndent | |
| out | back to summary |
|---|---|
| private Writer out | |
| segment | back to summary |
|---|---|
| private Segment segment Used for writing text. | |
| startOffset | back to summary |
|---|---|
| private int startOffset | |
| tempChars | back to summary |
|---|---|
| private char[] tempChars Used when writing out a string. | |
| AbstractWriter | back to summary |
|---|---|
| protected AbstractWriter(Writer w, Document doc) Creates a new AbstractWriter. Initializes the ElementIterator with the default root of the document. | |
| AbstractWriter | back to summary |
|---|---|
| protected AbstractWriter(Writer w, Document doc, int pos, int len) Creates a new AbstractWriter. Initializes the ElementIterator with the element passed in. | |
| AbstractWriter | back to summary |
|---|---|
| protected AbstractWriter(Writer w, Element root) Creates a new AbstractWriter. Initializes the ElementIterator with the element passed in. | |
| AbstractWriter | back to summary |
|---|---|
| protected AbstractWriter(Writer w, Element root, int pos, int len) Creates a new AbstractWriter. Initializes the ElementIterator with the element passed in. | |
| decrIndent | back to summary |
|---|---|
| protected void decrIndent() Decrements the indent level. | |
| getCanWrapLines | back to summary |
|---|---|
| protected boolean getCanWrapLines() Returns whether or not the lines can be wrapped. If this is false no lineSeparator's will be output.
| |
| getCurrentLineLength | back to summary |
|---|---|
| protected int getCurrentLineLength() Returns the current line length.
| |
| getDocument | back to summary |
|---|---|
| protected Document getDocument() Fetches the document.
| |
| getElementIterator | back to summary |
|---|---|
| protected ElementIterator getElementIterator() Fetches the ElementIterator.
| |
| getEndOffset | back to summary |
|---|---|
| public int getEndOffset() Returns the last offset to be output.
| |
| getIndentLevel | back to summary |
|---|---|
| protected int getIndentLevel() Returns the current indentation level. That is, the number of times
| |
| getIndentSpace | back to summary |
|---|---|
| protected int getIndentSpace() Returns the amount of space to indent.
| |
| getLineLength | back to summary |
|---|---|
| protected int getLineLength() Returns the maximum line length.
| |
| getLineSeparator | back to summary |
|---|---|
| public String getLineSeparator() Returns the string used to represent newlines.
| |
| getStartOffset | back to summary |
|---|---|
| public int getStartOffset() Returns the first offset to be output.
| |
| getText | back to summary |
|---|---|
| protected String getText(Element elem) throws BadLocationException Returns the text associated with the element. The assumption here is that the element is a leaf element. Throws a BadLocationException when encountered.
| |
| getWriter | back to summary |
|---|---|
| protected Writer getWriter() Returns the Writer that is used to output the content.
| |
| incrIndent | back to summary |
|---|---|
| protected void incrIndent() Increments the indent level. If indenting would cause
| |
| indent | back to summary |
|---|---|
| protected void indent() throws IOException Does indentation. The number of spaces written out is indent level times the space to map mapping. If the current line is empty, this will not make it so that the current line is still considered empty.
| |
| indexOf | back to summary |
|---|---|
| private int indexOf(char[] chars, char sChar, int startIndex, int endIndex) Support method to locate an occurrence of a particular character. | |
| inRange | back to summary |
|---|---|
| protected boolean inRange(Element next) This method determines whether the current element is in the range specified. When no range is specified, the range is initialized to be the entire document. inRange() returns true if the range specified intersects with the element's range.
| |
| isLineEmpty | back to summary |
|---|---|
| protected boolean isLineEmpty() Returns true if the current line should be considered empty. This
is true when
| |
| output | back to summary |
|---|---|
| protected void output(char[] content, int start, int length) throws IOException The last stop in writing out content. All the write methods eventually
make it to this method, which invokes This method also updates the line length based on
| |
| setCanWrapLines | back to summary |
|---|---|
| protected void setCanWrapLines(boolean newValue) Sets whether or not lines can be wrapped. This can be toggled during the writing of lines. For example, outputting HTML might set this to false when outputting a quoted string.
| |
| setCurrentLineLength | back to summary |
|---|---|
| protected void setCurrentLineLength(int length) Sets the current line length.
| |
| setIndentSpace | back to summary |
|---|---|
| protected void setIndentSpace(int space) Enables subclasses to specify how many spaces an indent maps to. When indentation takes place, the indent level is multiplied by this mapping. The default is 2.
| |
| setLineLength | back to summary |
|---|---|
| protected void setLineLength(int l) Enables subclasses to set the number of characters they want written per line. The default is 100.
| |
| setLineSeparator | back to summary |
|---|---|
| public void setLineSeparator(String value) Sets the String used to represent newlines. This is initialized in the constructor from either the Document, or the System property line.separator.
| |
| text | back to summary |
|---|---|
| protected void text(Element elem) throws BadLocationException, IOException Writes out text. If a range is specified when the constructor is invoked, then only the appropriate range of text is written out.
| |
| write | back to summary |
|---|---|
| protected abstract void write() throws IOException, BadLocationException This abstract method needs to be implemented by subclasses. Its responsibility is to iterate over the elements and use the write() methods to generate output in the desired format.
| |
| write | back to summary |
|---|---|
| protected void write(char ch) throws IOException Writes out a character. This is implemented to invoke
the
| |
| write | back to summary |
|---|---|
| protected void write(String content) throws IOException Writes out a string. This is implemented to invoke the
| |
| write | back to summary |
|---|---|
| protected void write(char[] chars, int startIndex, int length) throws IOException All write methods call into this one. If
| |
| writeAttributes | back to summary |
|---|---|
| protected void writeAttributes(AttributeSet attr) throws IOException Writes out the set of attributes as " <name>=<value>" pairs. It throws an IOException when encountered.
| |
| writeLineSeparator | back to summary |
|---|---|
| protected void writeLineSeparator() throws IOException Writes the line separator. This invokes
| |