Class UCharArrayIterator

    • Field Detail

      • text

        private final char[] text
      • start

        private final int start
      • limit

        private final int limit
      • pos

        private int pos
    • Constructor Detail

      • UCharArrayIterator

        public UCharArrayIterator​(char[] text,
                                  int start,
                                  int limit)
    • Method Detail

      • current

        public int current()
        Description copied from class: UCharacterIterator
        Returns the code unit at the current index. If index is out of range, returns DONE. Index is not changed.
        Specified by:
        current in class UCharacterIterator
        Returns:
        current code unit
      • next

        public int next()
        Description copied from class: UCharacterIterator
        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.
        Specified by:
        next in interface UForwardCharacterIterator
        Specified by:
        next in class UCharacterIterator
        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: UCharacterIterator
        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.
        Specified by:
        previous in class UCharacterIterator
        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: UCharacterIterator
        Sets the index to the specified index in the text.
        Specified by:
        setIndex in class UCharacterIterator
        Parameters:
        index - the index within the text.
      • getText

        public int getText​(char[] fillIn,
                           int offset)
        Description copied from class: UCharacterIterator
        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()];
                     }
                 }
         
        Specified by:
        getText in class UCharacterIterator
        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

        public java.lang.Object clone()
        Creates a copy of this iterator, does not clone the underlying Replaceableobject
        Overrides:
        clone in class UCharacterIterator
        Returns:
        copy of this iterator