public class Text
extends java.lang.Object
implements java.lang.Cloneable, java.io.Serializable
Text class implements the growable string with style
(TextStyle) and visual items (TextAttachment).
In the Text, following three characters has special meaning:
'\n''\r''\FFFE'
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
TextStyle,
TextAttachment,
直列化された形式| 修飾子とタイプ | フィールドと説明 |
|---|---|
static char |
ATTACHMENT_CHAR
The text attachment mark that indicates the position of
the text attachment.
|
protected java.util.Hashtable |
attachments
The maps from the index of the text to the text attachment.
|
protected static int |
DEFAULT_MAX_CAPACITY_INCREMENT
The default maximum amount by which the capacity of the string
is automatically incremented.
|
static char |
LINE_BREAK_CHAR
The line break that breaks the line but not separate the
paragraph.
|
static char |
LINE_SEPARATOR_CHAR
The line (paragraph) separator that breaks the line and
separates the paragraph.
|
static char |
LIST_COL_SEPARATOR_CHAR
The list column separator that separates the list column.
|
static char |
LIST_SEPARATOR_CHAR
The list separator that separates the list item.
|
protected RunArray |
runs
The space-efficient text style array.
|
protected VArray |
string
The growable string.
|
| 修飾子 | コンストラクタと説明 |
|---|---|
|
Text()
Constructs an empty text.
|
protected |
Text(char[] array,
int arrayLength,
TextStyle style)
Constructs a text with the array buffer and the preferred length,
whose every style equals to the specified style.
|
protected |
Text(char[] array,
int arrayLength,
TextStyle style,
int maxCapacityIncrement)
Constructs a text with the array buffer, the preferred length,
and the maximum capacity increment size, whose every style equals
to the specified style.
|
|
Text(int initialCapacity)
Constructs an empty text with the initial capacity.
|
|
Text(int initialCapacity,
int maxCapacityIncrement)
Constructs an empty text with the initial capacity and the
maximum capacity increment size.
|
|
Text(java.lang.String str)
Constructs a text with the contents of the string, whose every
style equals to the default style.
|
|
Text(java.lang.String str,
TextStyle style)
Constructs a text with the contents of the string, whose every
style equals to the specified style.
|
|
Text(java.lang.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.
|
|
Text(TextAttachment ta)
Constructs a text with the text attachment, whose every style
equals to the default style.
|
|
Text(TextAttachment ta,
TextStyle style)
Constructs a text with the text attachment, whose every style
equals to the specified style.
|
|
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.
|
protected |
Text(VArray string,
RunArray runs,
java.util.Hashtable attachments)
Constructs a text with the string, the runs, and the attachments.
|
|
Text(Visualizable visualizable)
Constructs a text with the visual object, whose every style
equals to the default style.
|
| 修飾子とタイプ | メソッドと説明 |
|---|---|
Text |
append(char c)
Appends the character to this text.
|
Text |
append(java.lang.String str)
Appends the characters of the
string to this text. |
Text |
append(java.lang.String str,
int begin,
int end)
Appends the characters of the
string from the specified
begin index to the specified endIndex-1 index. |
Text |
append(Text text)
Appends the specified text to this text.
|
Text |
append(TextAttachment ta)
Appends the text attachment to this text.
|
protected Text |
baseStyleOn(int begin,
int end,
TextStyle baseStyle)
Modifies the style of this text to be based on the specified base
text style.
|
char |
charAt(int index)
Returns the character at the specified index.
|
java.lang.Object |
clone()
Returns a clone of this text.
|
Text |
cloneStyle()
Returns a clone of this text.
|
protected int |
compareTo(char[] array,
int length)
Compares this text with the character array argument lexicographically.
|
int |
compareTo(java.lang.String anotherString)
Compares this text with the string argument lexicographically.
|
int |
compareTo(Text anotherText)
Compares two texts lexicographically.
|
static void |
copyJavaToSystemReadWriter(java.io.Reader javaReader,
java.io.Writer sysWriter)
Copies the contents of the specified reader into the specified writer
with a conversion from CR or LF to the system line separator.
|
static void |
copyJavaToSystemReadWriter(java.io.Reader javaReader,
java.io.Writer sysWriter,
java.lang.String separator)
Copies the contents of the specified reader into the specified writer
with a conversion from CR or LF to the specified separator.
|
static void |
copySystemToJavaReadWriter(java.io.Reader sysReader,
java.io.Writer javaWriter)
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.
|
static void |
copySystemToJavaReadWriter(java.io.Reader sysReader,
java.io.Writer javaWriter,
int separatorChar)
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.
|
boolean |
equals(java.lang.Object anObject)
Compares two objects for equality.
|
TextAttachment |
getAttachmentAt(int index)
Returns the text attachment at the specified index.
|
int |
getAttachmentCount()
Returns the number of the text attachments in this text.
|
java.util.Hashtable |
getAttachments()
Returns all text attachments in this text as a hashtable.
|
char |
getChar(int index)
Returns the character at the specified index.
|
java.text.CharacterIterator |
getCharacterIterator()
Returns the character iterator for this text.
|
java.text.CharacterIterator |
getCharacterIterator(int pos)
Returns the character iterator for this text, with the specified
initial index.
|
java.text.CharacterIterator |
getCharacterIterator(int begin,
int end,
int pos)
Returns the character iterator for this text, with the specified
range and initial index.
|
protected char[] |
getCharArray()
Returns the array of char in this text.
|
void |
getChars(int srcBegin,
int srcEnd,
char[] dst,
int dstBegin)
Copies characters from this text into the destination character array.
|
static java.lang.String |
getJavaString(java.lang.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.
|
static java.lang.String |
getJavaString(java.lang.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.
|
int |
getRunLengthAt(int index)
Returns the run length (the number of the constant occurrence)
of the style at the specified index.
|
int |
getRunOffsetAt(int index)
Returns the run offset (the starting index of the constant
occurrence) of the style at the specified index.
|
static java.lang.String |
getSystemString(java.lang.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.
|
static java.lang.String |
getSystemString(java.lang.String javaString,
java.lang.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.
|
RunArray |
getTextStyleArray(int begin,
int end)
Returns the run array representation of the text styles in this text.
|
TextStyle |
getTextStyleAt(int index)
Returns the text style at the specified index.
|
int |
getTextStyleCount()
Returns the number of the text styles in this text.
|
RunArray |
getTextStyleRuns()
Returns the text styles as a run array in this text.
|
TextStyle[] |
getTextStyles()
Returns all text styles in this text.
|
TextStyle[] |
getTextStyles(int begin,
int end)
Returns the text styles in this text.
|
int |
hashCode()
Returns a hashcode for this text.
|
protected int |
indexOf(boolean ignoreCase,
char[] array,
int length,
int fromIndex)
Returns the index within this text of the first occurrence of the
specified character array whose length is the specified
length, starting at the specified index. |
int |
indexOf(boolean ignoreCase,
java.lang.String str,
int fromIndex)
Returns the index within this text of the first occurrence of the
specified substring, starting at the specified index.
|
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.
|
int |
indexOf(int ch)
Returns the index within this text of the first occurrence of the
specified character.
|
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.
|
int |
indexOf(java.lang.String str)
Returns the index within this text of the first occurrence of the
specified substring.
|
int |
indexOf(java.lang.String str,
int fromIndex)
Returns the index within this text of the first occurrence of the
specified substring, starting at the specified index.
|
int |
indexOf(Text text)
Returns the index within this text of the first occurrence of the
substring in the specified text.
|
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.
|
int |
indexOfIgnoreCase(java.lang.String str)
Returns the index within this text of the first occurrence of the
specified substring, ignoring case.
|
int |
indexOfIgnoreCase(java.lang.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.
|
int |
indexOfIgnoreCase(Text text)
Returns the index within this text of the first occurrence of the
substring in the specified text, ignoring case.
|
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.
|
Text |
insert(int offset,
java.lang.String str)
Inserts the characters of the specified string to this text from
the specified
offset. |
Text |
insert(int offset,
Text text)
Inserts the components of the specified text to this text from
the specified
offset. |
boolean |
isEmpty()
Tests if this text has no characters.
|
protected int |
lastIndexOf(boolean ignoreCase,
char[] array,
int length,
int fromIndex)
Returns the index within this text of the last occurrence of
the specified character array whose length is the specified
length. |
int |
lastIndexOf(boolean ignoreCase,
java.lang.String str,
int fromIndex)
Returns the index within this text of the last occurrence of the
specified substring.
|
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.
|
int |
lastIndexOf(int ch)
Returns the index within this text of the last occurrence of the
specified character.
|
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.
|
int |
lastIndexOf(java.lang.String str)
Returns the index within this text of the rightmost occurrence of the
specified substring.
|
int |
lastIndexOf(java.lang.String str,
int fromIndex)
Returns the index within this text of the last occurrence of the
specified substring.
|
int |
lastIndexOf(Text text)
Returns the index within this text of the rightmost occurrence of the
substring in the specified text.
|
int |
lastIndexOf(Text text,
int fromIndex)
Returns the index within this text of the last occurrence of the
substring in the specified text.
|
int |
lastIndexOfIgnoreCase(java.lang.String str)
Returns the index within this text of the rightmost occurrence of the
specified substring, ignoring case.
|
int |
lastIndexOfIgnoreCase(java.lang.String str,
int fromIndex)
Returns the index within this text of the last occurrence of the
specified substring, ignoring case.
|
int |
lastIndexOfIgnoreCase(Text text)
Returns the index within this text of the rightmost occurrence of the
substring in the specified text, ignoring case.
|
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.
|
int |
length()
Returns the length of this text.
|
Text |
modifyStyle(int begin,
int end,
TextStyleModifier modifier)
Modifies the style of this text with the specified text style modifier.
|
boolean |
regionMatches(boolean ignoreCase,
int toffset,
java.lang.String other,
int ooffset,
int len)
Tests if the text region and the string region are equal.
|
boolean |
regionMatches(boolean ignoreCase,
int toffset,
Text other,
int ooffset,
int len)
Tests if two text regions are equal.
|
boolean |
regionMatches(int toffset,
java.lang.String other,
int ooffset,
int len)
Tests if the text region and the string are equal.
|
boolean |
regionMatches(int toffset,
Text other,
int ooffset,
int len)
Tests if two text regions are equal.
|
void |
remove(int offset,
int size)
Removes the characters in this text from the specified
offset. |
void |
removeAll()
Removes all characters from this text and sets its length to zero.
|
Text |
replace(int begin,
int end,
java.lang.String str)
Replaces the components of this text with the components of the
specified string.
|
Text |
replace(int begin,
int end,
Text text)
Replaces the components of this text with the components of the
specified text.
|
Text |
replaceStyle(int begin,
int end,
TextStyle style)
Replaces the style of this text with the specified style.
|
void |
setAttachmentAt(int index,
TextAttachment ta)
Sets the component at the specified index of this text to be
the specified text attachment.
|
void |
setChar(int index,
char c)
Sets the component at the specified index of this text to be
the specified character.
|
void |
setCharAt(int index,
char c)
Sets the component at the specified index of this text to be
the specified character.
|
java.lang.String |
substring(int beginIndex)
Returns a new string that is a substring of this text.
|
java.lang.String |
substring(int beginIndex,
int endIndex)
Returns a new string that is a substring of this text.
|
Text |
subtext(int beginIndex)
Returns a new text that is a subtext of this text.
|
Text |
subtext(int beginIndex,
int endIndex)
Returns a new text that is a subtext of this text.
|
java.util.Enumeration |
textStyles()
Returns an enumeration of the text styles of this text.
|
java.util.Enumeration |
textStyles(int begin,
int end)
Returns an enumeration of the text styles of this text.
|
java.lang.String |
toString()
Returns a string representation of this text.
|
protected VArray string
protected RunArray runs
protected java.util.Hashtable attachments
public static final char LINE_SEPARATOR_CHAR
public static final char LINE_BREAK_CHAR
public static final char LIST_SEPARATOR_CHAR
TextScanner.LIST_STOPS,
定数フィールド値public static final char LIST_COL_SEPARATOR_CHAR
public static final char ATTACHMENT_CHAR
TextScanner,
定数フィールド値public Text()
public Text(int initialCapacity)
initialCapacity - the initial capacity of the text.public Text(int initialCapacity,
int maxCapacityIncrement)
initialCapacity - the initial capacity of the text.maxCapacityIncrement - the maximum amount by which the capacity
is increased when the text overflows.public Text(java.lang.String str)
str - a string.public Text(java.lang.String str,
TextStyle style)
str - a string.style - the style of the text.public Text(java.lang.String str,
TextStyle style,
int maxCapacityIncrement)
str - a string.style - the style of the text.maxCapacityIncrement - the maximum amount by which the capacity
is increased when the text overflows.public Text(Visualizable visualizable)
visualizable - a visual object.public Text(TextAttachment ta)
ta - a text attachment.public Text(TextAttachment ta, TextStyle style)
ta - a text attachment.style - the style of the text.public Text(TextAttachment ta, TextStyle style, int maxCapacityIncrement)
ta - a text attachment.style - the style of the text.maxCapacityIncrement - the maximum amount by which the capacity
is increased when the text overflows.protected Text(char[] array,
int arrayLength,
TextStyle style)
array - the array buffer of the text.arrayLength - the preferred length of the text.style - the style of the text.protected Text(char[] array,
int arrayLength,
TextStyle style,
int maxCapacityIncrement)
array - the array buffer of the text.arrayLength - the preferred length of the text.style - the style of the text.maxCapacityIncrement - the maximum amount by which the capacity
is increased when the text overflows.public static java.lang.String getJavaString(java.lang.String sysString)
sysString - the platform string.getJavaString(java.lang.String, int)public static java.lang.String getJavaString(java.lang.String sysString,
int separatorChar)
sysString - the platform string.separator - the specified separator character.copySystemToJavaReadWriter(java.io.Reader, java.io.Writer, int)public static java.lang.String getSystemString(java.lang.String javaString)
javaString - the string whose internal representation is suitable
for the text.getSystemString(java.lang.String, java.lang.String)public static java.lang.String getSystemString(java.lang.String javaString,
java.lang.String separator)
javaString - the string whose internal representation is suitable
for the text.separator - the specified separator string.copyJavaToSystemReadWriter(java.io.Reader, java.io.Writer, java.lang.String)public static void copySystemToJavaReadWriter(java.io.Reader sysReader,
java.io.Writer javaWriter)
throws java.io.IOException
sysReader - the specified reader.javaWriter - the specified writer.java.io.IOException - If an I/O error occurs.copySystemToJavaReadWriter(java.io.Reader, java.io.Writer, int)public static void copySystemToJavaReadWriter(java.io.Reader sysReader,
java.io.Writer javaWriter,
int separatorChar)
throws java.io.IOException
sysReader - the specified reader.javaWriter - the specified writer.separatorChar - the specified separator character.java.io.IOException - If an I/O error occurs.public static void copyJavaToSystemReadWriter(java.io.Reader javaReader,
java.io.Writer sysWriter)
throws java.io.IOException
javaReader - the specified reader.sysWriter - the specified writer.java.io.IOException - If an I/O error occurs.copyJavaToSystemReadWriter(java.io.Reader, java.io.Writer, java.lang.String)public static void copyJavaToSystemReadWriter(java.io.Reader javaReader,
java.io.Writer sysWriter,
java.lang.String separator)
throws java.io.IOException
javaReader - the specified reader.sysWriter - the specified writer.separator - the specified separator string.java.io.IOException - If an I/O error occurs.protected final char[] getCharArray()
public final java.text.CharacterIterator getCharacterIterator()
public final java.text.CharacterIterator getCharacterIterator(int pos)
pos - initial iterator position.public final java.text.CharacterIterator getCharacterIterator(int begin,
int end,
int pos)
begin - index of the first character.end - index of the character following the last character.pos - initial iterator position.public final java.util.Enumeration textStyles()
public final java.util.Enumeration textStyles(int begin,
int end)
begin - the beginning index to get styles, inclusive.end - the ending index to get styles, exclusive.public final RunArray getTextStyleRuns()
public final TextStyle getTextStyleAt(int index)
index - an index into this text.public final int getTextStyleCount()
public final TextStyle[] getTextStyles()
public final TextStyle[] getTextStyles(int begin, int end)
begin - the beginning index to get text styles, inclusive.end - the ending index to get text styles, exclusive.public final RunArray getTextStyleArray(int begin, int end)
begin - the beginning index to get text styles, inclusive.end - the ending index to get text styles, exclusive.public final int getAttachmentCount()
public final java.util.Hashtable getAttachments()
public final TextAttachment getAttachmentAt(int index)
index - an index into this text.null otherwise.public final void setAttachmentAt(int index,
TextAttachment ta)
index - the specified index.ta - the specified text attachment.public final char charAt(int index)
index - an index into this text.public final void setCharAt(int index,
char c)
index - the specified index.c - the specified character.public final char getChar(int index)
index - an index into this text.public final void setChar(int index,
char c)
index - the specified index.c - the specified character.public void getChars(int srcBegin,
int srcEnd,
char[] dst,
int dstBegin)
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.java.lang.ArrayIndexOutOfBoundsException - If srcBegin or srcEnd is out
of range, or if srcBegin is greater than the srcEnd.public final boolean isEmpty()
true if this text has no characters;
false otherwise.public final int length()
public int hashCode()
hashCode クラス内 java.lang.Objectpublic boolean equals(java.lang.Object anObject)
equals クラス内 java.lang.Objectpublic int compareTo(Text anotherText)
anotherText - the Text to be compared.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.public int compareTo(java.lang.String anotherString)
anotherString - the String to be compared.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.protected int compareTo(char[] array,
int length)
array - the character array to be compared.length - the length of the character array to be compared.0 if the array argument is equal to
this text; a value less than 0 if this text
is lexicographically less than the array argument; and a
value greater than 0 if this text is
lexicographically greater than the array argument.public boolean regionMatches(int toffset,
Text other,
int ooffset,
int len)
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.
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.true if the specified subregion of this text
exactly matches the specified subregion of the text argument;
false otherwise.public boolean regionMatches(int toffset,
java.lang.String other,
int ooffset,
int len)
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.
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.true if the specified subregion of this text
exactly matches the specified subregion of the string argument;
false otherwise.public boolean regionMatches(boolean ignoreCase,
int toffset,
Text other,
int ooffset,
int len)
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.
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.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.public boolean regionMatches(boolean ignoreCase,
int toffset,
java.lang.String other,
int ooffset,
int len)
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.
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.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.public int indexOf(int ch)
ch - a character.-1 if the character does not occur.public int indexOf(int ch,
int fromIndex)
ch - a character.fromIndex - the index to start the search from.fromIndex, or -1
if the character does not occur.public int lastIndexOf(int ch)
ch - a character.-1 if the character does not occur.public int lastIndexOf(int ch,
int fromIndex)
ch - a character.fromIndex - the index to start the search from.fromIndex, or -1
if the character does not occur before that point.public int indexOf(Text text)
text - the subtext to search for.-1 is returned.public int indexOf(Text text, int fromIndex)
text - the subtext to search for.fromIndex - the index to start the search from.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.public int indexOfIgnoreCase(Text text)
text - the subtext to search for.-1 is returned.public int indexOfIgnoreCase(Text text, int fromIndex)
text - the subtext to search for.fromIndex - the index to start the search from.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.public int indexOf(boolean ignoreCase,
Text text,
int fromIndex)
ignoreCase is true, then ignore case when
comparing characters.ignoreCase - if true, ignore case when comparing
characters.text - the subtext to search for.fromIndex - the index to start the search from.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.public int indexOf(java.lang.String str)
str - the substring to search for.-1 is returned.public int indexOf(java.lang.String str,
int fromIndex)
str - the substring to search for.fromIndex - the index to start the search from.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.public int indexOfIgnoreCase(java.lang.String str)
str - the substring to search for.-1 is returned.public int indexOfIgnoreCase(java.lang.String str,
int fromIndex)
str - the substring to search for.fromIndex - the index to start the search from.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.public int indexOf(boolean ignoreCase,
java.lang.String str,
int fromIndex)
ignoreCase is true, then ignore case when
comparing characters.ignoreCase - if true, ignore case when comparing
characters.str - the substring to search for.fromIndex - the index to start the search from.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.public int lastIndexOf(Text text)
this.length().text - the subtext to search for.-1 is returned.public int lastIndexOf(Text text, int fromIndex)
fromIndex.text - the subtext to search for.fromIndex - the index to start the search from.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.public int lastIndexOfIgnoreCase(Text text)
this.length().text - the subtext to search for.-1 is returned.public int lastIndexOfIgnoreCase(Text text, int fromIndex)
fromIndex.text - the subtext to search for.fromIndex - the index to start the search from.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.public int lastIndexOf(boolean ignoreCase,
Text text,
int fromIndex)
fromIndex.
If the ignoreCase is true, then ignore case when
comparing characters.ignoreCase - if true, ignore case when comparing
characters.text - the subtext to search for.fromIndex - the index to start the search from.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.public int lastIndexOf(java.lang.String str)
this.length().str - the substring to search for.-1 is returned.public int lastIndexOf(java.lang.String str,
int fromIndex)
fromIndex.str - the substring to search for.fromIndex - the index to start the search from.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.public int lastIndexOfIgnoreCase(java.lang.String str)
this.length().str - the substring to search for.-1 is returned.public int lastIndexOfIgnoreCase(java.lang.String str,
int fromIndex)
fromIndex.str - the substring to search for.fromIndex - the index to start the search from.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.public int lastIndexOf(boolean ignoreCase,
java.lang.String str,
int fromIndex)
fromIndex.
If the ignoreCase is true, then ignore case when
comparing characters.ignoreCase - if true, ignore case when comparing
characters.str - the substring to search for.fromIndex - the index to start the search from.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.protected int indexOf(boolean ignoreCase,
char[] array,
int length,
int fromIndex)
length, starting at the specified index.
If the ignoreCase is true, then ignore case when
comparing characters.ignoreCase - if true, ignore case when comparing
characters.array - the character array to search for.length - the length of the character array.fromIndex - the index to start the search from.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.protected int lastIndexOf(boolean ignoreCase,
char[] array,
int length,
int fromIndex)
length.
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.ignoreCase - if true, ignore case when comparing
characters.array - the character array to search for.length - the length of the character array.fromIndex - the index to start the search from.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.public void removeAll()
public void remove(int offset,
int size)
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.offset - the start index of the characters to be removed.size - the number of the characters to be removed.public java.lang.String substring(int beginIndex)
beginIndex - the beginning index, inclusive.public java.lang.String substring(int beginIndex,
int endIndex)
beginIndex and extends to the
character at index endIndex-1.beginIndex - the beginning index, inclusive.endIndex - the ending index, exclusive.public Text subtext(int beginIndex)
beginIndex - the beginning index, inclusive.public Text subtext(int beginIndex, int endIndex)
beginIndex and extends to the
character at index endIndex-1.beginIndex - the beginning index, inclusive.endIndex - the ending index, exclusive.public Text append(char c)
c - a character.public Text append(java.lang.String str)
string to this text.str - a string.public Text append(java.lang.String str, int begin, int end)
string from the specified
begin index to the specified endIndex-1 index.str - a string.begin - the beginning index of the string, inclusive.end - the ending index of the string, exclusive.public Text append(Text text)
text - a text.public Text append(TextAttachment ta)
ta - a text attachment.public Text insert(int offset, java.lang.String str)
offset.offset - the start index of the characters to be inserted.str - a string.public Text insert(int offset, Text text)
offset.offset - the start index of the components to be inserted.text - a text.public Text replace(int begin, int end, java.lang.String str)
begin - the beginning index to replace, inclusive.end - the ending index to replace, exclusive.str - a replacement string.public Text replace(int begin, int end, Text text)
begin - the beginning index to replace, inclusive.end - the ending index to replace, exclusive.varray - a replacement text.public Text replaceStyle(int begin, int end, TextStyle style)
begin - the beginning index to replace, inclusive.end - the ending index to replace, exclusive.style - a replacement style.java.lang.ArrayIndexOutOfBoundsException - if the begin, or
the end is out of range.public Text modifyStyle(int begin, int end, TextStyleModifier modifier)
begin - the beginning index to modify, inclusive.end - the ending index to modify, exclusive.modifier - the text style modifier.java.lang.ArrayIndexOutOfBoundsException - if the begin, or
the end is out of range.protected Text baseStyleOn(int begin, int end, TextStyle baseStyle)
ParagraphStyle.
An application should/can not perform this operation.
begin - the beginning index to base, inclusive.end - the ending index to base, exclusive.baseStyle - the base text style.java.lang.ArrayIndexOutOfBoundsException - if the begin, or
the end is out of range.ParagraphStyle,
ModTextStyle,
RichText,
TextStyle.basedOn(jp.kyasu.graphics.TextStyle)public int getRunLengthAt(int index)
index - an index into this text.public int getRunOffsetAt(int index)
index - an index into this text.public Text cloneStyle()
public java.lang.Object clone()
clone クラス内 java.lang.Objectpublic java.lang.String toString()
toString クラス内 java.lang.Object