| Modifier and Type | Field and Description |
|---|---|
| private int | currentIndex
Current currentIndex |
| private Replaceable | replaceable
Replacable object |
| Access | Constructor and Description |
|---|---|
| public | ReplaceableUCharacterIterator(Replaceable
text which the iterator will be based on replaceable)Public constructor |
| public | |
| public | ReplaceableUCharacterIterator(StringBuffer
buffer of text on which the iterator will be based buf)Public constructor |
| Modifier and Type | Method and Description |
|---|---|
| public Object | Returns: copy of this iteratorOverrides com. Replaceableobject
|
| public int | Returns: current UTF16 characterImplements abstract com. |
| public int | Returns: current codepointOverrides com. |
| public int | Returns: current currentIndex in text.Implements abstract com. |
| public int | Returns: length of the textImplements abstract com. |
| 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. |
| public int | Returns: next UTF16 character in text or DONE if the new currentIndex is off the end of the text range.Implements abstract com. Implements com. |
| public int | Returns: next UTF16 character in text or DONE if the new currentIndex is off the start of the text range.Implements abstract com. |
| public void | Returns: the character at the specified currentIndex or DONE if the specified currentIndex is equal to the end of the text.the currentIndex within the text. currentIndex)Implements abstract com. Sets the currentIndex to the specified currentIndex in the text and returns that single UTF16 character at currentIndex. |
| currentIndex | back to summary |
|---|---|
| private int currentIndex Current currentIndex | |
| replaceable | back to summary |
|---|---|
| private Replaceable replaceable Replacable object | |
| ReplaceableUCharacterIterator | back to summary |
|---|---|
| public ReplaceableUCharacterIterator(Replaceable replaceable) Public constructor
| |
| ReplaceableUCharacterIterator | back to summary |
|---|---|
| public ReplaceableUCharacterIterator(String str) Public constructor
| |
| ReplaceableUCharacterIterator | back to summary |
|---|---|
| public ReplaceableUCharacterIterator(StringBuffer buf) Public constructor
| |
| clone | back to summary |
|---|---|
| public Object clone() Overrides com. Creates a copy of this iterator, does not clone the underlying
| |
| current | back to summary |
|---|---|
| public int current() Implements abstract com. Returns the current UTF16 character.
| |
| currentCodePoint | back to summary |
|---|---|
| public int currentCodePoint() Overrides com. Returns the current codepoint
| |
| getIndex | back to summary |
|---|---|
| public int getIndex() Implements abstract com. Gets the current currentIndex in text.
| |
| getLength | back to summary |
|---|---|
| public int getLength() Implements abstract com. Returns the length of the text
| |
| getText | back to summary |
|---|---|
| public int getText(char[] fillIn, int offset) Implements abstract com. Doc from com. 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
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()];
}
}
| |
| next | back to summary |
|---|---|
| public int next() Implements abstract com. Implements com. 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.
| |
| previous | back to summary |
|---|---|
| public int previous() Implements abstract com. 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.
| |
| setIndex | back to summary |
|---|---|
| public void setIndex(int currentIndex) throws IndexOutOfBoundsException Implements abstract com. 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.
| |