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

public Class ReplaceableUCharacterIterator

extends UCharacterIterator
Class Inheritance
Imports
com.ibm.icu.text.Replaceable, .ReplaceableString, .UCharacterIterator, .UTF16

DLF docs must define behavior when Replaceable is mutated underneath the iterator. This and ICUCharacterIterator share some code, maybe they should share an implementation, or the common state and implementation should be moved up into UCharacterIterator. What are first, last, and getBeginIndex doing here?!?!?!

Field Summary

Modifier and TypeField and Description
private int
currentIndex

Current currentIndex

private Replaceable
replaceable

Replacable object

Constructor Summary

AccessConstructor and Description
public
ReplaceableUCharacterIterator(Replaceable
text which the iterator will be based on
replaceable
)

Public constructor

public
ReplaceableUCharacterIterator(String
text which the iterator will be based on
str
)

Public constructor

public
ReplaceableUCharacterIterator(StringBuffer
buffer of text on which the iterator will be based
buf
)

Public constructor

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

Returns:

current UTF16 character
current
()

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

Returns the current UTF16 character.
public int

Returns:

current codepoint
currentCodePoint
()

Overrides com.ibm.icu.text.UCharacterIterator.currentCodePoint.

Returns the current codepoint
public int

Returns:

current currentIndex in text.
getIndex
()

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

Gets the current currentIndex in text.
public int

Returns:

length of the text
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

Returns:

next UTF16 character in text or DONE if the new currentIndex is off the end of the text range.
next
()

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

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

Returns next UTF16 character and increments the iterator's currentIndex by 1.
public int

Returns:

next UTF16 character in text or DONE if the new currentIndex is off the start of the text range.
previous
()

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

Returns previous UTF16 character and decrements the iterator's currentIndex by 1.
public void

Returns:

the character at the specified currentIndex or DONE if the specified currentIndex is equal to the end of the text.
setIndex
(int
the currentIndex within the text.
currentIndex
)

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

Sets the currentIndex to the specified currentIndex in the text and returns that single UTF16 character at currentIndex.

Inherited from com.ibm.icu.text.UCharacterIterator:
getCharacterIteratorgetInstancegetInstancegetInstancegetInstancegetInstancegetInstancegetTextgetTextmoveCodePointIndexmoveIndexnextCodePointpreviousCodePointsetToLimitsetToStart

Field Detail

currentIndexback to summary
private int currentIndex

Current currentIndex

replaceableback to summary
private Replaceable replaceable

Replacable object

Constructor Detail

ReplaceableUCharacterIteratorback to summary
public ReplaceableUCharacterIterator(Replaceable replaceable)

Public constructor

Parameters
replaceable:Replaceable

text which the iterator will be based on

ReplaceableUCharacterIteratorback to summary
public ReplaceableUCharacterIterator(String str)

Public constructor

Parameters
str:String

text which the iterator will be based on

ReplaceableUCharacterIteratorback to summary
public ReplaceableUCharacterIterator(StringBuffer buf)

Public constructor

Parameters
buf:StringBuffer

buffer of text on which the iterator will be based

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.

Returns the current UTF16 character.

Returns:int

current UTF16 character

Annotations
@Override
currentCodePointback to summary
public int currentCodePoint()

Overrides com.ibm.icu.text.UCharacterIterator.currentCodePoint.

Returns the current codepoint

Returns:int

current codepoint

Annotations
@Override
getIndexback to summary
public int getIndex()

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

Gets the current currentIndex in text.

Returns:int

current currentIndex in text.

Annotations
@Override
getLengthback to summary
public int getLength()

Implements abstract 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.

Returns next UTF16 character and increments the iterator's currentIndex by 1. If the resulting currentIndex is greater or equal to the text length, the currentIndex is reset to the text length and a value of DONECODEPOINT is returned.

Returns:int

next UTF16 character in text or DONE if the new currentIndex is off the end of the text range.

Annotations
@Override
previousback to summary
public int previous()

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

Returns previous UTF16 character and decrements the iterator's currentIndex by 1. If the resulting currentIndex is less than 0, the currentIndex is reset to 0 and a value of DONECODEPOINT is returned.

Returns:int

next UTF16 character in text or DONE if the new currentIndex is off the start of the text range.

Annotations
@Override
setIndexback to summary
public void setIndex(int currentIndex) throws IndexOutOfBoundsException

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

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.

Parameters
currentIndex:int

the currentIndex within the text.

Returns:void

the character at the specified currentIndex or DONE if the specified currentIndex is equal to the end of the text.

Annotations
@Override
Exceptions
IndexOutOfBoundsException:

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

is thrown if an invalid index is supplied

IllegalArgumentException:
is thrown if an invalid currentIndex is supplied. i.e. currentIndex is out of bounds.