Added in API level 1
Deprecated in API level 30

AlteredCharSequence


public class AlteredCharSequence
extends Object implements CharSequence, GetChars

java.lang.Object
   ↳ android.text.AlteredCharSequence


This class was deprecated in API level 30.
The functionality this class offers is easily implemented outside the framework.

An 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.

Summary

Public methods

char charAt(int off)

Returns the char value at the specified index.

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 length()

Returns the length of this character sequence.

static AlteredCharSequence make(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.

CharSequence subSequence(int start, int end)

Returns a CharSequence that is a subsequence of this sequence.

String toString()

Returns a string representation of the object.

Inherited methods

Object clone()

Creates and returns a copy of this object.

boolean equals(Object obj)

Indicates whether some other object is "equal to" this one.

void finalize()

Called by the garbage collector on an object when garbage collection determines that there are no more references to the object.

final Class<?> getClass()

Returns the runtime class of this Object.

int hashCode()

Returns a hash code value for the object.

final void notify()

Wakes up a single thread that is waiting on this object's monitor.

final void notifyAll()

Wakes up all threads that are waiting on this object's monitor.

String toString()

Returns a string representation of the object.

final void wait(long timeoutMillis, int nanos)

Causes the current thread to wait until it is awakened, typically by being notified or interrupted, or until a certain amount of real time has elapsed.

final void wait(long timeoutMillis)

Causes the current thread to wait until it is awakened, typically by being notified or interrupted, or until a certain amount of real time has elapsed.

final void wait()

Causes the current thread to wait until it is awakened, typically by being notified or interrupted.

abstract char charAt(int index)

Returns the char value at the specified index.

default IntStream chars()

Returns a stream of int zero-extending the char values from this sequence.

default IntStream codePoints()

Returns a stream of code point values from this sequence.

static int compare(CharSequence cs1, CharSequence cs2)

Compares two CharSequence instances lexicographically.

default boolean isEmpty()

Returns true if this character sequence is empty.

abstract int length()

Returns the length of this character sequence.

abstract CharSequence subSequence(int start, int end)

Returns a CharSequence that is a subsequence of this sequence.

abstract String toString()

Returns a string containing the characters in this sequence in the same order as this sequence.

abstract void getChars(int start, int end, char[] dest, int destoff)

Exactly like String.getChars(): copy chars start through end - 1 from this CharSequence into dest beginning at offset destoff.

Public methods

charAt

Added in API level 1
public char charAt (int off)

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
off int: the index of the char value to be returned

Returns
char the specified char value

getChars

Added in API level 1
public 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 int

end int

dest char

off int

length

Added in API level 1
public int length ()

Returns the length of this character sequence. The length is the number of 16-bit chars in the sequence.

Returns
int the number of chars in this sequence

make

Added in API level 1
public static AlteredCharSequence make (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.

Parameters
source CharSequence

sub char

substart int

subend int

subSequence

Added in API level 1
public CharSequence subSequence (int start, 
                int end)

Returns a 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 chars) of the returned sequence is end - start, so if start == end then an empty sequence is returned.

Parameters
start int: the start index, inclusive

end int: the end index, exclusive

Returns
CharSequence the specified subsequence

toString

Added in API level 1
public String toString ()

Returns a string representation of the object.

Returns
String a string representation of the object.