Top Fields Constructors Methods
com.ibm.icu.impl

public final Class UCharArrayIterator

extends UCharacterIterator
Class Inheritance
Imports
com.ibm.icu.text.UCharacterIterator

Author
Doug Felt

Field Summary

Modifier and TypeField and Description
private final int
private int
private final int
private final char[]

Constructor Summary

AccessConstructor and Description
public
UCharArrayIterator(char[] text, int start, int limit)

Method Summary

Modifier and TypeMethod and Description
public Object

Returns:

copy of this iterator
clone
()

Overrides com.ibm.icu.text.UCharacterIterator.clone.

Creates a copy of this iterator, does not clone the underlying Replaceableobject
public int
current()

Implements abstract com.ibm.icu.text.UCharacterIterator.current.

Returns the code unit at the current index.
public int
getIndex()

Implements abstract com.ibm.icu.text.UCharacterIterator.getIndex.

Gets the current index in text.
public int
getLength()

Implements abstract com.ibm.icu.text.UCharacterIterator.getLength.

Returns the length of the text
public int
getText(char[]
an 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
)

Implements abstract com.ibm.icu.text.UCharacterIterator.getText.

Fills the buffer with the underlying text storage of the iterator If the buffer capacity is not enough a exception is thrown.
public int
next()

Implements abstract com.ibm.icu.text.UCharacterIterator.next.

Implements com.ibm.icu.text.UForwardCharacterIterator.next.

Returns the UTF16 code unit at index, and increments to the next code unit (post-increment semantics).
public int
previous()

Implements abstract com.ibm.icu.text.UCharacterIterator.previous.

Decrement to the position of the previous code unit in the text, and return it (pre-decrement semantics).
public void
setIndex(int
the index within the text.
index
)

Implements abstract com.ibm.icu.text.UCharacterIterator.setIndex.

Sets the index to the specified index in the text.
Inherited from com.ibm.icu.text.UCharacterIterator:
currentCodePointgetCharacterIteratorgetInstancegetInstancegetInstancegetInstancegetInstancegetInstancegetTextgetTextmoveCodePointIndexmoveIndexnextCodePointpreviousCodePointsetToLimitsetToStart

Field Detail

limitback to summary
private final int limit
posback to summary
private int pos
startback to summary
private final int start
textback to summary
private final char[] text

Constructor Detail

UCharArrayIteratorback to summary
public UCharArrayIterator(char[] text, int start, int limit)

Method Detail

cloneback to summary
public Object clone()

Overrides com.ibm.icu.text.UCharacterIterator.clone.

Creates a copy of this iterator, does not clone the underlying Replaceableobject

Returns:Object

copy of this iterator

Annotations
@Override
currentback to summary
public int current()

Implements abstract com.ibm.icu.text.UCharacterIterator.current.

Doc from com.ibm.icu.text.UCharacterIterator.current.

Returns the code unit at the current index. If index is out of range, returns DONE. Index is not changed.

Returns:int

current code unit

Annotations
@Override
getIndexback to summary
public int getIndex()

Implements abstract com.ibm.icu.text.UCharacterIterator.getIndex.

Doc from com.ibm.icu.text.UCharacterIterator.getIndex.

Gets the current index in text.

Returns:int

current index in text.

Annotations
@Override
getLengthback to summary
public int getLength()

Implements abstract com.ibm.icu.text.UCharacterIterator.getLength.

Doc from com.ibm.icu.text.UCharacterIterator.getLength.

Returns the length of the text

Returns:int

length of the text

Annotations
@Override
getTextback to summary
public int getText(char[] fillIn, int offset)

Implements abstract com.ibm.icu.text.UCharacterIterator.getText.

Doc from com.ibm.icu.text.UCharacterIterator.getText.

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 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:char[]

an array of chars to fill with the underlying UTF-16 code units.

offset:int

the position within the array to start putting the data.

Returns:int

the number of code units added to fillIn, as a convenience

Annotations
@Override
nextback to summary
public int next()

Implements abstract com.ibm.icu.text.UCharacterIterator.next.

Implements com.ibm.icu.text.UForwardCharacterIterator.next.

Doc from com.ibm.icu.text.UCharacterIterator.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.

Returns:int

the next UTF16 code unit, or DONE if the index is at the limit of the text.

Annotations
@Override
previousback to summary
public int previous()

Implements abstract com.ibm.icu.text.UCharacterIterator.previous.

Doc from com.ibm.icu.text.UCharacterIterator.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.

Returns:int

the previous code unit in the text, or DONE if the new index is before the start of the text.

Annotations
@Override
setIndexback to summary
public void setIndex(int index)

Implements abstract com.ibm.icu.text.UCharacterIterator.setIndex.

Doc from com.ibm.icu.text.UCharacterIterator.setIndex.

Sets the index to the specified index in the text.

Parameters
index:int

the index within the text.

Annotations
@Override