Package org.pipservices3.expressions.io
Interface IScanner
- All Known Implementing Classes:
StringScanner
public interface IScanner
Defines scanner that can read and unread characters and count lines.
This scanner is used by tokenizers to process input streams.
-
Method Summary
Modifier and TypeMethodDescriptionintcolumn()Gets the column in the current lineintline()Gets the current line numberintpeek()Returns the character from the top of the stream without moving the stream pointer.intGets the next character column numberintpeekLine()Gets the next character line numberintread()Reads character from the top of the stream.voidreset()Resets scanner to the initial positionvoidunread()Puts the one character back into the stream stream.voidunreadMany(int count) Pushes the specified number of characters to the top of the stream.
-
Method Details
-
read
int read()Reads character from the top of the stream.- Returns:
- A read character or
-1if stream processed to the end.
-
line
int line()Gets the current line number- Returns:
- The current line number in the stream
-
column
int column()Gets the column in the current line- Returns:
- The column in the current line in the stream
-
peek
int peek()Returns the character from the top of the stream without moving the stream pointer.- Returns:
- A character from the top of the stream or
-1if stream is empty.
-
peekLine
int peekLine()Gets the next character line number- Returns:
- The next character line number in the stream
-
peekColumn
int peekColumn()Gets the next character column number- Returns:
- The next character column number in the stream
-
unread
void unread()Puts the one character back into the stream stream. -
unreadMany
void unreadMany(int count) Pushes the specified number of characters to the top of the stream.- Parameters:
count- A number of characcted to be pushed back.
-
reset
void reset()Resets scanner to the initial position
-