implements CharSequence CharSequence GetChars Spanned
This is the class for text whose content and markup are immutable.
For mutable markup, see SpannableString
; for mutable text,
see SpannableStringBuilder
.
Inherited Constant Summary
Public Constructor Summary
SpannedString(CharSequence source)
|
Public Method Summary
final char |
charAt(int i)
Returns the
char value at the specified index. |
boolean |
equals(Object o)
|
final void |
getChars(int start, int end, char[] dest, int off)
Exactly like String.getChars(): copy chars
start
through end - 1 from this CharSequence into dest
beginning at offset destoff . |
int |
getSpanEnd(Object what)
Return the end of the range of text to which the specified
markup object is attached, or -1 if the object is not attached.
|
int |
getSpanFlags(Object what)
Return the flags that were specified when
setSpan(Object, int, int, int) was
used to attach the specified markup object, or 0 if the specified
object has not been attached. |
int |
getSpanStart(Object what)
Return the beginning of the range of text to which the specified
markup object is attached, or -1 if the object is not attached.
|
<T> T[] |
getSpans(int queryStart, int queryEnd, Class<T> kind)
Return an array of the markup objects attached to the specified
slice of this CharSequence and whose type is the specified type
or a subclass of it.
|
int |
hashCode()
|
final int |
length()
Returns the length of this character sequence.
|
int |
nextSpanTransition(int start, int limit, Class kind)
Return the first offset greater than or equal to
start
where a markup object of class type begins or ends,
or limit if there are no starts or ends greater than or
equal to start but less than limit . |
CharSequence |
subSequence(int start, int end)
Returns a new
CharSequence that is a subsequence of this sequence. |
final String |
toString()
|
static SpannedString |
valueOf(CharSequence source)
|
Inherited Method Summary
Public Constructors
public SpannedString (CharSequence source)
Parameters
source |
---|
Public Methods
public final char charAt (int i)
Returns the char
value at the specified index. An index ranges from zero
to length() - 1. The first char
value of the sequence is at
index zero, the next at index one, and so on, as for array
indexing.
If the char
value specified by the index is a
surrogate, the surrogate
value is returned.
Parameters
i | the index of the char value to be returned |
---|
Returns
- the specified
char
value
public boolean equals (Object o)
Parameters
o |
---|
public final void getChars (int start, int end, char[] dest, int off)
Exactly like String.getChars(): copy chars start
through end - 1
from this CharSequence into dest
beginning at offset destoff
.
Parameters
start | |
---|---|
end | |
dest | |
off |
public int getSpanEnd (Object what)
Return the end of the range of text to which the specified markup object is attached, or -1 if the object is not attached.
Parameters
what |
---|
public int getSpanFlags (Object what)
Return the flags that were specified when setSpan(Object, int, int, int)
was
used to attach the specified markup object, or 0 if the specified
object has not been attached.
Parameters
what |
---|
public int getSpanStart (Object what)
Return the beginning of the range of text to which the specified markup object is attached, or -1 if the object is not attached.
Parameters
what |
---|
public T[] getSpans (int queryStart, int queryEnd, Class<T> kind)
Return an array of the markup objects attached to the specified slice of this CharSequence and whose type is the specified type or a subclass of it. Specify Object.class for the type if you want all the objects regardless of type.
Parameters
queryStart | |
---|---|
queryEnd | |
kind |
public int hashCode ()
public final int length ()
Returns the length of this character sequence. The length is the number
of 16-bit char
s in the sequence.
Returns
- the number of
char
s in this sequence
public int nextSpanTransition (int start, int limit, Class kind)
Return the first offset greater than or equal to start
where a markup object of class type
begins or ends,
or limit
if there are no starts or ends greater than or
equal to start
but less than limit
. Specify
null
or Object.class for the type if you want every
transition regardless of type.
Parameters
start | |
---|---|
limit | |
kind |
public CharSequence subSequence (int start, int end)
Returns a new CharSequence
that is a subsequence of this sequence.
The subsequence starts with the char
value at the specified index and
ends with the char
value at index end - 1. The length
(in char
s) of the
returned sequence is end - start, so if start == end
then an empty sequence is returned.
Parameters
start | the start index, inclusive |
---|---|
end | the end index, exclusive |
Returns
- the specified subsequence