Public Member Functions | |
dchar | readChar () |
Reads a single Unicode character from the input stream. | |
void | discardLine () |
Discards the currently buffered line of input. | |
size_t | bytesInBuffer () |
Returns the number of bytes currently waiting in the internal buffer. | |
size_t | bytesInLine () |
Returns the number of bytes remaining on the current line of input. | |
size_t | charsInBuffer () |
Returns the number of characters currently waiting in the internal buffer. | |
size_t | charsInLine () |
Returns the number of characters remaining on the current line of input. | |
char[] | readLine (bool withNewLine=false) |
Reads a line of text from the input stream. | |
bool | eof () |
Determines whether EOF of the input stream has been reached. |
This class buffers input on a line-by-line basis.
dchar smjg.libs.util.console.ConsoleInput.readChar | ( | ) |
Reads a single Unicode character from the input stream.
void smjg.libs.util.console.ConsoleInput.discardLine | ( | ) |
Discards the currently buffered line of input.
The next call to readChar, readLine or eof will therefore wait for a line of input from the user and use it.
If no text is waiting in the buffer, this function has no effect.
size_t smjg.libs.util.console.ConsoleInput.bytesInBuffer | ( | ) |
Returns the number of bytes currently waiting in the internal buffer.
This can be used to determine whether there is any more text to read before waiting for the user to input more.
size_t smjg.libs.util.console.ConsoleInput.bytesInLine | ( | ) |
Returns the number of bytes remaining on the current line of input.
This can be used to determine whether there is any text, other than a newline, which can be read before waiting for the user to input more.
size_t smjg.libs.util.console.ConsoleInput.charsInBuffer | ( | ) |
Returns the number of characters currently waiting in the internal buffer.
size_t smjg.libs.util.console.ConsoleInput.charsInLine | ( | ) |
Returns the number of characters remaining on the current line of input.
char [] smjg.libs.util.console.ConsoleInput.readLine | ( | bool | withNewLine = false |
) |
Reads a line of text from the input stream.
withNewLine | whether to include the terminating newline if it is present. This makes a difference only to the last line retrieved before EOF. |
null
on EOF. bool smjg.libs.util.console.ConsoleInput.eof | ( | ) |
Determines whether EOF of the input stream has been reached.
This function also reads a line of input into the buffer if it is empty and there is any input to read. Therefore, it will wait for the user to input a line if one isn't already available.
true | if the end of the input has been reached, and the buffer is empty. | |
false | if there is input still to be read. |