de.jstacs.io
Class SparseStringExtractor

java.lang.Object
  extended by de.jstacs.io.AbstractStringExtractor
      extended by de.jstacs.io.SparseStringExtractor
All Implemented Interfaces:
Enumeration<String>

public class SparseStringExtractor
extends AbstractStringExtractor

This StringExtractor reads the Strings from a File as the user asks for the String. Instances of this class are sparse since they do not store an array of Strings internally.

Author:
Jens Keilwagen

Field Summary
 
Fields inherited from class de.jstacs.io.AbstractStringExtractor
annotation, FASTA, ignore, ignorePattern, USUALLY
 
Constructor Summary
SparseStringExtractor(File file)
          A constructor that reads the lines from file.
SparseStringExtractor(File file, char ignore)
          A constructor that reads the lines from file and ignores those starting with the comment character ignore.
SparseStringExtractor(File file, char ignore, String annotation)
          A constructor that reads the lines from file, ignores those starting with the comment character ignore and sets the annotation of the source to annotation.
SparseStringExtractor(File file, String annotation)
          A constructor that reads the lines from file and sets the annotation of the source to annotation.
 
Method Summary
protected  void finalize()
           
 boolean hasMoreElements()
           
 String nextElement()
           
 
Methods inherited from class de.jstacs.io.AbstractStringExtractor
getAnnotation
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SparseStringExtractor

public SparseStringExtractor(File file)
                      throws IOException,
                             FileNotFoundException
A constructor that reads the lines from file.

Parameters:
file - the File to be read from
Throws:
IOException - if the File could not be read
FileNotFoundException - if the File could not be found
See Also:
SparseStringExtractor(File, char)

SparseStringExtractor

public SparseStringExtractor(File file,
                             char ignore)
                      throws IOException,
                             FileNotFoundException
A constructor that reads the lines from file and ignores those starting with the comment character ignore.

Parameters:
file - the File to be read from
ignore - the first character of lines that should be treated as comments
Throws:
IOException - if the File could not be read
FileNotFoundException - if the File could not be found
See Also:
SparseStringExtractor(File, char, String)

SparseStringExtractor

public SparseStringExtractor(File file,
                             String annotation)
                      throws IOException,
                             FileNotFoundException
A constructor that reads the lines from file and sets the annotation of the source to annotation.

Parameters:
file - the File to be read from
annotation - the annotation for the source
Throws:
IOException - if the File could not be read
FileNotFoundException - if the File could not be found
See Also:
SparseStringExtractor(File, char, String)

SparseStringExtractor

public SparseStringExtractor(File file,
                             char ignore,
                             String annotation)
                      throws IOException,
                             FileNotFoundException
A constructor that reads the lines from file, ignores those starting with the comment character ignore and sets the annotation of the source to annotation.

Parameters:
file - the File to be read from
ignore - the first character of lines that should be treated as comments
annotation - the annotation for the source
Throws:
IOException - if the File could not be read
FileNotFoundException - if the File could not be found
See Also:
AbstractStringExtractor.AbstractStringExtractor(char)
Method Detail

hasMoreElements

public boolean hasMoreElements()

nextElement

public String nextElement()

finalize

protected void finalize()
                 throws Throwable
Overrides:
finalize in class Object
Throws:
Throwable