Class Reader

  • All Implemented Interfaces:
    java.util.Iterator<Token>

    public class Reader
    extends java.lang.Object
    implements java.util.Iterator<Token>
    A simple input stream that parses postscript files and generates a stream of Tokens. If constructed with no arguments, the Reader will process tokens from the terminal. To process tokens from a file, use the construtor that takes a String.
    • Constructor Summary

      Constructors 
      Constructor Description
      Reader()
      Constructs a reader of postscript tokens from System.in (the terminal)
      Reader​(java.lang.String filename)
      Constructs a reader of postscript tokens from the file with the given filename.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean hasNext()
      Check if there is a next input token
      Token next()
      Get the next input token
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • Methods inherited from interface java.util.Iterator

        forEachRemaining, remove
    • Constructor Detail

      • Reader

        public Reader()
        Constructs a reader of postscript tokens from System.in (the terminal)
      • Reader

        public Reader​(java.lang.String filename)
        Constructs a reader of postscript tokens from the file with the given filename.
        Parameters:
        filename - the file to read postscript tokens from
    • Method Detail

      • hasNext

        public boolean hasNext()
        Check if there is a next input token
        Specified by:
        hasNext in interface java.util.Iterator<Token>
        Returns:
        returns true if there are more tokens on input stream
      • next

        public Token next()
        Get the next input token
        Specified by:
        next in interface java.util.Iterator<Token>
        Returns:
        consumes and returns next Token from input stream.