Class StringScanner

java.lang.Object
org.pipservices3.expressions.io.StringScanner
All Implemented Interfaces:
IScanner

public class StringScanner extends Object implements IScanner
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final int
     
  • Constructor Summary

    Constructors
    Constructor
    Description
    Creates an instance of this class.
  • Method Summary

    Modifier and Type
    Method
    Description
    int
    Gets the column in the current line
    int
    Gets the current line number
    int
    Returns the character from the top of the stream without moving the stream pointer.
    int
    Gets the next character column number
    int
    Gets the next character line number
    int
    Reads character from the top of the stream.
    void
    Resets scanner to the initial position
    void
    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.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

  • Constructor Details

    • StringScanner

      public StringScanner(String content)
      Creates an instance of this class.
      Parameters:
      content - A text content to be read.
  • Method Details

    • line

      public int line()
      Gets the current line number
      Specified by:
      line in interface IScanner
      Returns:
      The current line number in the stream
    • column

      public int column()
      Gets the column in the current line
      Specified by:
      column in interface IScanner
      Returns:
      The column in the current line in the stream
    • read

      public int read()
      Reads character from the top of the stream. A read character or -1 if stream processed to the end.
      Specified by:
      read in interface IScanner
      Returns:
      A read character or -1 if stream processed to the end.
    • peek

      public int peek()
      Returns the character from the top of the stream without moving the stream pointer.
      Specified by:
      peek in interface IScanner
      Returns:
      A character from the top of the stream or -1 if stream is empty.
    • peekLine

      public int peekLine()
      Gets the next character line number
      Specified by:
      peekLine in interface IScanner
      Returns:
      The next character line number in the stream
    • peekColumn

      public int peekColumn()
      Gets the next character column number
      Specified by:
      peekColumn in interface IScanner
      Returns:
      The next character column number in the stream
    • unread

      public void unread()
      Puts the one character back into the stream stream.
      Specified by:
      unread in interface IScanner
    • unreadMany

      public void unreadMany(int count)
      Pushes the specified number of characters to the top of the stream.
      Specified by:
      unreadMany in interface IScanner
      Parameters:
      count - A number of characcted to be pushed back.
    • reset

      public void reset()
      Resets scanner to the initial position
      Specified by:
      reset in interface IScanner