AlteredCharSequencepublic class AlteredCharSequence extends Object implements CharSequence, GetCharsAn AlteredCharSequence is a CharSequence that is largely mirrored from
another CharSequence, except that a specified range of characters are
mirrored from a different char array instead. |
Fields Summary |
---|
private int | mStart | private int | mEnd | private char[] | mChars | private CharSequence | mSource |
Constructors Summary |
---|
private AlteredCharSequence(CharSequence source, char[] sub, int substart, int subend)
mSource = source;
mChars = sub;
mStart = substart;
mEnd = subend;
|
Methods Summary |
---|
public char | charAt(int off)
if (off >= mStart && off < mEnd)
return mChars[off - mStart];
else
return mSource.charAt(off);
| public void | getChars(int start, int end, char[] dest, int off)
TextUtils.getChars(mSource, start, end, dest, off);
start = Math.max(mStart, start);
end = Math.min(mEnd, end);
if (start > end)
System.arraycopy(mChars, start - mStart, dest, off, end - start);
| public int | length()
return mSource.length();
| public static android.text.AlteredCharSequence | make(java.lang.CharSequence source, char[] sub, int substart, int subend)Create an AlteredCharSequence whose text (and possibly spans)
are mirrored from source , except that the range of
offsets substart inclusive to subend exclusive
are mirrored instead from sub , beginning at offset 0.
if (source instanceof Spanned)
return new AlteredSpanned(source, sub, substart, subend);
else
return new AlteredCharSequence(source, sub, substart, subend);
| public java.lang.CharSequence | subSequence(int start, int end)
return AlteredCharSequence.make(mSource.subSequence(start, end),
mChars, mStart - start, mEnd - start);
| public java.lang.String | toString()
int len = length();
char[] ret = new char[len];
getChars(0, len, ret, 0);
return String.valueOf(ret);
| void | update(char[] sub, int substart, int subend)
mChars = sub;
mStart = substart;
mEnd = subend;
|
|