public class ReplaceableUCharacterIterator extends UCharacterIterator
DONE| Constructor and Description |
|---|
ReplaceableUCharacterIterator(Replaceable replaceable)
Public constructor
|
ReplaceableUCharacterIterator(String str)
Public constructor
|
ReplaceableUCharacterIterator(StringBuffer buf)
Public constructor
|
| Modifier and Type | Method and Description |
|---|---|
Object |
clone()
Creates a copy of this iterator, does not clone the underlying
Replaceableobject |
int |
current()
Returns the current UTF16 character.
|
int |
currentCodePoint()
Returns the current codepoint
|
int |
getIndex()
Gets the current currentIndex 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 next UTF16 character and increments the iterator's currentIndex by 1.
|
int |
previous()
Returns previous UTF16 character and decrements the iterator's currentIndex by
1.
|
void |
setIndex(int currentIndex)
Sets the currentIndex to the specified currentIndex in the text and returns that
single UTF16 character at currentIndex.
|
getCharacterIterator, getInstance, getInstance, getInstance, getInstance, getInstance, getInstance, getText, getText, moveCodePointIndex, moveIndex, nextCodePoint, previousCodePoint, setToLimit, setToStartpublic ReplaceableUCharacterIterator(Replaceable replaceable)
replaceable - text which the iterator will be based onpublic ReplaceableUCharacterIterator(String str)
str - text which the iterator will be based onpublic ReplaceableUCharacterIterator(StringBuffer buf)
buf - buffer of text on which the iterator will be basedpublic Object clone()
Replaceableobjectclone in class UCharacterIteratorpublic int current()
current in class UCharacterIteratorpublic int currentCodePoint()
currentCodePoint in class UCharacterIteratorpublic int getLength()
getLength in class UCharacterIteratorpublic int getIndex()
getIndex in class UCharacterIteratorpublic int next()
next in interface UForwardCharacterIteratornext in class UCharacterIteratorpublic int previous()
previous in class UCharacterIteratorpublic void setIndex(int currentIndex)
throws IndexOutOfBoundsException
Sets the currentIndex to the specified currentIndex in the text and returns that single UTF16 character at currentIndex. This assumes the text is stored as 16-bit code units.
setIndex in class UCharacterIteratorcurrentIndex - the currentIndex within the text.IllegalArgumentException - is thrown if an invalid currentIndex is
supplied. i.e. currentIndex is out of bounds.IndexOutOfBoundsException - is thrown if an invalid index is suppliedpublic 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.