APIdia Launch Partner
Top Description Fields Constructors Methods
jdk.internal.icu.impl

public Class ReplaceableUCharacterIterator

extends UCharacterIterator
implements Cloneable
Class Inheritance
All Implemented Interfaces
java.lang.Cloneable
Imports
jdk.internal.icu.text.Replaceable, .ReplaceableString, .UCharacterIterator

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

Replaceable object

Inherited from jdk.internal.icu.text.UCharacterIterator:
DONE

Constructor Summary

AccessConstructor and Description
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 ReplaceableUCharacterIterator

Returns:

copy of this iterator
clone
()

Overrides jdk.internal.icu.text.UCharacterIterator.clone.

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

public int

Returns:

current UTF16 character
current
()

Returns the current UTF16 character.

public int

Returns:

current currentIndex in text.
getIndex
()

Implements abstract jdk.internal.icu.text.UCharacterIterator.getIndex.

Gets the current currentIndex in text.

public int

Returns:

length of the text
getLength
()

Implements abstract jdk.internal.icu.text.UCharacterIterator.getLength.

Returns the length of the text

public int
getText(char[] fillIn, int offset)

Implements abstract jdk.internal.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 jdk.internal.icu.text.UCharacterIterator.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 jdk.internal.icu.text.UCharacterIterator.previous.

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

public void
setIndex(int
the currentIndex within the text.
currentIndex
)

Implements abstract jdk.internal.icu.text.UCharacterIterator.setIndex.

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

Inherited from jdk.internal.icu.text.UCharacterIterator:
getInstancegetInstancegetInstancegetTextgetTextmoveCodePointIndexnextCodePointpreviousCodePointsetToStart

Field Detail

currentIndexback to summary
private int currentIndex

Current currentIndex

replaceableback to summary
private Replaceable replaceable

Replaceable object

Constructor Detail

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 ReplaceableUCharacterIterator clone()

Overrides jdk.internal.icu.text.UCharacterIterator.clone.

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

Returns:ReplaceableUCharacterIterator

copy of this iterator

currentback to summary
public int current()

Returns the current UTF16 character.

Returns:int

current UTF16 character

getIndexback to summary
public int getIndex()

Implements abstract jdk.internal.icu.text.UCharacterIterator.getIndex.

Gets the current currentIndex in text.

Returns:int

current currentIndex in text.

getLengthback to summary
public int getLength()

Implements abstract jdk.internal.icu.text.UCharacterIterator.getLength.

Returns the length of the text

Returns:int

length of the text

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

Implements abstract jdk.internal.icu.text.UCharacterIterator.getText.

Doc from jdk.internal.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()];
            }
        }
nextback to summary
public int next()

Implements abstract jdk.internal.icu.text.UCharacterIterator.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.

previousback to summary
public int previous()

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

setIndexback to summary
public void setIndex(int currentIndex)

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

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