public class TextStreamIterator extends Object implements TextCharPropIterator
Implementation of TextCharPropIterator for iterating over text stream content.
This class allows the caller to do grapheme cluster and word break
analysis over text stream content. Used in conjunction with a TextBreakIterator, the caller can find those key break points in
any text stream.
The text break iterator returns index numbers of grapheme cluster or
word break points in the text. When used with a text stream
iterator, these are actual index numbers in the text and can be used
to populate text position (classes TextPosnBase and TextPosn), range (class TextRange) and editor (class
{TODO: link TextEditor}).
| Constructor and Description |
|---|
TextStreamIterator(TextPosnBase oSourcePosn,
boolean bForward,
boolean bVisual)
Construct a stream iterator from an existing position.
|
TextStreamIterator(TextStream poStream,
int nIndex,
boolean bForward,
boolean bVisual)
Construct a stream iterator from stream pointer and index.
|
| Modifier and Type | Method and Description |
|---|---|
int |
first()
Return the index at the start of the iteration.
|
int |
getNextIndex() |
int |
next() |
int |
next(int nIndex)
Advance or back up one position.
|
public TextStreamIterator(TextStream poStream, int nIndex, boolean bForward, boolean bVisual)
This overload take stream position and initial index value and populates the stream iterator with them.
poStream - - Text stream to iterate over. Must not be null.nIndex - - Item index number within the stream to initializate
the iterator. If it is out of bounds, it will be truncated to the
end of the stream. Note that iteration need not start at the start
of the text stream.bForward - - True (default) for forward iteration over the
stream; false for backward iteration.bVisual - - True if movements are to occur visually over
bidirectional text; false (default) for logical positioning.public TextStreamIterator(TextPosnBase oSourcePosn, boolean bForward, boolean bVisual)
oSourcePosn - - Initial position to start iteration at. Need
not be the start of the stream, but must be properly associated with
a stream.bForward - - True (default) for forward iteration over the
stream; false for backward iteration.bVisual - - True if movements are to occur visually over
bidirectional text; false (default) for logical positioning.public int first()
This method is not normally called by the creator of the stream
iterator. Instead, it is used by TextBreakIterator to
obtain character property data in a polymorphic manner. For more
information, please see the base class, TextCharPropIterator.
first in interface TextCharPropIteratorpublic int next(int nIndex)
This method is not normally called by the creator of the stream
iterator. Instead, it is used by TextBreakIterator to
obtain character property data in a polymorphic manner. For more
information, please see the base class, TextCharPropIterator.
next in interface TextCharPropIteratornIndex - - Current index value.public int next()
next in interface TextCharPropIteratorpublic int getNextIndex()
getNextIndex in interface TextCharPropIteratorCopyright © 2010 - 2020 Adobe. All Rights Reserved