Package org.smtlib
Class CharSequenceReader
java.lang.Object
org.smtlib.CharSequenceInfinite
org.smtlib.CharSequenceReader
- All Implemented Interfaces:
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
-
Nested Class Summary
Nested classes/interfaces inherited from class org.smtlib.CharSequenceInfinite
CharSequenceInfinite.IPrompter -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected ReaderThe Reader that supplies characters for the CharSequenceFields inherited from class org.smtlib.CharSequenceInfinite
amountRead, buf, endChar, length, prompter, sizeIncrease, sizeMultiple -
Constructor Summary
ConstructorsConstructorDescriptionCharSequenceReader(Reader rdr) Constructor for a new instanceCharSequenceReader(Reader rdr, 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
charAt, chars, codePoints, isEmpty, length, subSequence, toString
-
Field Details
-
rdr
The Reader that supplies characters for the CharSequence
-
-
Constructor Details
-
CharSequenceReader
Constructor for a new instance- Parameters:
rdr- the Reader 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
-
CharSequenceReader
Constructor for a new instance- Parameters:
rdr- the Reader that supplies characters on demand
-
-
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
-