public final class UCharArrayIterator extends UCharacterIterator
DONE| Constructor and Description |
|---|
UCharArrayIterator(char[] text,
int start,
int limit) |
| Modifier and Type | Method and Description |
|---|---|
Object |
clone()
Creates a copy of this iterator, does not clone the underlying
Replaceableobject |
int |
current()
Returns the code unit at the current index.
|
int |
getIndex()
Gets the current index in text.
|
int |
getLength()
Returns the length of the text
|
int |
getText(char[] fillIn,
int offset)
Fills the buffer with the underlying text storage of the iterator If the buffer capacity is not enough a
exception is thrown.
|
int |
next()
Returns the UTF16 code unit at index, and increments to the next code unit (post-increment semantics).
|
int |
previous()
Decrement to the position of the previous code unit in the text, and return it (pre-decrement semantics).
|
void |
setIndex(int index)
Sets the index to the specified index in the text.
|
currentCodePoint, getCharacterIterator, getInstance, getInstance, getInstance, getInstance, getInstance, getInstance, getText, getText, moveCodePointIndex, moveIndex, nextCodePoint, previousCodePoint, setToLimit, setToStartpublic int current()
UCharacterIteratorcurrent in class UCharacterIteratorpublic int getLength()
UCharacterIteratorgetLength in class UCharacterIteratorpublic int getIndex()
UCharacterIteratorgetIndex in class UCharacterIteratorpublic int next()
UCharacterIteratornext in interface UForwardCharacterIteratornext in class UCharacterIteratorpublic int previous()
UCharacterIteratorprevious in class UCharacterIteratorpublic void setIndex(int index)
UCharacterIteratorsetIndex in class UCharacterIteratorindex - the index within the text.public int getText(char[] fillIn,
int offset)
UCharacterIteratorgetLength()). Usage:
UChacterIterator iter = new UCharacterIterator.getInstance(text);
char[] buf = new char[iter.getLength()];
iter.getText(buf);
OR
char[] buf= new char[1];
int len = 0;
for(;;){
try{
len = iter.getText(buf);
break;
}catch(IndexOutOfBoundsException e){
buf = new char[iter.getLength()];
}
}
getText in class UCharacterIteratorfillIn - an array of chars to fill with the underlying UTF-16 code units.offset - the position within the array to start putting the data.public Object clone()
Replaceableobjectclone in class UCharacterIterator