com.ibm.icu.text
public abstract class UCharacterIterator extends Object implements Cloneable, UForwardCharacterIterator
java.text.CharacterIterator
interface methods provided forward
iteration with "pre-increment" and backward iteration with pre-decrement
semantics. This API is more efficient for forward iteration over code points.
The other major difference is that this API can do both code unit and code point
iteration, java.text.CharacterIterator
can only iterate over
code units and is limited to BMP (0 - 0xFFFF)
UNKNOWN: ICU 2.4
Constructor Summary | |
---|---|
protected | UCharacterIterator()
Protected default constructor for the subclasses |
Method Summary | |
---|---|
Object | clone()
Creates a copy of this iterator, independent from other iterators.
|
abstract int | current()
Returns the code unit at the current index. |
int | currentCodePoint()
Returns the codepoint at the current index.
|
CharacterIterator | getCharacterIterator()
Returns a java.text.CharacterIterator object for
the underlying text of this iterator. |
abstract int | getIndex()
Gets the current index in text. |
static UCharacterIterator | getInstance(Replaceable source)
Returns a UCharacterIterator object given a
Replaceable object. |
static UCharacterIterator | getInstance(String source)
Returns a UCharacterIterator object given a
source string. |
static UCharacterIterator | getInstance(char[] source)
Returns a UCharacterIterator object given a
source character array. |
static UCharacterIterator | getInstance(char[] source, int start, int limit)
Returns a UCharacterIterator object given a
source character array. |
static UCharacterIterator | getInstance(StringBuffer source)
Returns a UCharacterIterator object given a
source StringBuffer. |
static UCharacterIterator | getInstance(CharacterIterator source)
Returns a UCharacterIterator object given a
CharacterIterator. |
abstract int | getLength()
Returns the length of the text |
abstract 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 | getText(char[] fillIn)
Convenience override for getText(char[], int)>/code> that provides
an offset of 0. |
String | getText()
Convenience method for returning the underlying text storage as as string |
int | moveCodePointIndex(int delta)
Moves the current position by the number of code points
specified, either forward or backward depending on the sign of
delta (positive or negative respectively). |
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). |
abstract int | next()
Returns the UTF16 code unit at index, and increments to the next
code unit (post-increment semantics). |
int | nextCodePoint()
Returns the code point at index, and increments to the next code
point (post-increment semantics). |
abstract int | previous()
Decrement to the position of the previous code unit in the
text, and return it (pre-decrement semantics). |
int | previousCodePoint()
Retreat to the start of the previous code point in the text,
and return it (pre-decrement semantics). |
abstract void | setIndex(int index)
Sets the index to the specified index in the text. |
void | setToLimit()
Sets the current index to the limit. |
void | setToStart()
Sets the current index to the start. |
UNKNOWN: ICU 2.4
Returns: copy of this iterator
UNKNOWN: ICU 2.4
Returns: current code unit
UNKNOWN: ICU 2.4
Returns: current codepoint
UNKNOWN: ICU 2.4
java.text.CharacterIterator
object for
the underlying text of this iterator. The returned iterator is
independent of this iterator.Returns: java.text.CharacterIterator object
UNKNOWN: ICU 2.4
Returns: current index in text.
UNKNOWN: ICU 2.4
UCharacterIterator
object given a
Replaceable
object.Parameters: source a valid source as a Replaceable
object
Returns: UCharacterIterator object
Throws: IllegalArgumentException if the argument is null
UNKNOWN: ICU 2.4
UCharacterIterator
object given a
source string.Parameters: source a string
Returns: UCharacterIterator object
Throws: IllegalArgumentException if the argument is null
UNKNOWN: ICU 2.4
UCharacterIterator
object given a
source character array.Parameters: source an array of UTF-16 code units
Returns: UCharacterIterator object
Throws: IllegalArgumentException if the argument is null
UNKNOWN: ICU 2.4
UCharacterIterator
object given a
source character array.Parameters: source an array of UTF-16 code units
Returns: UCharacterIterator object
Throws: IllegalArgumentException if the argument is null
UNKNOWN: ICU 2.4
UCharacterIterator
object given a
source StringBuffer.Parameters: source an string buffer of UTF-16 code units
Returns: UCharacterIterator object
Throws: IllegalArgumentException if the argument is null
UNKNOWN: ICU 2.4
UCharacterIterator
object given a
CharacterIterator.Parameters: source a valid CharacterIterator object.
Returns: UCharacterIterator object
Throws: IllegalArgumentException if the argument is null
UNKNOWN: ICU 2.4
Returns: length of the text
UNKNOWN: ICU 2.4
getLength()
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()];
}
}
Parameters: fillIn an array of chars to fill with the underlying UTF-16 code units. offset the position within the array to start putting the data.
Returns: the number of code units added to fillIn, as a convenience
Throws: IndexOutOfBounds exception if there is not enough room after offset in the array, or if offset < 0.
UNKNOWN: ICU 2.4
getText(char[], int)>/code> that provides
an offset of 0.Parameters: fillIn an array of chars to fill with the underlying UTF-16 code
units.
Returns: the number of code units added to fillIn, as a convenience
Throws: IndexOutOfBounds exception if there is not enough
room in the array.
UNKNOWN: ICU 2.4
Returns: the underlying text storage in the iterator as a string
UNKNOWN: ICU 2.4
Parameters: delta the number of code units to move the current index.
Returns: the new index
Throws: IndexOutOfBoundsException is thrown if an invalid delta is supplied
UNKNOWN: ICU 2.4
Parameters: delta the number of code units to move the current index.
Returns: the new index.
Throws: IndexOutOfBoundsException is thrown if an invalid index is supplied
UNKNOWN: ICU 2.4
Returns: the next UTF16 code unit, or DONE if the index is at the limit of the text.
UNKNOWN: ICU 2.4
next(). Otherwise the iterator is incremented past
the surrogate pair, and the code point represented by the pair
is returned.Returns: the next codepoint in text, or DONE if the index is at
the limit of the text.
UNKNOWN: ICU 2.4
Returns: the previous code unit in the text, or DONE if the new index is before the start of the text.
UNKNOWN: ICU 2.4
previous()
. Otherwise the iterator is
decremented to the start of the surrogate pair, and the code
point represented by the pair is returned.Returns: the previous code point in the text, or DONE if the new index is before the start of the text.
UNKNOWN: ICU 2.4
Parameters: index the index within the text.
Throws: IndexOutOfBoundsException is thrown if an invalid index is supplied
UNKNOWN: ICU 2.4
UNKNOWN: ICU 2.4
UNKNOWN: ICU 2.4