gov.nih.nlm.umls.io
Class PushBackReader

java.lang.Object
  extended byjava.io.Reader
      extended byjava.io.BufferedReader
          extended bygov.nih.nlm.umls.io.PushBackReader
Direct Known Subclasses:
SearchStringPushBackReader

public class PushBackReader
extends BufferedReader

Extends BufferedReader to provide the ability to push a single line of input back onto the reader to read it again on the next readLine() call.

Author:
Brian Carlsen

Field Summary
protected  String line
           
 
Fields inherited from class java.io.Reader
lock
 
Constructor Summary
PushBackReader(BufferedReader r)
          Instantiates a new PushBackReader wrapped around the specified reader.
 
Method Summary
 void push(String line)
          Push a line of input back onto the reader.
 String readLine()
          Returns the next line from the reader.
 
Methods inherited from class java.io.BufferedReader
close, mark, markSupported, read, read, ready, reset, skip
 
Methods inherited from class java.io.Reader
read
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

line

protected String line
Constructor Detail

PushBackReader

public PushBackReader(BufferedReader r)
Instantiates a new PushBackReader wrapped around the specified reader.

Parameters:
r - BufferedReader
Method Detail

readLine

public String readLine()
                throws IOException
Returns the next line from the reader.

Returns:
the next line from the reader
Throws:
IOException

push

public void push(String line)
Push a line of input back onto the reader.

Parameters:
line - input line to be pushed back on reader


Copyright ©2005