Package org.smtlib
Class CharSequenceSocket
java.lang.Object
org.smtlib.CharSequenceInfinite
org.smtlib.CharSequenceSocket
- All Implemented Interfaces:
CharSequence
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
-
Nested Class Summary
Nested classes/interfaces inherited from class org.smtlib.CharSequenceInfinite
CharSequenceInfinite.IPrompter -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected ServerSocketThe socket from which characters are readprotected SMT.ConfigurationThe configuration for this instance of SMTFields inherited from class org.smtlib.CharSequenceInfinite
amountRead, buf, endChar, length, prompter, sizeIncrease, sizeMultiple -
Constructor Summary
ConstructorsConstructorDescriptionCharSequenceSocket(SMT.Configuration smtConfig, ServerSocket serverSocket, int initialSize, int sizeIncrease, double sizeMultiple) Constructor for a new instance -
Method Summary
Modifier and TypeMethodDescriptionprotected booleanReads 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.Methods inherited from class org.smtlib.CharSequenceInfinite
charAt, length, subSequenceMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface java.lang.CharSequence
chars, codePoints, isEmpty, toString
-
Field Details
-
serverSocket
The socket from which characters are read -
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 demandinitialSize- the beginning size of the internal char arraysizeIncrease- the amount to add to the current size of the internal char array when the array needs expandingsizeMultiple- the factor by which to multiply the current size of the internal char array when it needs expanding
-
-
Method Details
-
readChars
Description copied from class:CharSequenceInfiniteReads 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:
readCharsin classCharSequenceInfinite- Returns:
- true if characters were read, false if no chars were read and end of input was reached
- Throws:
IOException
-