public class CharacterIteratorWrapper extends UCharacterIterator
DONE| Constructor and Description |
|---|
CharacterIteratorWrapper(CharacterIterator iter) |
| Modifier and Type | Method and Description |
|---|---|
Object |
clone()
Creates a clone of this iterator.
|
int |
current()
Returns the code unit at the current index.
|
CharacterIterator |
getCharacterIterator()
Returns a
java.text.CharacterIterator object for
the underlying text of this iterator. |
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 |
moveIndex(int delta)
Moves the current position by the number of code units
specified, either forward or backward depending on the sign
of delta (positive or negative respectively).
|
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.
|
void |
setToLimit()
Sets the current index to the limit.
|
currentCodePoint, getInstance, getInstance, getInstance, getInstance, getInstance, getInstance, getText, getText, moveCodePointIndex, nextCodePoint, previousCodePoint, setToStartpublic CharacterIteratorWrapper(CharacterIterator iter)
public int current()
UCharacterIteratorcurrent in class UCharacterIteratorUCharacterIterator.current()public int getLength()
UCharacterIteratorgetLength in class UCharacterIteratorUCharacterIterator.getLength()public int getIndex()
UCharacterIteratorgetIndex in class UCharacterIteratorUCharacterIterator.getIndex()public int next()
UCharacterIteratornext in interface UForwardCharacterIteratornext in class UCharacterIteratorUCharacterIterator.next()public int previous()
UCharacterIteratorprevious in class UCharacterIteratorUCharacterIterator.previous()public void setIndex(int index)
UCharacterIteratorsetIndex in class UCharacterIteratorindex - the index within the text.UCharacterIterator.setIndex(int)public void setToLimit()
UCharacterIteratorsetToLimit in class UCharacterIteratorUCharacterIterator.setToLimit()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.UCharacterIterator.getText(char[])public Object clone()
clone in class UCharacterIteratorUCharacterIterator.clone()public int moveIndex(int delta)
UCharacterIteratormoveIndex in class UCharacterIteratordelta - the number of code units to move the current
index.public CharacterIterator getCharacterIterator()
UCharacterIteratorjava.text.CharacterIterator object for
the underlying text of this iterator. The returned iterator is
independent of this iterator.getCharacterIterator in class UCharacterIteratorUCharacterIterator.getCharacterIterator()