ReaderCharacterIterator (Jakarta-Regexp 1.5 API)
Date: 2019-09-02

org.apache.regexp

## Class ReaderCharacterIterator

- java.lang.Object
- - org.apache.regexp.ReaderCharacterIterator

- All Implemented Interfaces:
    CharacterIterator

      public final class ReaderCharacterIterator
      extends java.lang.Object
      implements CharacterIterator

  Encapsulates java.io.Reader as CharacterIterator
  Version:
    CVS $Id: ReaderCharacterIterator.java 518156 2007-03-14 14:31:26Z vgritsenko $
  Author:
    Ales Novak

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `private java.lang.StringBuffer` | `buff` Buffer of read chars
    `private boolean` | `closed` read end?
    `private java.io.Reader` | `reader` Underlying reader

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `ReaderCharacterIterator(java.io.Reader reader)`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `char` | `charAt(int pos)`
    `private void` | `ensure(int idx)` Reads chars up to the idx
    `boolean` | `isEnd(int pos)`
    `private int` | `read(int n)` Reads n characters from the stream and appends them to the buffer
    `private void` | `readAll()` Reads rest of the stream.
    `java.lang.String` | `substring(int beginIndex)`
    `java.lang.String` | `substring(int beginIndex, int endIndex)`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### reader

          private final java.io.Reader reader

      Underlying reader

    - #### buff

          private final java.lang.StringBuffer buff

      Buffer of read chars

    - #### closed

          private boolean closed

      read end?

  - ### Constructor Detail

    - #### ReaderCharacterIterator

          public ReaderCharacterIterator(java.io.Reader reader)

      Parameters:
        `reader` - a Reader, which is parsed

  - ### Method Detail

    - #### substring

          public java.lang.String substring(int beginIndex,
                                            int endIndex)

      Specified by:
        `substring` in interface `CharacterIterator`
      Returns:
        a substring

    - #### substring

          public java.lang.String substring(int beginIndex)

      Specified by:
        `substring` in interface `CharacterIterator`
      Returns:
        a substring

    - #### charAt

          public char charAt(int pos)

      Specified by:
        `charAt` in interface `CharacterIterator`
      Returns:
        a character at the specified position.

    - #### isEnd

          public boolean isEnd(int pos)

      Specified by:
        `isEnd` in interface `CharacterIterator`
      Returns:
        `true` iff if the specified index is after the end of the character stream

    - #### read

          private int read(int n)
                    throws java.io.IOException

      Reads n characters from the stream and appends them to the buffer
      Throws:
        `java.io.IOException`

    - #### readAll

          private void readAll()
                        throws java.io.IOException

      Reads rest of the stream.
      Throws:
        `java.io.IOException`

    - #### ensure

          private void ensure(int idx)
                       throws java.io.IOException

      Reads chars up to the idx
      Throws:
        `java.io.IOException`

Copyright © 2001-2007 Apache Software Foundation. All Rights Reserved.