org.apache.lucene.analysis.util

## Class RollingCharBuffer

- java.lang.Object
- - org.apache.lucene.analysis.util.RollingCharBuffer

-     public final class RollingCharBuffer
      extends Object

  Acts like a forever growing char[] as you read characters into it from the provided reader, but internally it uses a circular buffer to only hold the characters that haven't been freed yet. This is like a PushbackReader, except you don't have to specify up-front the max size of the buffer, but you do have to periodically call `freeBefore(int)`.

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `RollingCharBuffer()`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `freeBefore(int pos)` Call this to notify us that no chars before this absolute position are needed anymore.
    `int` | `get(int pos)`
    `char[]` | `get(int posStart, int length)`
    `void` | `reset(Reader reader)` Clear array and switch to new reader.

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

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

- - ### Constructor Detail

    - #### RollingCharBuffer

          public RollingCharBuffer()

  - ### Method Detail

    - #### reset

          public void reset(Reader reader)

      Clear array and switch to new reader.

    - #### get

          public int get(int pos)
                  throws IOException

      Throws:
        `IOException`

    - #### get

          public char[] get(int posStart,
                            int length)

    - #### freeBefore

          public void freeBefore(int pos)

      Call this to notify us that no chars before this absolute position are needed anymore.

Copyright © 2000-2019 Apache Software Foundation. All Rights Reserved.