gov.nih.nlm.umls.io
Class SearchStringPushBackReader

java.lang.Object
  extended byjava.io.Reader
      extended byjava.io.BufferedReader
          extended bygov.nih.nlm.umls.io.PushBackReader
              extended bygov.nih.nlm.umls.io.SearchStringPushBackReader

public class SearchStringPushBackReader
extends PushBackReader

Extends PushBackReader to provide the ability to find a single line of input, given a search string or pattern, and to push it back onto the reader to read it again on the next readLine() call.

Author:
Brian Carlsen

Field Summary
protected  String char_set
           
protected  RandomAccessFile raf
           
protected  String search_pattern
           
 
Fields inherited from class gov.nih.nlm.umls.io.PushBackReader
line
 
Fields inherited from class java.io.Reader
lock
 
Constructor Summary
SearchStringPushBackReader(File file, String search_str)
          Instantiates a new SearchStringPushBackReader from the specified file and search pattern.
SearchStringPushBackReader(RandomAccessFile raf, String search_str)
          Instantiates a new SearchStringPushBackReader from the specified file and search pattern.
 
Method Summary
 void close()
          Close the SearchStringPushBackReader.
 String readLine()
          Returns the next line from the reader.
 void setCharSet(String char_set)
          Sets the character set to the given parameter.
 
Methods inherited from class gov.nih.nlm.umls.io.PushBackReader
push
 
Methods inherited from class java.io.BufferedReader
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

char_set

protected String char_set

raf

protected RandomAccessFile raf

search_pattern

protected String search_pattern
Constructor Detail

SearchStringPushBackReader

public SearchStringPushBackReader(File file,
                                  String search_str)
                           throws IOException,
                                  FileNotFoundException
Instantiates a new SearchStringPushBackReader from the specified file and search pattern.

Parameters:
file - the File to open and search in
search_str - the search pattern
Throws:
IOException
FileNotFoundException

SearchStringPushBackReader

public SearchStringPushBackReader(RandomAccessFile raf,
                                  String search_str)
                           throws IOException,
                                  FileNotFoundException
Instantiates a new SearchStringPushBackReader from the specified file and search pattern.

Parameters:
raf - the RandomAccessFile to search in
search_str - the search pattern
Throws:
IOException
FileNotFoundException
Method Detail

readLine

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

Overrides:
readLine in class PushBackReader
Returns:
the next line from the reader
Throws:
IOException

setCharSet

public void setCharSet(String char_set)
Sets the character set to the given parameter.

Parameters:
char_set - character set parameter such as "UTF-8"

close

public void close()
           throws IOException
Close the SearchStringPushBackReader.

Throws:
IOException


Copyright ©2005