TextWriter class is used to write widget content to
a string. Whole and partial lines and line breaks can be written. To write
partial lines, specify the start and length of the desired segment
during object creation.Note
toString() is guaranteed to return a valid string only after close()
has been called.
| Modifier and Type | Field and Description |
|---|---|
| private StringBuilder | |
| private int | |
| private boolean | |
| private int |
| Access | Constructor and Description |
|---|---|
| public | TextWriter(int
start offset of content to write, 0 based from beginning of document start, int length of content to write length)Creates a writer that writes content starting at offset "start" in the document. |
| Modifier and Type | Method and Description |
|---|---|
| public void | |
| public int | Returns: the integer number of characters to writeReturns the number of characters to write. |
| public int | |
| public boolean | Returns: a boolean specifying whether or not the writer is closedReturns whether the writer is closed. |
| public String | |
| pack-priv void | |
| pack-priv void | |
| pack-priv void | |
| pack-priv void | |
| public void | writeLine(String
line text to write. Must not contain line breaks
Line breaks should be written using writeLineDelimiter() line, int offset of the line. 0 based from the start of the
widget document. Any text occurring before the start offset or after the
end offset specified during object creation is ignored. lineOffset)Appends the specified line text to the data. |
| public void | writeLineDelimiter(String
line delimiter to write lineDelimiter)Appends the specified line delimiter to the data. |
| buffer | back to summary |
|---|---|
| private StringBuilder buffer | |
| endOffset | back to summary |
|---|---|
| private int endOffset | |
| isClosed | back to summary |
|---|---|
| private boolean isClosed | |
| startOffset | back to summary |
|---|---|
| private int startOffset | |
| TextWriter | back to summary |
|---|---|
| public TextWriter(int start, int length) Creates a writer that writes content starting at offset "start"
in the document.
| |
| close | back to summary |
|---|---|
| public void close() Closes the writer. Once closed no more content can be written Note
| |
| getCharCount | back to summary |
|---|---|
| public int getCharCount() Returns the number of characters to write.
| |
| getStart | back to summary |
|---|---|
| public int getStart() Returns the offset where writing starts. 0 based from the start of the widget text. Used to write partial lines.
| |
| isClosed | back to summary |
|---|---|
| public boolean isClosed() Returns whether the writer is closed.
| |
| toString | back to summary |
|---|---|
| public String toString() Overrides java. Returns the string. | |
| write | back to summary |
|---|---|
| pack-priv void write(String string) Appends the given string to the data. | |
| write | back to summary |
|---|---|
| pack-priv void write(String string, int offset) Inserts the given string to the data at the specified offset. Do nothing if "offset" is < 0 or > getCharCount()
| |
| write | back to summary |
|---|---|
| pack-priv void write(int i) Appends the given int to the data. | |
| write | back to summary |
|---|---|
| pack-priv void write(char i) Appends the given character to the data. | |
| writeLine | back to summary |
|---|---|
| public void writeLine(String line, int lineOffset) Appends the specified line text to the data.
| |
| writeLineDelimiter | back to summary |
|---|---|
| public void writeLineDelimiter(String lineDelimiter) Appends the specified line delimiter to the data.
| |