juju.reattore.util
Class PushbackArray

java.lang.Object
  |
  +--juju.reattore.util.PushbackArray

public class PushbackArray
extends java.lang.Object

Simple one character pushback system that works across multiple input arrays.


Field Summary
static int EOF
          Returned when all bytes have been read.
 
Constructor Summary
PushbackArray()
           
 
Method Summary
 int get()
          Returns the next byte in the pushback or input, or EOF if everything has been read.
 void pushback(int b)
          Returns the given byte back to the input.
 void seed(byte[] ab)
          Seeds the push back system with a new array to read from.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

EOF

public static final int EOF
Returned when all bytes have been read.

See Also:
Constant Field Values
Constructor Detail

PushbackArray

public PushbackArray()
Method Detail

seed

public void seed(byte[] ab)
Seeds the push back system with a new array to read from. Does not discard any existing push back.

Parameters:
ab - The array to read from.

get

public int get()
Returns the next byte in the pushback or input, or EOF if everything has been read.

Returns:
The next byte in the stream.

pushback

public void pushback(int b)
Returns the given byte back to the input. The next call to get() will return this.

Parameters:
b - Any byte. Does not have to have been read.


Copyright © 2002-2003 Michael Hope. All Rights Reserved.