All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class jp.kyasu.graphics.Text

java.lang.Object
   |
   +----jp.kyasu.graphics.Text

public class Text
extends Object
implements Cloneable, Serializable
The Text class implements the growable string with style (TextStyle) and visual items (TextAttachment).

In the Text, following three characters has special meaning:

'\n'
The line (paragraph) separator that breaks the line and separates the paragraph.
'\r'
The line break that breaks the line but not separate the paragraph.
'\FFFE'
The text attachment mark that indicates the position of the text attachment.
For example:
     This is a paragraph 1.\n
     This is a paragraph 2\r
     continued to the next line.\n
     This is a paragraph 3 containing an image \FFFE.\n
 

Version:
15 Jun 1998
Author:
Kazuki YASUMATSU
See Also:
TextStyle, TextAttachment

Variable Index

 o ATTACHMENT_CHAR
The text attachment mark that indicates the position of the text attachment.
 o LINE_BREAK_CHAR
The line break that breaks the line but not separate the paragraph.
 o LINE_SEPARATOR_CHAR
The line (paragraph) separator that breaks the line and separates the paragraph.
 o LIST_COL_SEPARATOR_CHAR
The list column separator that separates the list column.
 o LIST_SEPARATOR_CHAR
The list separator that separates the list item.

Constructor Index

 o Text()
Constructs an empty text.
 o Text(int)
Constructs an empty text with the initial capacity.
 o Text(int, int)
Constructs an empty text with the initial capacity and the maximum capacity increment size.
 o Text(String)
Constructs a text with the contents of the string, whose every style equals to the default style.
 o Text(String, TextStyle)
Constructs a text with the contents of the string, whose every style equals to the specified style.
 o Text(String, TextStyle, int)
Constructs a text with the contents of the string and the maximum capacity increment size, whose every style equals to the specified style.
 o Text(TextAttachment)
Constructs a text with the text attachment, whose every style equals to the default style.
 o Text(TextAttachment, TextStyle)
Constructs a text with the text attachment, whose every style equals to the specified style.
 o Text(TextAttachment, TextStyle, int)
Constructs a text with the text attachment and the maximum capacity increment size, whose every style equals to the specified style.
 o Text(Visualizable)
Constructs a text with the visual object, whose every style equals to the default style.

Method Index

 o append(char)
Appends the character to this text.
 o append(String)
Appends the characters of the string to this text.
 o append(String, int, int)
Appends the characters of the string from the specified begin index to the specified endIndex-1 index.
 o append(Text)
Appends the specified text to this text.
 o append(TextAttachment)
Appends the text attachment to this text.
 o charAt(int)
Returns the character at the specified index.
 o clone()
Returns a clone of this text.
 o cloneStyle()
Returns a clone of this text.
 o compareTo(String)
Compares this text with the string argument lexicographically.
 o compareTo(Text)
Compares two texts lexicographically.
 o copyJavaToSystemReadWriter(Reader, Writer)
Copies the contents of the specified reader into the specified writer with a conversion from CR or LF to the system line separator.
 o copyJavaToSystemReadWriter(Reader, Writer, String)
Copies the contents of the specified reader into the specified writer with a conversion from CR or LF to the specified separator.
 o copySystemToJavaReadWriter(Reader, Writer)
Copies the contents of the specified reader into the specified writer with a conversion from any one of line-ends (CR, LF, or CRLF) to LF.
 o copySystemToJavaReadWriter(Reader, Writer, int)
Copies the contents of the specified reader into the specified writer with a conversion from any one of line-ends (CR, LF, or CRLF) to LF.
 o equals(Object)
Compares two objects for equality.
 o getAttachmentAt(int)
Returns the text attachment at the specified index.
 o getAttachmentCount()
Returns the number of the text attachments in this text.
 o getAttachments()
Returns all text attachments in this text as a hashtable.
 o getChar(int)
Returns the character at the specified index.
 o getCharacterIterator()
Returns the character iterator for this text.
 o getCharacterIterator(int)
Returns the character iterator for this text, with the specified initial index.
 o getCharacterIterator(int, int, int)
Returns the character iterator for this text, with the specified range and initial index.
 o getChars(int, int, char[], int)
Copies characters from this text into the destination character array.
 o getJavaString(String)
Converts the platform string whose line-end is CR, LF, or CRLF to the string whose internal representation is suitable for the text, i.e., whose line-end is LF.
 o getJavaString(String, int)
Converts the platform string whose line-end is CR, LF, or CRLF to the string whose internal representation is suitable for the text, i.e., whose line-end is the specified separator character.
 o getRunLengthAt(int)
Returns the run length (the number of the constant occurrence) of the style at the specified index.
 o getRunOffsetAt(int)
Returns the run offset (the starting index of the constant occurrence) of the style at the specified index.
 o getSystemString(String)
Converts the string whose internal representation is suitable for the text, i.e., whose line-end is LF and line-break is CR, to the platform string whose line-end is CR, LF, or CRLF.
 o getSystemString(String, String)
Converts the string whose internal representation is suitable for the text, i.e., whose line-end is LF and line-break is CR, to the platform string whose line-end is the specified line separator.
 o getTextStyleArray(int, int)
Returns the run array representation of the text styles in this text.
 o getTextStyleAt(int)
Returns the text style at the specified index.
 o getTextStyleCount()
Returns the number of the text styles in this text.
 o getTextStyleRuns()
Returns the text styles as a run array in this text.
 o getTextStyles()
Returns all text styles in this text.
 o getTextStyles(int, int)
Returns the text styles in this text.
 o hashCode()
Returns a hashcode for this text.
 o indexOf(boolean, String, int)
Returns the index within this text of the first occurrence of the specified substring, starting at the specified index.
 o indexOf(boolean, Text, int)
Returns the index within this text of the first occurrence of the substring of the specified text, starting at the specified index.
 o indexOf(int)
Returns the index within this text of the first occurrence of the specified character.
 o indexOf(int, int)
Returns the index within this text of the first occurrence of the specified character, starting the search at the specified index.
 o indexOf(String)
Returns the index within this text of the first occurrence of the specified substring.
 o indexOf(String, int)
Returns the index within this text of the first occurrence of the specified substring, starting at the specified index.
 o indexOf(Text)
Returns the index within this text of the first occurrence of the substring in the specified text.
 o indexOf(Text, int)
Returns the index within this text of the first occurrence of the substring of the specified text, starting at the specified index.
 o indexOfIgnoreCase(String)
Returns the index within this text of the first occurrence of the specified substring, ignoring case.
 o indexOfIgnoreCase(String, int)
Returns the index within this text of the first occurrence of the specified substring, starting at the specified index, ignoring case.
 o indexOfIgnoreCase(Text)
Returns the index within this text of the first occurrence of the substring in the specified text, ignoring case.
 o indexOfIgnoreCase(Text, int)
Returns the index within this text of the first occurrence of the substring of the specified text, starting at the specified index, ignoring case.
 o insert(int, String)
Inserts the characters of the specified string to this text from the specified offset.
 o insert(int, Text)
Inserts the components of the specified text to this text from the specified offset.
 o isEmpty()
Tests if this text has no characters.
 o lastIndexOf(boolean, String, int)
Returns the index within this text of the last occurrence of the specified substring.
 o lastIndexOf(boolean, Text, int)
Returns the index within this text of the last occurrence of the substring in the specified text.
 o lastIndexOf(int)
Returns the index within this text of the last occurrence of the specified character.
 o lastIndexOf(int, int)
Returns the index within this text of the last occurrence of the specified character, searching backward starting at the specified index.
 o lastIndexOf(String)
Returns the index within this text of the rightmost occurrence of the specified substring.
 o lastIndexOf(String, int)
Returns the index within this text of the last occurrence of the specified substring.
 o lastIndexOf(Text)
Returns the index within this text of the rightmost occurrence of the substring in the specified text.
 o lastIndexOf(Text, int)
Returns the index within this text of the last occurrence of the substring in the specified text.
 o lastIndexOfIgnoreCase(String)
Returns the index within this text of the rightmost occurrence of the specified substring, ignoring case.
 o lastIndexOfIgnoreCase(String, int)
Returns the index within this text of the last occurrence of the specified substring, ignoring case.
 o lastIndexOfIgnoreCase(Text)
Returns the index within this text of the rightmost occurrence of the substring in the specified text, ignoring case.
 o lastIndexOfIgnoreCase(Text, int)
Returns the index within this text of the last occurrence of the substring in the specified text, ignoring case.
 o length()
Returns the length of this text.
 o modifyStyle(int, int, TextStyleModifier)
Modifies the style of this text with the specified text style modifier.
 o regionMatches(boolean, int, String, int, int)
Tests if the text region and the string region are equal.
 o regionMatches(boolean, int, Text, int, int)
Tests if two text regions are equal.
 o regionMatches(int, String, int, int)
Tests if the text region and the string are equal.
 o regionMatches(int, Text, int, int)
Tests if two text regions are equal.
 o remove(int, int)
Removes the characters in this text from the specified offset.
 o removeAll()
Removes all characters from this text and sets its length to zero.
 o replace(int, int, String)
Replaces the components of this text with the components of the specified string.
 o replace(int, int, Text)
Replaces the components of this text with the components of the specified text.
 o replaceStyle(int, int, TextStyle)
Replaces the style of this text with the specified style.
 o setAttachmentAt(int, TextAttachment)
Sets the component at the specified index of this text to be the specified text attachment.
 o setChar(int, char)
Sets the component at the specified index of this text to be the specified character.
 o setCharAt(int, char)
Sets the component at the specified index of this text to be the specified character.
 o substring(int)
Returns a new string that is a substring of this text.
 o substring(int, int)
Returns a new string that is a substring of this text.
 o subtext(int)
Returns a new text that is a subtext of this text.
 o subtext(int, int)
Returns a new text that is a subtext of this text.
 o textStyles()
Returns an enumeration of the text styles of this text.
 o textStyles(int, int)
Returns an enumeration of the text styles of this text.
 o toString()
Returns a string representation of this text.

Variables

 o LINE_SEPARATOR_CHAR
 public static final char LINE_SEPARATOR_CHAR
The line (paragraph) separator that breaks the line and separates the paragraph.

See Also:
TextScanner, JAVA_STOPS
 o LINE_BREAK_CHAR
 public static final char LINE_BREAK_CHAR
The line break that breaks the line but not separate the paragraph.

See Also:
TextScanner, JAVA_STOPS, JAVA_BREAK_STOPS
 o LIST_SEPARATOR_CHAR
 public static final char LIST_SEPARATOR_CHAR
The list separator that separates the list item.

See Also:
LIST_STOPS
 o LIST_COL_SEPARATOR_CHAR
 public static final char LIST_COL_SEPARATOR_CHAR
The list column separator that separates the list column.

See Also:
LIST_STOPS, LIST_COLUMN_STOPS
 o ATTACHMENT_CHAR
 public static final char ATTACHMENT_CHAR
The text attachment mark that indicates the position of the text attachment.

See Also:
TextScanner

Constructors

 o Text
 public Text()
Constructs an empty text.

 o Text
 public Text(int initialCapacity)
Constructs an empty text with the initial capacity.

Parameters:
initialCapacity - the initial capacity of the text.
 o Text
 public Text(int initialCapacity,
             int maxCapacityIncrement)
Constructs an empty text with the initial capacity and the maximum capacity increment size.

Parameters:
initialCapacity - the initial capacity of the text.
maxCapacityIncrement - the maximum amount by which the capacity is increased when the text overflows.
 o Text
 public Text(String str)
Constructs a text with the contents of the string, whose every style equals to the default style.

Parameters:
str - a string.
 o Text
 public Text(String str,
             TextStyle style)
Constructs a text with the contents of the string, whose every style equals to the specified style.

Parameters:
str - a string.
style - the style of the text.
 o Text
 public Text(String str,
             TextStyle style,
             int maxCapacityIncrement)
Constructs a text with the contents of the string and the maximum capacity increment size, whose every style equals to the specified style.

Parameters:
str - a string.
style - the style of the text.
maxCapacityIncrement - the maximum amount by which the capacity is increased when the text overflows.
 o Text
 public Text(Visualizable visualizable)
Constructs a text with the visual object, whose every style equals to the default style.

Parameters:
visualizable - a visual object.
 o Text
 public Text(TextAttachment ta)
Constructs a text with the text attachment, whose every style equals to the default style.

Parameters:
ta - a text attachment.
 o Text
 public Text(TextAttachment ta,
             TextStyle style)
Constructs a text with the text attachment, whose every style equals to the specified style.

Parameters:
ta - a text attachment.
style - the style of the text.
 o Text
 public Text(TextAttachment ta,
             TextStyle style,
             int maxCapacityIncrement)
Constructs a text with the text attachment and the maximum capacity increment size, whose every style equals to the specified style.

Parameters:
ta - a text attachment.
style - the style of the text.
maxCapacityIncrement - the maximum amount by which the capacity is increased when the text overflows.

Methods

 o getJavaString
 public static String getJavaString(String sysString)
Converts the platform string whose line-end is CR, LF, or CRLF to the string whose internal representation is suitable for the text, i.e., whose line-end is LF.

Parameters:
sysString - the platform string.
Returns:
the string whose internal representation is suitable for the text.
See Also:
getJavaString
 o getJavaString
 public static String getJavaString(String sysString,
                                    int separatorChar)
Converts the platform string whose line-end is CR, LF, or CRLF to the string whose internal representation is suitable for the text, i.e., whose line-end is the specified separator character.

Parameters:
sysString - the platform string.
separator - the specified separator character.
Returns:
the string whose internal representation is suitable for the text.
See Also:
copySystemToJavaReadWriter
 o getSystemString
 public static String getSystemString(String javaString)
Converts the string whose internal representation is suitable for the text, i.e., whose line-end is LF and line-break is CR, to the platform string whose line-end is CR, LF, or CRLF.

Parameters:
javaString - the string whose internal representation is suitable for the text.
Returns:
the platform string.
See Also:
getSystemString
 o getSystemString
 public static String getSystemString(String javaString,
                                      String separator)
Converts the string whose internal representation is suitable for the text, i.e., whose line-end is LF and line-break is CR, to the platform string whose line-end is the specified line separator.

Parameters:
javaString - the string whose internal representation is suitable for the text.
separator - the specified separator string.
Returns:
the platform string.
See Also:
copyJavaToSystemReadWriter
 o copySystemToJavaReadWriter
 public static void copySystemToJavaReadWriter(Reader sysReader,
                                               Writer javaWriter) throws IOException
Copies the contents of the specified reader into the specified writer with a conversion from any one of line-ends (CR, LF, or CRLF) to LF. As a result of the conversion, the contents of the writer become suitable for the internal representation of the text.

Parameters:
sysReader - the specified reader.
javaWriter - the specified writer.
Throws: IOException
If an I/O error occurs.
See Also:
copySystemToJavaReadWriter
 o copySystemToJavaReadWriter
 public static void copySystemToJavaReadWriter(Reader sysReader,
                                               Writer javaWriter,
                                               int separatorChar) throws IOException
Copies the contents of the specified reader into the specified writer with a conversion from any one of line-ends (CR, LF, or CRLF) to LF. As a result of the conversion, the contents of the writer become suitable for the internal representation of the text whose line separator equals to the specified separator character.

Parameters:
sysReader - the specified reader.
javaWriter - the specified writer.
separatorChar - the specified separator character.
Throws: IOException
If an I/O error occurs.
 o copyJavaToSystemReadWriter
 public static void copyJavaToSystemReadWriter(Reader javaReader,
                                               Writer sysWriter) throws IOException
Copies the contents of the specified reader into the specified writer with a conversion from CR or LF to the system line separator. As a result of the conversion, the contents of the writer become suitable for the platform.

Parameters:
javaReader - the specified reader.
sysWriter - the specified writer.
Throws: IOException
If an I/O error occurs.
See Also:
copyJavaToSystemReadWriter
 o copyJavaToSystemReadWriter
 public static void copyJavaToSystemReadWriter(Reader javaReader,
                                               Writer sysWriter,
                                               String separator) throws IOException
Copies the contents of the specified reader into the specified writer with a conversion from CR or LF to the specified separator. As a result of the conversion, the contents of the writer become suitable for the platform whose line separator equals to the specified separator string.

Parameters:
javaReader - the specified reader.
sysWriter - the specified writer.
separator - the specified separator string.
Throws: IOException
If an I/O error occurs.
 o getCharacterIterator
 public final CharacterIterator getCharacterIterator()
Returns the character iterator for this text.

Returns:
the character iterator for this text.
 o getCharacterIterator
 public final CharacterIterator getCharacterIterator(int pos)
Returns the character iterator for this text, with the specified initial index.

Parameters:
pos - initial iterator position.
Returns:
the character iterator for this text.
 o getCharacterIterator
 public final CharacterIterator getCharacterIterator(int begin,
                                                     int end,
                                                     int pos)
Returns the character iterator for this text, with the specified range and initial index.

Parameters:
begin - index of the first character.
end - index of the character following the last character.
pos - initial iterator position.
Returns:
the character iterator for this text.
 o textStyles
 public final Enumeration textStyles()
Returns an enumeration of the text styles of this text.

Returns:
an enumeration of the text styles of this text.
 o textStyles
 public final Enumeration textStyles(int begin,
                                     int end)
Returns an enumeration of the text styles of this text.

Parameters:
begin - the beginning index to get styles, inclusive.
end - the ending index to get styles, exclusive.
Returns:
an enumeration of the text styles of this text.
 o getTextStyleRuns
 public final RunArray getTextStyleRuns()
Returns the text styles as a run array in this text. An application should not modify the returned run array.

Returns:
all text styles as a run array in this text.
 o getTextStyleAt
 public final TextStyle getTextStyleAt(int index)
Returns the text style at the specified index.

Parameters:
index - an index into this text.
Returns:
the text style at the specified index.
 o getTextStyleCount
 public final int getTextStyleCount()
Returns the number of the text styles in this text.

Returns:
the number of the text styles in this text.
 o getTextStyles
 public final TextStyle[] getTextStyles()
Returns all text styles in this text.

Returns:
all text styles in this text.
 o getTextStyles
 public final TextStyle[] getTextStyles(int begin,
                                        int end)
Returns the text styles in this text.

Parameters:
begin - the beginning index to get text styles, inclusive.
end - the ending index to get text styles, exclusive.
Returns:
the text styles in this text.
 o getTextStyleArray
 public final RunArray getTextStyleArray(int begin,
                                         int end)
Returns the run array representation of the text styles in this text.

Parameters:
begin - the beginning index to get text styles, inclusive.
end - the ending index to get text styles, exclusive.
Returns:
the run array representation of the text styles in this text.
 o getAttachmentCount
 public final int getAttachmentCount()
Returns the number of the text attachments in this text.

Returns:
the number of the text attachments in this text.
 o getAttachments
 public final Hashtable getAttachments()
Returns all text attachments in this text as a hashtable. An application should not modify the returned array.

Returns:
the text attachments in this text, as a hashtable.
 o getAttachmentAt
 public final TextAttachment getAttachmentAt(int index)
Returns the text attachment at the specified index.

Parameters:
index - an index into this text.
Returns:
the text attachment if this text contains the text attachment at the specified index; null otherwise.
 o setAttachmentAt
 public final void setAttachmentAt(int index,
                                   TextAttachment ta)
Sets the component at the specified index of this text to be the specified text attachment.

Parameters:
index - the specified index.
ta - the specified text attachment.
 o charAt
 public final char charAt(int index)
Returns the character at the specified index.

Parameters:
index - an index into this text.
Returns:
the character at the specified index.
 o setCharAt
 public final void setCharAt(int index,
                             char c)
Sets the component at the specified index of this text to be the specified character.

Parameters:
index - the specified index.
c - the specified character.
 o getChar
 public final char getChar(int index)
Returns the character at the specified index.

Parameters:
index - an index into this text.
Returns:
the character at the specified index.
 o setChar
 public final void setChar(int index,
                           char c)
Sets the component at the specified index of this text to be the specified character.

Parameters:
index - the specified index.
c - the specified character.
 o getChars
 public void getChars(int srcBegin,
                      int srcEnd,
                      char dst[],
                      int dstBegin)
Copies characters from this text into the destination character array.

Parameters:
srcBegin - index of the first character in this text to copy (inclusive).
srcEnd - index after the last character in this text to copy (exclusive).
dst - the destination array.
dstBegin - the start offset in the destination array.
Throws: ArrayIndexOutOfBoundsException
If srcBegin or srcEnd is out of range, or if srcBegin is greater than the srcEnd.
 o isEmpty
 public final boolean isEmpty()
Tests if this text has no characters.

Returns:
true if this text has no characters; false otherwise.
 o length
 public final int length()
Returns the length of this text.

Returns:
the length of this text.
 o hashCode
 public int hashCode()
Returns a hashcode for this text.

Overrides:
hashCode in class Object
 o equals
 public boolean equals(Object anObject)
Compares two objects for equality.

Overrides:
equals in class Object
 o compareTo
 public int compareTo(Text anotherText)
Compares two texts lexicographically. This operation does not compare the styles or the text attachments (visual items). The comparison is based on the Unicode value of each character in the texts.

Parameters:
anotherText - the Text to be compared.
Returns:
the value 0 if the text argument is equal to this text; a value less than 0 if this text is lexicographically less than the text argument; and a value greater than 0 if this text is lexicographically greater than the text argument.
 o compareTo
 public int compareTo(String anotherString)
Compares this text with the string argument lexicographically. The comparison is based on the Unicode value of each character in the text and the string.

Parameters:
anotherString - the String to be compared.
Returns:
the value 0 if the string argument is equal to this text; a value less than 0 if this text is lexicographically less than the string argument; and a value greater than 0 if this text is lexicographically greater than the string argument.
 o regionMatches
 public boolean regionMatches(int toffset,
                              Text other,
                              int ooffset,
                              int len)
Tests if two text regions are equal. The comparison is based on the Unicode value of each character in the texts.

If toffset or ooffset is negative, or if toffset+length is greater than the length of this text, or if ooffset+length is greater than the length of the text argument, then this method returns false.

Parameters:
toffset - the starting offset of the subregion in this text.
other - the text argument.
ooffset - the starting offset of the subregion in the text argument.
len - the number of characters to compare.
Returns:
true if the specified subregion of this text exactly matches the specified subregion of the text argument; false otherwise.
 o regionMatches
 public boolean regionMatches(int toffset,
                              String other,
                              int ooffset,
                              int len)
Tests if the text region and the string are equal. The comparison is based on the Unicode value of each character in the text and the string.

If toffset or ooffset is negative, or if toffset+length is greater than the length of this text, or if ooffset+length is greater than the length of the string argument, then this method returns false.

Parameters:
toffset - the starting offset of the subregion in this text.
other - the string argument.
ooffset - the starting offset of the subregion in the string argument.
len - the number of characters to compare.
Returns:
true if the specified subregion of this text exactly matches the specified subregion of the string argument; false otherwise.
 o regionMatches
 public boolean regionMatches(boolean ignoreCase,
                              int toffset,
                              Text other,
                              int ooffset,
                              int len)
Tests if two text regions are equal. The comparison is based on the Unicode value of each character in the texts.

If toffset or ooffset is negative, or if toffset+length is greater than the length of this text, or if ooffset+length is greater than the length of the text argument, then this method returns false.

Parameters:
ignoreCase - if true, ignore case when comparing characters.
toffset - the starting offset of the subregion in this text.
other - the text argument.
ooffset - the starting offset of the subregion in the text argument.
len - the number of characters to compare.
Returns:
true if the specified subregion of this text matches the specified subregion of the text argument; false otherwise. Whether the matching is exact or case insensitive depends on the ignoreCase argument.
 o regionMatches
 public boolean regionMatches(boolean ignoreCase,
                              int toffset,
                              String other,
                              int ooffset,
                              int len)
Tests if the text region and the string region are equal. The comparison is based on the Unicode value of each character in the texts.

If toffset or ooffset is negative, or if toffset+length is greater than the length of this text, or if ooffset+length is greater than the length of the string argument, then this method returns false.

Parameters:
ignoreCase - if true, ignore case when comparing characters.
toffset - the starting offset of the subregion in this text.
other - the string argument.
ooffset - the starting offset of the subregion in the string argument.
len - the number of characters to compare.
Returns:
true if the specified subregion of this text matches the specified subregion of the string argument; false otherwise. Whether the matching is exact or case insensitive depends on the ignoreCase argument.
 o indexOf
 public int indexOf(int ch)
Returns the index within this text of the first occurrence of the specified character.

Parameters:
ch - a character.
Returns:
the index of the first occurrence of the character in the character sequence represented by this object, or -1 if the character does not occur.
 o indexOf
 public int indexOf(int ch,
                    int fromIndex)
Returns the index within this text of the first occurrence of the specified character, starting the search at the specified index.

Parameters:
ch - a character.
fromIndex - the index to start the search from.
Returns:
the index of the first occurrence of the character in the character sequence represented by this object that is greater than or equal to fromIndex, or -1 if the character does not occur.
 o lastIndexOf
 public int lastIndexOf(int ch)
Returns the index within this text of the last occurrence of the specified character. The Text is searched backwards starting at the last character.

Parameters:
ch - a character.
Returns:
the index of the last occurrence of the character in the character sequence represented by this object, or -1 if the character does not occur.
 o lastIndexOf
 public int lastIndexOf(int ch,
                        int fromIndex)
Returns the index within this text of the last occurrence of the specified character, searching backward starting at the specified index.

Parameters:
ch - a character.
fromIndex - the index to start the search from.
Returns:
the index of the last occurrence of the character in the character sequence represented by this object that is less than or equal to fromIndex, or -1 if the character does not occur before that point.
 o indexOf
 public int indexOf(Text text)
Returns the index within this text of the first occurrence of the substring in the specified text.

Parameters:
text - the subtext to search for.
Returns:
if the text argument occurs as a substring within this object, then the index of the first character of the first such substring is returned; if it does not occur as a substring, -1 is returned.
 o indexOf
 public int indexOf(Text text,
                    int fromIndex)
Returns the index within this text of the first occurrence of the substring of the specified text, starting at the specified index.

Parameters:
text - the subtext to search for.
fromIndex - the index to start the search from.
Returns:
If the text argument occurs as a substring within this object at a starting index no smaller than fromIndex, then the index of the first character of the first such substring is returned. If it does not occur as a substring starting at fromIndex or beyond, -1 is returned.
 o indexOfIgnoreCase
 public int indexOfIgnoreCase(Text text)
Returns the index within this text of the first occurrence of the substring in the specified text, ignoring case.

Parameters:
text - the subtext to search for.
Returns:
if the text argument occurs as a substring within this object, then the index of the first character of the first such substring is returned; if it does not occur as a substring, -1 is returned.
 o indexOfIgnoreCase
 public int indexOfIgnoreCase(Text text,
                              int fromIndex)
Returns the index within this text of the first occurrence of the substring of the specified text, starting at the specified index, ignoring case.

Parameters:
text - the subtext to search for.
fromIndex - the index to start the search from.
Returns:
If the text argument occurs as a substring within this object at a starting index no smaller than fromIndex, then the index of the first character of the first such substring is returned. If it does not occur as a substring starting at fromIndex or beyond, -1 is returned.
 o indexOf
 public int indexOf(boolean ignoreCase,
                    Text text,
                    int fromIndex)
Returns the index within this text of the first occurrence of the substring of the specified text, starting at the specified index. If the ignoreCase is true, then ignore case when comparing characters.

Parameters:
ignoreCase - if true, ignore case when comparing characters.
text - the subtext to search for.
fromIndex - the index to start the search from.
Returns:
If the text argument occurs as a substring within this object at a starting index no smaller than fromIndex, then the index of the first character of the first such substring is returned. If it does not occur as a substring starting at fromIndex or beyond, -1 is returned.
 o indexOf
 public int indexOf(String str)
Returns the index within this text of the first occurrence of the specified substring.

Parameters:
str - the substring to search for.
Returns:
if the string argument occurs as a substring within this object, then the index of the first character of the first such substring is returned; if it does not occur as a substring, -1 is returned.
 o indexOf
 public int indexOf(String str,
                    int fromIndex)
Returns the index within this text of the first occurrence of the specified substring, starting at the specified index.

Parameters:
str - the substring to search for.
fromIndex - the index to start the search from.
Returns:
If the string argument occurs as a substring within this object at a starting index no smaller than fromIndex, then the index of the first character of the first such substring is returned. If it does not occur as a substring starting at fromIndex or beyond, -1 is returned.
 o indexOfIgnoreCase
 public int indexOfIgnoreCase(String str)
Returns the index within this text of the first occurrence of the specified substring, ignoring case.

Parameters:
str - the substring to search for.
Returns:
if the string argument occurs as a substring within this object, then the index of the first character of the first such substring is returned; if it does not occur as a substring, -1 is returned.
 o indexOfIgnoreCase
 public int indexOfIgnoreCase(String str,
                              int fromIndex)
Returns the index within this text of the first occurrence of the specified substring, starting at the specified index, ignoring case.

Parameters:
str - the substring to search for.
fromIndex - the index to start the search from.
Returns:
If the string argument occurs as a substring within this object at a starting index no smaller than fromIndex, then the index of the first character of the first such substring is returned. If it does not occur as a substring starting at fromIndex or beyond, -1 is returned.
 o indexOf
 public int indexOf(boolean ignoreCase,
                    String str,
                    int fromIndex)
Returns the index within this text of the first occurrence of the specified substring, starting at the specified index. If the ignoreCase is true, then ignore case when comparing characters.

Parameters:
ignoreCase - if true, ignore case when comparing characters.
str - the substring to search for.
fromIndex - the index to start the search from.
Returns:
If the string argument occurs as a substring within this object at a starting index no smaller than fromIndex, then the index of the first character of the first such substring is returned. If it does not occur as a substring starting at fromIndex or beyond, -1 is returned.
 o lastIndexOf
 public int lastIndexOf(Text text)
Returns the index within this text of the rightmost occurrence of the substring in the specified text. The rightmost empty string "" is considered to occur at the index value this.length().

Parameters:
text - the subtext to search for.
Returns:
if the text argument occurs one or more times as a substring within this object, then the index of the first character of the last such substring is returned. If it does not occur as a substring, -1 is returned.
 o lastIndexOf
 public int lastIndexOf(Text text,
                        int fromIndex)
Returns the index within this text of the last occurrence of the substring in the specified text. The returned index indicates the start of the subtext, and it must be equal to or less than fromIndex.

Parameters:
text - the subtext to search for.
fromIndex - the index to start the search from.
Returns:
If the text argument occurs one or more times as a substring within this object at a starting index no greater than fromIndex, then the index of the first character of the last such substring is returned. If it does not occur as a substring starting at fromIndex or earlier, -1 is returned.
 o lastIndexOfIgnoreCase
 public int lastIndexOfIgnoreCase(Text text)
Returns the index within this text of the rightmost occurrence of the substring in the specified text, ignoring case. The rightmost empty string "" is considered to occur at the index value this.length().

Parameters:
text - the subtext to search for.
Returns:
if the text argument occurs one or more times as a substring within this object, then the index of the first character of the last such substring is returned. If it does not occur as a substring, -1 is returned.
 o lastIndexOfIgnoreCase
 public int lastIndexOfIgnoreCase(Text text,
                                  int fromIndex)
Returns the index within this text of the last occurrence of the substring in the specified text, ignoring case. The returned index indicates the start of the subtext, and it must be equal to or less than fromIndex.

Parameters:
text - the subtext to search for.
fromIndex - the index to start the search from.
Returns:
If the text argument occurs one or more times as a substring within this object at a starting index no greater than fromIndex, then the index of the first character of the last such substring is returned. If it does not occur as a substring starting at fromIndex or earlier, -1 is returned.
 o lastIndexOf
 public int lastIndexOf(boolean ignoreCase,
                        Text text,
                        int fromIndex)
Returns the index within this text of the last occurrence of the substring in the specified text. The returned index indicates the start of the subtext, and it must be equal to or less than fromIndex. If the ignoreCase is true, then ignore case when comparing characters.

Parameters:
ignoreCase - if true, ignore case when comparing characters.
text - the subtext to search for.
fromIndex - the index to start the search from.
Returns:
If the text argument occurs one or more times as a substring within this object at a starting index no greater than fromIndex, then the index of the first character of the last such substring is returned. If it does not occur as a substring starting at fromIndex or earlier, -1 is returned.
 o lastIndexOf
 public int lastIndexOf(String str)
Returns the index within this text of the rightmost occurrence of the specified substring. The rightmost empty string "" is considered to occur at the index value this.length().

Parameters:
str - the substring to search for.
Returns:
if the string argument occurs one or more times as a substring within this object, then the index of the first character of the last such substring is returned. If it does not occur as a substring, -1 is returned.
 o lastIndexOf
 public int lastIndexOf(String str,
                        int fromIndex)
Returns the index within this text of the last occurrence of the specified substring. The returned index indicates the start of the substring, and it must be equal to or less than fromIndex.

Parameters:
str - the substring to search for.
fromIndex - the index to start the search from.
Returns:
If the string argument occurs one or more times as a substring within this object at a starting index no greater than fromIndex, then the index of the first character of the last such substring is returned. If it does not occur as a substring starting at fromIndex or earlier, -1 is returned.
 o lastIndexOfIgnoreCase
 public int lastIndexOfIgnoreCase(String str)
Returns the index within this text of the rightmost occurrence of the specified substring, ignoring case. The rightmost empty string "" is considered to occur at the index value this.length().

Parameters:
str - the substring to search for.
Returns:
if the string argument occurs one or more times as a substring within this object, then the index of the first character of the last such substring is returned. If it does not occur as a substring, -1 is returned.
 o lastIndexOfIgnoreCase
 public int lastIndexOfIgnoreCase(String str,
                                  int fromIndex)
Returns the index within this text of the last occurrence of the specified substring, ignoring case. The returned index indicates the start of the substring, and it must be equal to or less than fromIndex.

Parameters:
str - the substring to search for.
fromIndex - the index to start the search from.
Returns:
If the string argument occurs one or more times as a substring within this object at a starting index no greater than fromIndex, then the index of the first character of the last such substring is returned. If it does not occur as a substring starting at fromIndex or earlier, -1 is returned.
 o lastIndexOf
 public int lastIndexOf(boolean ignoreCase,
                        String str,
                        int fromIndex)
Returns the index within this text of the last occurrence of the specified substring. The returned index indicates the start of the substring, and it must be equal to or less than fromIndex. If the ignoreCase is true, then ignore case when comparing characters.

Parameters:
ignoreCase - if true, ignore case when comparing characters.
str - the substring to search for.
fromIndex - the index to start the search from.
Returns:
If the string argument occurs one or more times as a substring within this object at a starting index no greater than fromIndex, then the index of the first character of the last such substring is returned. If it does not occur as a substring starting at fromIndex or earlier, -1 is returned.
 o removeAll
 public void removeAll()
Removes all characters from this text and sets its length to zero.

 o remove
 public void remove(int offset,
                    int size)
Removes the characters in this text from the specified offset. The number of the characters to be removed is specified by the size. Each character in this text with an index greater or equal to offset+size is shifted downward.

Parameters:
offset - the start index of the characters to be removed.
size - the number of the characters to be removed.
 o substring
 public String substring(int beginIndex)
Returns a new string that is a substring of this text. The substring begins at the specified index and extends to the end of this text.

Parameters:
beginIndex - the beginning index, inclusive.
Returns:
the substring.
 o substring
 public String substring(int beginIndex,
                         int endIndex)
Returns a new string that is a substring of this text. The substring begins at the specified beginIndex and extends to the character at index endIndex-1.

Parameters:
beginIndex - the beginning index, inclusive.
endIndex - the ending index, exclusive.
Returns:
the substring.
 o subtext
 public Text subtext(int beginIndex)
Returns a new text that is a subtext of this text. The subtext begins at the specified index and extends to the end of this text.

Parameters:
beginIndex - the beginning index, inclusive.
Returns:
the subtext.
 o subtext
 public Text subtext(int beginIndex,
                     int endIndex)
Returns a new text that is a subtext of this text. The subtext begins at the specified beginIndex and extends to the character at index endIndex-1.

Parameters:
beginIndex - the beginning index, inclusive.
endIndex - the ending index, exclusive.
Returns:
the subtext.
 o append
 public Text append(char c)
Appends the character to this text.

Parameters:
c - a character.
Returns:
this text.
 o append
 public Text append(String str)
Appends the characters of the string to this text.

Parameters:
str - a string.
Returns:
this text.
 o append
 public Text append(String str,
                    int begin,
                    int end)
Appends the characters of the string from the specified begin index to the specified endIndex-1 index.

Parameters:
str - a string.
begin - the beginning index of the string, inclusive.
end - the ending index of the string, exclusive.
Returns:
this text.
 o append
 public Text append(Text text)
Appends the specified text to this text.

Parameters:
text - a text.
Returns:
this text.
 o append
 public Text append(TextAttachment ta)
Appends the text attachment to this text.

Parameters:
ta - a text attachment.
Returns:
this text.
 o insert
 public Text insert(int offset,
                    String str)
Inserts the characters of the specified string to this text from the specified offset.

Parameters:
offset - the start index of the characters to be inserted.
str - a string.
Returns:
this text.
 o insert
 public Text insert(int offset,
                    Text text)
Inserts the components of the specified text to this text from the specified offset.

Parameters:
offset - the start index of the components to be inserted.
text - a text.
Returns:
this array.
 o replace
 public Text replace(int begin,
                     int end,
                     String str)
Replaces the components of this text with the components of the specified string.

Parameters:
begin - the beginning index to replace, inclusive.
end - the ending index to replace, exclusive.
str - a replacement string.
Returns:
this text.
 o replace
 public Text replace(int begin,
                     int end,
                     Text text)
Replaces the components of this text with the components of the specified text.

Parameters:
begin - the beginning index to replace, inclusive.
end - the ending index to replace, exclusive.
varray - a replacement text.
Returns:
this text.
 o replaceStyle
 public Text replaceStyle(int begin,
                          int end,
                          TextStyle style)
Replaces the style of this text with the specified style.

Parameters:
begin - the beginning index to replace, inclusive.
end - the ending index to replace, exclusive.
style - a replacement style.
Returns:
this text.
Throws: ArrayIndexOutOfBoundsException
if the begin, or the end is out of range.
 o modifyStyle
 public Text modifyStyle(int begin,
                         int end,
                         TextStyleModifier modifier)
Modifies the style of this text with the specified text style modifier.

Parameters:
begin - the beginning index to modify, inclusive.
end - the ending index to modify, exclusive.
modifier - the text style modifier.
Returns:
this text.
Throws: ArrayIndexOutOfBoundsException
if the begin, or the end is out of range.
 o getRunLengthAt
 public int getRunLengthAt(int index)
Returns the run length (the number of the constant occurrence) of the style at the specified index.

Parameters:
index - an index into this text.
Returns:
the run length of the style from the specified index.
 o getRunOffsetAt
 public int getRunOffsetAt(int index)
Returns the run offset (the starting index of the constant occurrence) of the style at the specified index.

Parameters:
index - an index into this text.
Returns:
the run offset of the style from the specified index.
 o cloneStyle
 public Text cloneStyle()
Returns a clone of this text. Contents of string and attachments are shared.

Returns:
a clone of this text. Contents of string and attachments are shared.
 o clone
 public Object clone()
Returns a clone of this text.

Returns:
a clone of this text.
Overrides:
clone in class Object
 o toString
 public String toString()
Returns a string representation of this text.

Overrides:
toString in class Object

All Packages  Class Hierarchy  This Package  Previous  Next  Index