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 Type Method Description
      int column()
      Gets the column in the current line
      int line()
      Gets the current line number
      int peek()
      Returns the character from the top of the stream without moving the stream pointer.
      int peekColumn()
      Gets the next character column number
      int peekLine()
      Gets the next character line number
      int read()
      Reads character from the top of the stream.
      void reset()
      Resets scanner to the initial position
      void unread()
      Puts the one character back into the stream stream.
      void unreadMany​(int count)
      Pushes the specified number of characters to the top of the stream.
    • Method Detail

      • read

        int read()
        Reads character from the top of the stream.
        Returns:
        A read character or -1 if 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 -1 if 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