Class Reader

java.lang.Object
  extended bystructure.AbstractIterator
      extended byReader
All Implemented Interfaces:
java.util.Enumeration, java.util.Iterator

public class Reader
extends structure.AbstractIterator

A simple input stream that parses postscript files and generates a stream of Tokens. By default, the stream is constructed from a structure.ReadStream, but the Reader may also be constructed to read from a List. This allows the recursive implementation of procedures.


Constructor Summary
Reader()
          Constructs a Reader that reads from the default input stream.
Reader(structure.List l)
          Constructs a Reader that reads tokens from a List.
Reader(Token t)
          Constructs a Reader that reads from a single Token.
 
Method Summary
 java.lang.Object get()
          Not yet implemented.
 boolean hasNext()
          Check for more tokens on input stream.
static void main(java.lang.String[] args)
          A sample method that reads tokens from a Reader and prints their value to the console.
 java.lang.Object next()
          If hasNext() returns the next token from the input stream.
 void reset()
          If this is a list, resets the reader back to the beginning.
 
Methods inherited from class structure.AbstractIterator
hasMoreElements, nextElement, remove, value
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Reader

public Reader()
Constructs a Reader that reads from the default input stream.


Reader

public Reader(structure.List l)
Constructs a Reader that reads tokens from a List.

Parameters:
l - a List containing the tokens to be read.

Reader

public Reader(Token t)
Constructs a Reader that reads from a single Token. If the token is a procedure, the tokens are read from the associated list, otherwise a trivial stream is constructed that contains the single token.

Parameters:
t - the source of the token stream
Method Detail

hasNext

public boolean hasNext()
Check for more tokens on input stream.

Returns:
true iff there are more unprocessed tokens on stream.

get

public java.lang.Object get()
Not yet implemented.


reset

public void reset()
If this is a list, resets the reader back to the beginning. Tokens will be re-read.


next

public java.lang.Object next()
If hasNext() returns the next token from the input stream.

Returns:
the next token read from the stream.

main

public static void main(java.lang.String[] args)
A sample method that reads tokens from a Reader and prints their value to the console.