org.bioquery.query
Class ReaderUtils

java.lang.Object
  |
  +--org.bioquery.query.ReaderUtils

public class ReaderUtils
extends java.lang.Object


Constructor Summary
ReaderUtils()
           
 
Method Summary
static void discardBetween(java.io.Reader source, java.lang.StringBuffer destination, java.lang.String startTag, java.lang.String endTag)
          Convienence method simply calls saveUntil, then discardUntil, then saveToEnd
Puts everything EXCEPT what is in between the startTag and the endTag into the destination.
static void discardUntil(java.io.Reader source, java.lang.String tag)
          Reads the passed Reader up until the first instance of tag is found, discarding the chars.
static void saveBetween(java.io.Reader source, java.lang.StringBuffer destination, java.lang.String startTag, java.lang.String endTag)
          Convienence method simply calls discardUntil and then saveUntil
Puts the text from the source that is in between the 2 tags into the destination.
NOTE: Does not put the startTag into the destination, but DOES put the endTag in the destination.
If the startTag not found, will read the source to the end.
If the startTag found but no endTag, will read the source to the end, and return the destination with everything after the startTag inside it.
static void saveToEnd(java.io.Reader source, java.lang.StringBuffer destination)
          Simply dumps the source into the destination.
static void saveUntil(java.io.Reader source, java.lang.StringBuffer destination, java.lang.String tag)
          Reads the source and passes the contents into the destination until the tag is reached.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ReaderUtils

public ReaderUtils()
Method Detail

discardUntil

public static void discardUntil(java.io.Reader source,
                                java.lang.String tag)
                         throws java.io.IOException
Reads the passed Reader up until the first instance of tag is found, discarding the chars. Simply cuts the given Reader up to AND INCLUDING the tag. NOTE: cuts the tag off of the Reader.

saveUntil

public static void saveUntil(java.io.Reader source,
                             java.lang.StringBuffer destination,
                             java.lang.String tag)
                      throws java.io.IOException
Reads the source and passes the contents into the destination until the tag is reached. NOTE: passes the tag into the destination.

saveBetween

public static void saveBetween(java.io.Reader source,
                               java.lang.StringBuffer destination,
                               java.lang.String startTag,
                               java.lang.String endTag)
                        throws java.io.IOException
Convienence method simply calls discardUntil and then saveUntil
Puts the text from the source that is in between the 2 tags into the destination.
NOTE: Does not put the startTag into the destination, but DOES put the endTag in the destination.
If the startTag not found, will read the source to the end.
If the startTag found but no endTag, will read the source to the end, and return the destination with everything after the startTag inside it.

discardBetween

public static void discardBetween(java.io.Reader source,
                                  java.lang.StringBuffer destination,
                                  java.lang.String startTag,
                                  java.lang.String endTag)
                           throws java.io.IOException
Convienence method simply calls saveUntil, then discardUntil, then saveToEnd
Puts everything EXCEPT what is in between the startTag and the endTag into the destination. Always reads the source to the end.
NOTE: puts the startTag, but NOT the endTag into the destination.

saveToEnd

public static void saveToEnd(java.io.Reader source,
                             java.lang.StringBuffer destination)
                      throws java.io.IOException
Simply dumps the source into the destination. Always reads the source to the end.
It is assumed this method is only useful if one has already discarded some material from the source and/or loaded some material into the destination with one of the other methods in ReaderUtils.