public class ForthStringReader extends ForthReader
EVALUATE.bufferSize, description, lineNumber, position| Constructor and Description |
|---|
ForthStringReader(VM vm,
int offset,
int length)
Construct a reader to read a string directly form the
Forth data space, starting at offset and lasting for length
characters.
|
| Modifier and Type | Method and Description |
|---|---|
protected int |
charAt(int off)
Return the character at the given offset into the buffer or -1
if the character is unavailable.
|
void |
close()
Close the input stream.
|
int |
getBase()
Return the location of the first character in the input stream.
|
int |
read()
Reads a single character.
|
boolean |
refill()
Attempt to fill the input buffer from the input source, and
return true if successful.
|
ForthReader |
restoreInput(VM vm)
Restore the current input environment from the system stack.
|
void |
saveInput(VM vm)
Save the current input parameters on the system stack.
|
backup, getDescription, getLineNumber, getPosition, isEmpty, ready, setLineNumber, setPosition, sizepublic ForthStringReader(VM vm, int offset, int length)
vm - the virtual machine where the string is stored.offset - the start of the stringlength - the length of the string, in characterspublic int read()
throws java.io.IOException
ForthReaderread in class ForthReaderjava.io.IOException - when there is a problem reading the input
stream.public void close()
throws java.io.IOException
ForthReaderclose in class ForthReaderjava.io.IOExceptionprotected int charAt(int off)
ForthReadercharAt in class ForthReaderoff - the offset from the start of the buffer to obtain
a character.public int getBase()
ForthReadergetBase in class ForthReaderpublic void saveInput(VM vm)
ForthReadersave-input function.
Place all of the parameters on the data stack followed by the
number of parameters.saveInput in class ForthReadervm - the virtual machine to use when saving the current
input environment.public ForthReader restoreInput(VM vm)
ForthReaderrestore-input function.
This is the counter part to the saveInput() method.
The top of the stack holds the number of parameters saved.restoreInput in class ForthReadervm - the virtual machine to recover input parameters
form.null if the input environment could not
be recovered.public boolean refill()
ForthReaderposition to zero,
set bufferSize to the number of bytes read,
and return true.
Receipt of a line containing no characters is considered
successful. If there is no input available return false.
This method is called by the Forth function refill.refill in class ForthReader