Package org.smtlib

Class CharSequenceReader

java.lang.Object
org.smtlib.CharSequenceInfinite
org.smtlib.CharSequenceReader
All Implemented Interfaces:
CharSequence

public class CharSequenceReader extends CharSequenceInfinite implements CharSequence
This class implements a CharSequence that obtains its characters from a Reader. The characters read are held in an internal char array, whose size grows as needed; it starts as initialSize and is expanded to currentSize*sizeMultiple + sizeIncrease whenever needed. The CharSequenceReader is an unconventional CharSequence in that its length() is not known; whether this will cause problems in some uses of the CharSequenceReader is unknown. The user should not use the value of length() directly; it seems to work in the ways it is called from Pattern.matcher.
Author:
David R. Cok
  • Field Details

    • rdr

      protected Reader rdr
      The Reader that supplies characters for the CharSequence
  • Constructor Details

    • CharSequenceReader

      public CharSequenceReader(Reader rdr, int initialSize, int sizeIncrease, double sizeMultiple)
      Constructor for a new instance
      Parameters:
      rdr - the Reader that supplies characters on demand
      initialSize - the beginning size of the internal char array
      sizeIncrease - the amount to add to the current size of the internal char array when the array needs expanding
      sizeMultiple - the factor by which to multiply the current size of the internal char array when it needs expanding
    • CharSequenceReader

      public CharSequenceReader(Reader rdr)
      Constructor for a new instance
      Parameters:
      rdr - the Reader that supplies characters on demand
  • Method Details

    • readChars

      protected boolean readChars() throws IOException
      Description copied from class: CharSequenceInfinite
      Reads more characters into the buffer; may block until some are read; returns false if end of input has been reached, in which case no additional chars should have been read. Does not expand the buffer, so the buffer must have extra space in it when readChars() is called.
      Specified by:
      readChars in class CharSequenceInfinite
      Returns:
      true if characters were read, false if no chars were read and end of input was reached
      Throws:
      IOException