Package org.smtlib

Class CharSequenceSocket

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

public class CharSequenceSocket extends CharSequenceInfinite
This class implements a CharSequence that obtains its characters from a ServerSocket. 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

    • serverSocket

      protected ServerSocket serverSocket
      The socket from which characters are read
    • smtConfig

      protected SMT.Configuration smtConfig
      The configuration for this instance of SMT
  • Constructor Details

    • CharSequenceSocket

      public CharSequenceSocket(SMT.Configuration smtConfig, ServerSocket serverSocket, int initialSize, int sizeIncrease, double sizeMultiple)
      Constructor for a new instance
      Parameters:
      serverSocket - the ServerSocket 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
  • 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