Class UCharArrayIterator
java.lang.Object
org.graalvm.shadowed.com.ibm.icu.text.UCharacterIterator
org.graalvm.shadowed.com.ibm.icu.impl.UCharArrayIterator
- All Implemented Interfaces:
Cloneable,UForwardCharacterIterator
-
Field Summary
Fields inherited from interface org.graalvm.shadowed.com.ibm.icu.text.UForwardCharacterIterator
DONE -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionclone()Creates a copy of this iterator, does not clone the underlyingReplaceableobjectintcurrent()Returns the code unit at the current index.intgetIndex()Gets the current index in text.intReturns the length of the textintgetText(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.intnext()Returns the UTF16 code unit at index, and increments to the next code unit (post-increment semantics).intprevious()Decrement to the position of the previous code unit in the text, and return it (pre-decrement semantics).voidsetIndex(int index) Sets the index to the specified index in the text.Methods inherited from class org.graalvm.shadowed.com.ibm.icu.text.UCharacterIterator
currentCodePoint, getCharacterIterator, getInstance, getInstance, getInstance, getInstance, getInstance, getInstance, getText, getText, moveCodePointIndex, moveIndex, nextCodePoint, previousCodePoint, setToLimit, setToStart
-
Constructor Details
-
UCharArrayIterator
public UCharArrayIterator(char[] text, int start, int limit)
-
-
Method Details
-
current
public int current()Description copied from class:UCharacterIteratorReturns the code unit at the current index. If index is out of range, returns DONE. Index is not changed.- Specified by:
currentin classUCharacterIterator- Returns:
- current code unit
-
getLength
public int getLength()Description copied from class:UCharacterIteratorReturns the length of the text- Specified by:
getLengthin classUCharacterIterator- Returns:
- length of the text
-
getIndex
public int getIndex()Description copied from class:UCharacterIteratorGets the current index in text.- Specified by:
getIndexin classUCharacterIterator- Returns:
- current index in text.
-
next
public int next()Description copied from class:UCharacterIteratorReturns 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.- Specified by:
nextin interfaceUForwardCharacterIterator- Specified by:
nextin classUCharacterIterator- Returns:
- the next UTF16 code unit, or DONE if the index is at the limit of the text.
-
previous
public int previous()Description copied from class:UCharacterIteratorDecrement 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.- Specified by:
previousin classUCharacterIterator- Returns:
- the previous code unit in the text, or DONE if the new index is before the start of the text.
-
setIndex
public void setIndex(int index) Description copied from class:UCharacterIteratorSets the index to the specified index in the text.- Specified by:
setIndexin classUCharacterIterator- Parameters:
index- the index within the text.
-
getText
public int getText(char[] fillIn, int offset) Description copied from class:UCharacterIteratorFills 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 callinggetLength()). 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()]; } }- Specified by:
getTextin classUCharacterIterator- Parameters:
fillIn- an array of chars to fill with the underlying UTF-16 code units.offset- the position within the array to start putting the data.- Returns:
- the number of code units added to fillIn, as a convenience
-
clone
Creates a copy of this iterator, does not clone the underlyingReplaceableobject- Overrides:
clonein classUCharacterIterator- Returns:
- copy of this iterator
-