StyledText.TextWriter

The <code>TextWriter</code> 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. <p> </b>NOTE:</b> <code>toString()</code> is guaranteed to return a valid string only after close() has been called. </p>

Constructors

this
this(int start, int length)

Creates a writer that writes content starting at offset "start" in the document. <code>start</code> and <code>length</code> can be set to specify partial lines.

Members

Functions

close
void close()

Closes the writer. Once closed no more content can be written. <b>NOTE:</b> <code>toString()</code> is not guaranteed to return a valid string unless the writer is closed.

getCharCount
int getCharCount()

Returns the number of characters to write. @return the integer number of characters to write

getStart
int getStart()

Returns the offset where writing starts. 0 based from the start of the widget text. Used to write partial lines. @return the integer offset where writing starts

isClosed
bool isClosed()

Returns whether the writer is closed. @return a bool specifying whether or not the writer is closed

toString
String toString()

Returns the string. <code>close()</code> must be called before <code>toString()</code> is guaranteed to return a valid string.

write
void write(String string)

Appends the given string to the data.

write
void write(String string, int offset)

Inserts the given string to the data at the specified offset. <p> Do nothing if "offset" is < 0 or > getCharCount() </p>

write
void write(int i)

Appends the given int to the data.

write
void write(char i)

Appends the given character to the data.

writeLine
void writeLine(String line, int lineOffset)

Appends the specified line text to the data.

writeLineDelimiter
void writeLineDelimiter(String lineDelimiter)

Appends the specified line delimiter to the data.

Meta