Top Description Fields Constructors Methods
com.ibm.icu.impl

public Class CharacterIteratorWrapper

extends UCharacterIterator
Class Inheritance
Imports
java.text.CharacterIterator, com.ibm.icu.text.UCharacterIterator

This class is a wrapper around CharacterIterator and implements the UCharacterIterator protocol
Author
ram

Field Summary

Modifier and TypeField and Description
private CharacterIterator

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public Object
clone()

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

Creates a clone of this iterator.
public int
current()

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

Returns the code unit at the current index.
public CharacterIterator
getCharacterIterator()

Overrides com.ibm.icu.text.UCharacterIterator.getCharacterIterator.

Returns a java.text.CharacterIterator object for the underlying text of this iterator.
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
moveIndex(int
the number of code units to move the current index.
delta
)

Overrides com.ibm.icu.text.UCharacterIterator.moveIndex.

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).
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.
public void
setToLimit()

Overrides com.ibm.icu.text.UCharacterIterator.setToLimit.

Sets the current index to the limit.
Inherited from com.ibm.icu.text.UCharacterIterator:
currentCodePointgetInstancegetInstancegetInstancegetInstancegetInstancegetInstancegetTextgetTextmoveCodePointIndexnextCodePointpreviousCodePointsetToStart

Field Detail

iteratorback to summary
private CharacterIterator iterator

Constructor Detail

CharacterIteratorWrapperback to summary
public CharacterIteratorWrapper(CharacterIterator iter)

Method Detail

cloneback to summary
public Object clone()

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

Creates a clone of this iterator. Clones the underlying character iterator.

Returns:Object

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

copy of this iterator

Annotations
@Override
See Also
UCharacterIterator#clone()
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
See Also
UCharacterIterator#current()
getCharacterIteratorback to summary
public CharacterIterator getCharacterIterator()

Overrides com.ibm.icu.text.UCharacterIterator.getCharacterIterator.

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

Returns a java.text.CharacterIterator object for the underlying text of this iterator. The returned iterator is independent of this iterator.

Returns:CharacterIterator

java.text.CharacterIterator object

Annotations
@Override
See Also
UCharacterIterator#getCharacterIterator()
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
See Also
UCharacterIterator#getIndex()
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
See Also
UCharacterIterator#getLength()
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
See Also
UCharacterIterator#getText(char[])
moveIndexback to summary
public int moveIndex(int delta)

Overrides com.ibm.icu.text.UCharacterIterator.moveIndex.

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

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). 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.

Parameters
delta:int

the number of code units to move the current index.

Returns:int

the new index.

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
See Also
UCharacterIterator#next()
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
See Also
UCharacterIterator#previous()
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
See Also
UCharacterIterator#setIndex(int)
setToLimitback to summary
public void setToLimit()

Overrides com.ibm.icu.text.UCharacterIterator.setToLimit.

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

Sets the current index to the limit.

Annotations
@Override
See Also
UCharacterIterator#setToLimit()