UC Berkeley Group for User Interface Research
Updated November 17, 2000

edu.berkeley.guir.lib.gesture.util
Class TokenReader

java.lang.Object
  |
  +--java.io.Reader
        |
        +--edu.berkeley.guir.lib.gesture.util.TokenReader

public class TokenReader
extends Reader

An extension of a Reader to read and unread a stream a token at a time. Someday will be able to ignore comments. WARNING: For some reason, nesting TokenReaders does not work. I don't know if it's a bug in the TokenReader or in the LineNumberReader.


Field Summary
protected  Reader delegate
           
protected  boolean isPushedBack
           
protected  String token
           
 
Fields inherited from class java.io.Reader
lock
 
Constructor Summary
TokenReader(Reader reader)
           
 
Method Summary
 void close()
           
static void main(String[] args)
           
 void mark(int readAheadLimit)
           
 boolean markSupported()
          maybe someday it could, but for now it doesn't
 int read()
           
 int read(char[] cbuf, int off, int len)
           
 boolean readBoolean()
           
 int readInt()
           
 String readLine()
           
 long readLong()
           
 String readToken()
           
 void reset()
           
 long skip(long n)
           
 void unreadString(String s)
          can only unread 1 string at a time
 
Methods inherited from class java.io.Reader
read, ready
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

token

protected String token

isPushedBack

protected boolean isPushedBack

delegate

protected Reader delegate
Constructor Detail

TokenReader

public TokenReader(Reader reader)
Method Detail

read

public int read()
         throws IOException
Overrides:
read in class Reader

read

public int read(char[] cbuf,
                int off,
                int len)
         throws IOException
Overrides:
read in class Reader

readLine

public String readLine()
                throws IOException

skip

public long skip(long n)
          throws IOException
Overrides:
skip in class Reader

markSupported

public boolean markSupported()
maybe someday it could, but for now it doesn't
Overrides:
markSupported in class Reader

mark

public void mark(int readAheadLimit)
          throws IOException
Overrides:
mark in class Reader

reset

public void reset()
           throws IOException
Overrides:
reset in class Reader

readToken

public String readToken()
                 throws IOException

readInt

public int readInt()
            throws IOException,
                   NumberFormatException

readLong

public long readLong()
              throws IOException,
                     NumberFormatException

readBoolean

public boolean readBoolean()
                    throws IOException

unreadString

public void unreadString(String s)
can only unread 1 string at a time

close

public void close()
           throws IOException
Overrides:
close in class Reader

main

public static void main(String[] args)

Copyright Information