Class Overview
This class is a wrapper around CharacterIterator and implements the
UCharacterIterator protocol
Summary
Public Methods |
Object
|
clone()
Creates a clone of this iterator.
|
int
|
current()
Returns the code unit at the current index.
|
int
|
getIndex()
Gets the current index in text.
|
int
|
getLength()
Returns the length of the text
|
int
|
getText(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.
|
int
|
next()
Returns the UTF16 code unit at index, and increments to the next
code unit (post-increment semantics).
|
int
|
previous()
Decrement to the position of the previous code unit in the
text, and return it (pre-decrement semantics).
|
void
|
setIndex(int index)
Sets the index to the specified index in the text.
|
[Expand]
Inherited Methods |
From class
sun.text.normalizer.UCharacterIterator
Object
|
clone()
Creates a copy of this iterator, independent from other iterators.
|
abstract
int
|
current()
Returns the code unit at the current index.
|
abstract
int
|
getIndex()
Gets the current index in text.
|
final
static
UCharacterIterator
|
getInstance(CharacterIterator source)
Returns a UCharacterIterator object given a
CharacterIterator.
|
final
static
UCharacterIterator
|
getInstance(StringBuffer source)
Returns a UCharacterIterator object given a
source StringBuffer.
|
final
static
UCharacterIterator
|
getInstance(String source)
Returns a UCharacterIterator object given a
source string.
|
abstract
int
|
getLength()
Returns the length of the text
|
abstract
int
|
getText(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.
|
String
|
getText()
Convenience method for returning the underlying text storage as as string
|
final
int
|
getText(char[] fillIn)
Convenience override for getText(char[], int) that provides
an offset of 0.
|
int
|
moveIndex(int delta)
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).
|
abstract
int
|
next()
Returns the UTF16 code unit at index, and increments to the next
code unit (post-increment semantics).
|
int
|
nextCodePoint()
Returns the code point at index, and increments to the next code
point (post-increment semantics).
|
abstract
int
|
previous()
Decrement to the position of the previous code unit in the
text, and return it (pre-decrement semantics).
|
abstract
void
|
setIndex(int index)
Sets the index to the specified index in the text.
|
|
From class
java.lang.Object
Object
|
clone()
Creates and returns a copy of this object.
|
boolean
|
equals(Object obj)
Indicates whether some other object is "equal to" this one.
|
void
|
finalize()
Called by the garbage collector on an object when garbage collection
determines that there are no more references to the object.
|
final
Class<?>
|
getClass()
Returns the runtime class of this Object .
|
int
|
hashCode()
Returns a hash code value for the object.
|
final
void
|
notify()
Wakes up a single thread that is waiting on this object's
monitor.
|
final
void
|
notifyAll()
Wakes up all threads that are waiting on this object's monitor.
|
String
|
toString()
Returns a string representation of the object.
|
final
void
|
wait()
Causes the current thread to wait until another thread invokes the
notify() method or the
notifyAll() method for this object.
|
final
void
|
wait(long timeout, int nanos)
Causes the current thread to wait until another thread invokes the
notify() method or the
notifyAll() method for this object, or
some other thread interrupts the current thread, or a certain
amount of real time has elapsed.
|
final
void
|
wait(long timeout)
Causes the current thread to wait until either another thread invokes the
notify() method or the
notifyAll() method for this object, or a
specified amount of time has elapsed.
|
|
Public Constructors
Public Methods
public
Object
clone
()
Creates a clone of this iterator. Clones the underlying character iterator.
public
int
current
()
Returns the code unit at the current index. If index is out
of range, returns DONE. Index is not changed.
public
int
getIndex
()
Gets the current index in text.
public
int
getLength
()
Returns the length of the text
public
int
getText
(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. 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
| 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
public
int
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
- the next UTF16 code unit, or DONE if the index is at the limit
of the text.
public
int
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
- the previous code unit in the text, or DONE if the new
index is before the start of the text.
public
void
setIndex
(int index)
Sets the index to the specified index in the text.
Parameters
index
| the index within the text. |