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)
Modifier and Type | Field and Description |
---|---|
public static final int | DONE
Indicator that we have reached the ends of the UTF16 text. |
Access | Constructor and Description |
---|---|
protected |
Modifier and Type | Method and Description |
---|---|
public Object | Returns: copy of this iteratorOverrides java. Creates a copy of this iterator, independent from other iterators. |
public abstract int | |
public static final UCharacterIterator | Returns: UCharacterIterator objecta string source)Returns a |
public static final UCharacterIterator | Returns: UCharacterIterator objectan string buffer of UTF-16 code units source)Returns a |
public static final UCharacterIterator | Returns: UCharacterIterator objecta valid CharacterIterator object. source)Returns a |
public abstract int | |
public abstract int | Returns: the number of code units added to fillIn, as a conveniencean array of chars to fill with the underlying UTF-16 code
units. fillIn, int the position within the array to start putting the data. offset)Fills the buffer with the underlying text storage of the iterator If the buffer capacity is not enough a exception is thrown. |
public final int | Returns: the number of code units added to fillIn, as a conveniencean array of chars to fill with the underlying UTF-16 code
units. fillIn)Convenience override for |
public String | Returns: the underlying text storage in the iterator as a stringConvenience method for returning the underlying text storage as a string |
public int | Returns: the new indexthe number of code units to move the current index. 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). |
public abstract int | Returns: the next UTF16 code unit, or DONE if the index is at the limit of the text.Returns the UTF16 code unit at index, and increments to the next code unit (post-increment semantics). |
public int | Returns: the next codepoint in text, or DONE if the index is at the limit of the text.Returns the code point at index, and increments to the next code point (post-increment semantics). |
public abstract int | Returns: the previous code unit in the text, or DONE if the new index is before the start of the text.Decrement to the position of the previous code unit in the text, and return it (pre-decrement semantics). |
public int | Returns: the previous code point in the text, or DONE if the new index is before the start of the text.Retreat to the start of the previous code point in the text, and return it (pre-decrement semantics). |
public abstract void | |
public void |
DONE | back to summary |
---|---|
public static final int DONE Indicator that we have reached the ends of the UTF16 text. Moved from UForwardCharacterIterator.java
|
UCharacterIterator | back to summary |
---|---|
protected UCharacterIterator() Protected default constructor for the subclasses
|
clone | back to summary |
---|---|
public Object clone() throws CloneNotSupportedException Overrides java. Creates a copy of this iterator, independent from other iterators. If it is not possible to clone the iterator, returns null.
|
getIndex | back to summary |
---|---|
public abstract int getIndex() Gets the current index in text.
|
getInstance | back to summary |
---|---|
public static final UCharacterIterator getInstance(String source) Returns a
|
getInstance | back to summary |
---|---|
public static final UCharacterIterator getInstance(StringBuffer source) Returns a
|
getInstance | back to summary |
---|---|
public static final UCharacterIterator getInstance(CharacterIterator source) Returns a
|
getLength | back to summary |
---|---|
public abstract int getLength() Returns the length of the text
|
getText | back to summary |
---|---|
public 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. The capacity
of the fill in buffer should at least be equal to length of text in the
iterator obtained by calling
|
getText | back to summary |
---|---|
public final int getText(char[] fillIn) Convenience override for
|
getText | back to summary |
---|---|
public String getText() Convenience method for returning the underlying text storage as a string |
moveCodePointIndex | back to summary |
---|---|
public 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). If the current index is at a trail surrogate then the first adjustment is by code unit, and the remaining adjustments are by code points. If the resulting index would be less than zero, the index is set to zero, and if the resulting index would be greater than limit, the index is set to limit.
|
next | back to summary |
---|---|
public abstract int next() Returns the UTF16 code unit at index, and increments to the next code unit (post-increment semantics). If index is out of range, DONE is returned, and the iterator is reset to the limit of the text.
|
nextCodePoint | back to summary |
---|---|
public int nextCodePoint() Returns the code point at index, and increments to the next code
point (post-increment semantics). If index does not point to a
valid surrogate pair, the behavior is the same as
|
previous | back to summary |
---|---|
public abstract int previous() Decrement to the position of the previous code unit in the text, and return it (pre-decrement semantics). If the resulting index is less than 0, the index is reset to 0 and DONE is returned.
|
previousCodePoint | back to summary |
---|---|
public int previousCodePoint() Retreat to the start of the previous code point in the text,
and return it (pre-decrement semantics). If the index is not
preceded by a valid surrogate pair, the behavior is the same
as
|
setIndex | back to summary |
---|---|
public abstract void setIndex(int index) Sets the index to the specified index in the text.
|
setToStart | back to summary |
---|---|
public void setToStart() Sets the current index to the start.
|