Class TextStreamIterator
- java.lang.Object
-
- com.adobe.xfa.text.TextStreamIterator
-
- All Implemented Interfaces:
TextCharPropIterator
public class TextStreamIterator extends java.lang.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
andTextPosn
), range (classTextRange
) and editor (class {TODO: link TextEditor}).
-
-
Constructor Summary
Constructors Constructor 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.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method 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.
-
-
-
Constructor Detail
-
TextStreamIterator
public TextStreamIterator(TextStream poStream, int nIndex, boolean bForward, boolean bVisual)
Construct a stream iterator from stream pointer and index.This overload take stream position and initial index value and populates the stream iterator with them.
- Parameters:
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.
-
TextStreamIterator
public TextStreamIterator(TextPosnBase oSourcePosn, boolean bForward, boolean bVisual)
Construct a stream iterator from an existing position.- Parameters:
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.
-
-
Method Detail
-
first
public int first()
Return the index at the start of the iteration.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
.- Specified by:
first
in interfaceTextCharPropIterator
- Returns:
- First element's index value.
-
next
public int next(int nIndex)
Advance or back up one position.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
.- Specified by:
next
in interfaceTextCharPropIterator
- Parameters:
nIndex
- - Current index value.- Returns:
- True if there were character properties at the given index value; false if past the logical end of the array.
-
next
public int next()
- Specified by:
next
in interfaceTextCharPropIterator
-
getNextIndex
public int getNextIndex()
- Specified by:
getNextIndex
in interfaceTextCharPropIterator
-
-